slack-autoupdate

Update your Slackware system automatically
Log | Files | Refs | README

commit 5b15f85fd6506716b87873767045a646076faa00
parent 6ba6dd8def236c175c429cdb448cae7b9721955f
Author: Slack Coder <slackcoder@server.ky>
Date:   Mon, 25 Mar 2024 13:29:55 -0500

Improve kernel update handling

Handle more generic situations:

 - Use /boot/vmlinuz instead of /boot/vmlinuz-huge.
 - Use the kernel md5sum to confirm kernel changes.

Diffstat:
MREADME.md | 2+-
Msrc/install-kernel | 4++--
Msrc/rc.slack-autoupdate | 6+++---
3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/README.md b/README.md @@ -83,7 +83,7 @@ into your system. You should modify it to suit your circumstance. The default script assumes you are using elilo and the kernel for your EFI is installed into /efi/EFI/Slackware/vmlinuz. -Adjust the script to your system using your favorite editor or vim: +Adjust the script to your system using your favorite editor: ``` vim install-kernel diff --git a/src/install-kernel b/src/install-kernel @@ -4,7 +4,7 @@ # # The /boot/vmlinuz-huge softlink points to the last installed kernel. -KERNEL_VERSION="$(realpath /boot/vmlinuz-huge | sed 's/.*\/.*-\(.*\)/\1/')" +KERNEL_VERSION="$(realpath /boot/vmlinuz | sed 's/.*\/.*-\(.*\)/\1/')" if [ "$1" ]; then KERNEL_VERSION="$(echo "$1" | sed 's/.*\/.*-\(.*\)/\1/')" fi @@ -15,7 +15,7 @@ if [ -z "$KERNEL_VERSION" ]; then fi echo "Installing kernel version $KERNEL_VERSION into the efi..." -cp -H /boot/vmlinuz-huge /efi/EFI/Slackware/vmlinuz +cp -H /boot/vmlinuz /efi/EFI/Slackware/vmlinuz if [ -f /etc/mkinitrd.conf ]; then echo "Installing initialized ram disk into the efi..." mkinitrd -F -k "$KERNEL_VERSION" >/dev/null diff --git a/src/rc.slack-autoupdate b/src/rc.slack-autoupdate @@ -21,16 +21,16 @@ if read -r -t 5 -p "Installing updates, press enter to skip this process..."; th exit 0 fi -OLD_KERNEL="$(realpath /boot/vmlinuz)" +OLD_KERNEL="$(md5sum /boot/vmlinuz | cut -f1 -d' ')" for PKG in $UPDATES; do upgradepkg --install-new "$PKG" done -NEW_KERNEL="$(realpath /boot/vmlinuz)" +NEW_KERNEL="$(md5sum /boot/vmlinuz | cut -f1 -d' ')" if [ "$OLD_KERNEL" != "$NEW_KERNEL" ]; then if command -v install-kernel &> /dev/null; then - install-kernel "$NEW_KERNEL" + install-kernel /boot/vmlinuz fi fi