aboutsummaryrefslogtreecommitdiff
path: root/src/install-kernel
diff options
context:
space:
mode:
authorSlack Coder <slackcoder@server.ky>2024-02-16 11:42:34 -0500
committerSlack Coder <slackcoder@server.ky>2024-03-16 14:26:39 -0500
commitd0c7803ddd1b99261fbbddd000e888ee7ef555f7 (patch)
tree2eeba46dfdd7921de576a967221525b15c68e1c8 /src/install-kernel
downloadslack-autoupdate-d0c7803ddd1b99261fbbddd000e888ee7ef555f7.tar.xz
Initial commit
Diffstat (limited to 'src/install-kernel')
-rw-r--r--src/install-kernel22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/install-kernel b/src/install-kernel
new file mode 100644
index 0000000..42db67a
--- /dev/null
+++ b/src/install-kernel
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# System local command to install the kernel into the system boot loader.
+#
+
+# The /boot/vmlinuz-huge softlink points to the last installed kernel.
+KERNEL_VERSION="$(realpath /boot/vmlinuz-huge | sed 's/.*\/.*-\(.*\)/\1/')"
+if [ "$1" ]; then
+ KERNEL_VERSION="$(echo "$1" | sed 's/.*\/.*-\(.*\)/\1/')"
+fi
+
+if [ -z "$KERNEL_VERSION" ]; then
+ >&2 echo "The kernel version could not be detected from the filename."
+ exit 1
+fi
+
+echo "Installing kernel version $KERNEL_VERSION into the efi..."
+cp -H /boot/vmlinuz-huge /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
+fi