Last active
March 5, 2022 17:11
-
-
Save jikamens/354d7692f7f07a51e1c0b63c5b0380b7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash -e | |
# Pick the first updatable package that isn't held, and list what was | |
# updated. | |
trap "rm /tmp/*.$$" EXIT | |
cp /var/log/dpkg.log /tmp/dpkg.log.$$ | |
apt-mark showhold | awk -F: '{print $1}' |sort -u > /tmp/held.$$ | |
apt list --upgradable 2>/dev/null | awk -F/ 'NR>1 {print $1}' | sort -u > \ | |
/tmp/upgradable.$$ | |
package="$(comm -23 /tmp/upgradable.$$ /tmp/held.$$)" | |
if [ ! "$package" ]; then | |
echo "There are no unheld packages to update." 1>&2 | |
exit 1 | |
fi | |
apt-get install $package | |
echo | |
diff /tmp/dpkg.log.$$ /var/log/dpkg | grep ' upgrade ' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment