]> git.mar77i.info Git - superuser/commitdiff
add need_reboot.sh
authormar77i <mar77i@protonmail.ch>
Tue, 30 Jun 2026 10:43:24 +0000 (12:43 +0200)
committermar77i <mar77i@protonmail.ch>
Tue, 30 Jun 2026 10:43:24 +0000 (12:43 +0200)
need_reboot.sh [new file with mode: 0755]

diff --git a/need_reboot.sh b/need_reboot.sh
new file mode 100755 (executable)
index 0000000..0874aa8
--- /dev/null
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+
+installed_kernel_version() {
+    pacman -Qi linux | \
+        sed -rn 's/^Version[[:space:]]+:[[:space:]]*//;s/\.(artix)/-\1/p'
+}
+
+summary="$(pacman -Qi linux | sed -rn 's/^Version[[:space:]]+:[[:space:]]*//p') vs $(uname -r)"
+
+if [[ "$(installed_kernel_version)" != "$(uname -r)" ]]; then
+    echo "Reboot advised (${summary})."
+else
+    echo "Reboot not needed (${summary})."
+fi