2018-05-02 10:29:49 +02:00
|
|
|
#!/usr/bin/env bash
|
2019-08-25 18:38:57 +02:00
|
|
|
|
|
|
|
# A simple script for updating all package managers simultaneously
|
|
|
|
|
|
|
|
# Show commands being executed
|
2018-05-02 10:29:49 +02:00
|
|
|
set -x
|
2019-08-25 18:38:57 +02:00
|
|
|
|
|
|
|
# I am not sure if -y here even does anything, at least it won't work for
|
|
|
|
# accepting suite changes for Debian when testing becomes stable.
|
|
|
|
# Checking for updates or new packages.
|
2019-11-01 09:17:55 +01:00
|
|
|
if hash apt-get 2>/dev/null; then
|
|
|
|
apt-get -y update
|
2019-08-25 18:38:57 +02:00
|
|
|
|
|
|
|
# If arguments like -y are passed to the script, they become "$@"
|
2019-11-01 09:17:55 +01:00
|
|
|
apt-get "$@" upgrade --with-new-pkgs
|
|
|
|
fi
|
2019-08-25 18:38:57 +02:00
|
|
|
|
|
|
|
# Flatpak apps are sandboxed and should be safe to update automatically
|
2019-11-01 09:17:55 +01:00
|
|
|
if hash flatpak 2>/dev/null; then
|
|
|
|
flatpak update --assumeyes --noninteractive
|
|
|
|
# Flatpak's version of `apt autoremove`
|
|
|
|
#flatpak uninstall --unused
|
|
|
|
fi
|
2019-08-25 18:38:57 +02:00
|
|
|
|
|
|
|
# Snap packages auto-update anyway though, but I like checking them while
|
|
|
|
# doing everything else too
|
2019-11-01 09:17:55 +01:00
|
|
|
if hash snap 2>/dev/null; then
|
|
|
|
snap refresh
|
|
|
|
# so I may have some sort of an idea when snap packages have been updated
|
|
|
|
# if they have auto-refreshed
|
|
|
|
snap changes
|
|
|
|
fi
|
2019-08-25 18:38:57 +02:00
|
|
|
|
|
|
|
# So the local apt-file database is up-to-date.
|
2019-11-01 09:17:55 +01:00
|
|
|
if hash apt-file 2>/dev/null; then
|
|
|
|
apt-file update
|
|
|
|
fi
|
2019-08-25 18:38:57 +02:00
|
|
|
|
|
|
|
# I don't have flatpak or snap going to background, because I often do
|
|
|
|
# ./deb-update.bash && poweroff
|
|
|
|
|
|
|
|
# Hide commands being executed again
|
2018-05-02 10:29:49 +02:00
|
|
|
set +x
|