Skip to content

Instantly share code, notes, and snippets.

@celesteh
Last active May 21, 2024 13:53
Show Gist options
  • Save celesteh/fc5488fa5cd00e81aca5b37b9da497b1 to your computer and use it in GitHub Desktop.
Save celesteh/fc5488fa5cd00e81aca5b37b9da497b1 to your computer and use it in GitHub Desktop.
System update script
#!/bin/bash
# get the updates
sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade && sudo apt autoremove && sudo apt-get autoremove
# fix anything that went wrong
sudo apt install -f
# cursed distribution methods
sudo snap refresh
flatpak update
# update AppImages (extra-cursed)
currentdir= pwd
cd ~/bin
ech="echo"
$ech "foo"
apptool="./appimageupdatetool-x86_64.AppImage"
#$apptool --self-update
apptoolname= basename $apptool
echo "apptoolname $apptoolname atn $apptool at"
echo "for loop"
files=(*.AppImage)
for file in "${files[@]}"; do
appname= basename $file
#echo "$appname"
#if [ "$appname" != "$apptoolname" ] ; then # this isn't working
#echo "$file"
$apptool $file
#fi
done
cd $currentdir # go back
# deal with zoom
should_check_zoom=false
last_checked=/tmp/zoom_last_checked
if test -e "$last_checked"; then
# the file exists
#check when file was created
if test `find "$last_checked" -mmin +720` # 1440 = 24 hours
then
should_check_zoom=true
rm $last_checked
fi
else
should_check_zoom=true
fi
if [ $should_check_zoom = true ]; then
touch $last_checked
echo "Checking Zoom versions."
#update zoom
ZOOM_DEB='zoom_amd64.deb'
# check it we have the latest version
version_installed=$(cat /opt/zoom/version.txt)
version_available=$(wget --spider https://zoom.us/client/latest/zoom_amd64.deb 2>&1 | grep Location | sed -e 's/.*prod\/\(.*\)\/.*/\1/')
# were we able to find out the latest version on the website?
if [[ -n ${version_available} ]]; then
echo "Zoom Installed: ${version_installed}"
echo "Zoom Available: ${version_available}"
# If we don't have the same version as the website, download and install the web's version
if [[ "${version_installed}" == "${version_available}" ]]; then
echo "The latest Zoom version is already installed."
else
curl -J -L -o /tmp/${ZOOM_DEB} https://www.zoom.us/client/latest/${ZOOM_DEB}
sudo apt-get install /tmp/${ZOOM_DEB}
# fix anything that went wrong
sudo apt install -f
echo "Zoom updated"
fi
fi
# done with zoom
fi
sudo do-release-upgrade
@celesteh
Copy link
Author

Now with app images, which I keep in ~/bin. This requires appimageupdatetool https://github.com/AppImageCommunity/AppImageUpdate/releases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment