dotfiles/symlinks/bin/print-last-system-upgrade

20 lines
598 B
Plaintext
Raw Normal View History

2021-01-07 08:09:41 +00:00
#!/bin/bash
if [ $MACHINE_TYPE == "mac" ]; then
print-last-brew-update
else
if type pacman &> /dev/null
then
LAST_SYSTEM_UPGRADE=$( cat /var/log/pacman.log | grep "starting full system upgrade" | awk 'END{ print substr($1, 2, length($1)-2) }' )
2021-01-07 08:09:41 +00:00
LAST_SYSTEM_UPGRADE_DATE=$( date -d "$LAST_SYSTEM_UPGRADE" +%s )
fi
if type apt &> /dev/null
then
LAST_SYSTEM_UPGRADE=$( stat /var/cache/apt/pkgcache.bin | grep Modify | sed 's/Modify: //' )
LAST_SYSTEM_UPGRADE_DATE=$( date -d "$LAST_SYSTEM_UPGRADE" +%s )
fi
print-system-upgrade-date $LAST_SYSTEM_UPGRADE_DATE update-all-packages
fi