summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiterpunk <piterpunk@slackware.com>2021-12-29 17:51:30 -0300
committerRobby Workman <rworkman@slackware.com>2022-01-16 02:52:09 -0600
commitf8dfb7722fe8f1b190450b2c9f83d16df8fa5fcb (patch)
tree9dceb402780cff69239183a01b6a917177819d85
parent0ea2cf2f56a83bc6b626d9896a5aed72614fcffc (diff)
downloadslackpkg-f8dfb7722fe8f1b190450b2c9f83d16df8fa5fcb.tar.xz
File to flag if the system needs restart
Creates /var/run/needs_restarting file if any "critical" package got upgraded. As the /var/run/ is ephemeral and renewed each boot, the file disappears after reboot. The packages that flags the restart need are: - kernel-generic, kernel-huge: as a new kernel needs a restart to be running. - glibc, glibc-solibs: Restart is the only way to be sure that all running binaries are using the new glibc. - eudev, elogind, dbus: those provides some very basic system services. - openssl, openssl-solibs: security bugs on those libs are dangerous, the reboot makes sure that all running binaries are using the newer version.
-rw-r--r--files/core-functions.sh23
1 files changed, 23 insertions, 0 deletions
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() {