diff --git a/files/core-functions.sh b/files/core-functions.sh index 463a190..56314e9 100644 --- a/files/core-functions.sh +++ b/files/core-functions.sh @@ -1318,6 +1318,28 @@ for slackpkg to work properly. fi } +# Checks if a critical package were upgraded by Slackpkg. +# The /var/run/needs_restarting file contains the list of upgraded +# packages. +# +# The file only is created if /var/run filesystem type is tmpfs so +# the reboot will clean it +function needs_restarting() { + if [ "$(stat -f -c %T /var/run/)" = "tmpfs" ]; then + find $ROOT/var/log/packages/ -cnewer $TMPDIR/timestamp -type f \( \ + -name "kernel-generic-[0-9]*" -o \ + -name "kernel-huge-[0-9]*" -o \ + -name "openssl-solibs-[0-9]*" -o \ + -name "openssl-[0-9]*" -o \ + -name "glibc-[0-9]*" -o \ + -name "aaa_glibc-solibs-[0-9]*" -o \ + -name "eudev-[0-9]*" -o \ + -name "elogind-[0-9]*" -o \ + -name "dbus-[0-9]*" \) | \ + awk -F/ '{ print $NF }' >> $ROOT/var/run/needs_restarting + fi +} + function remove_pkg() { local i @@ -1342,6 +1364,7 @@ function upgrade_pkg() { for i in $SHOWLIST; do getpkg $i upgradepkg Upgrading done + needs_restarting } function install_pkg() {