aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mikisabate@gmail.com>2024-08-13 22:54:10 +0200
committerMiquel Sabaté Solà <mikisabate@gmail.com>2024-08-13 22:54:10 +0200
commit5dfffe65150a1ea4dfcec45c8dc977184b5bb9df (patch)
treeaf579e0e227daf55e41db38d0eb37067b8a8bcf8 /bin
parente211f27ba1f5b7b68812f7442575842784f80b71 (diff)
downloaddotfiles-5dfffe65150a1ea4dfcec45c8dc977184b5bb9df.tar.gz
dotfiles-5dfffe65150a1ea4dfcec45c8dc977184b5bb9df.zip
kbuild: append lines for extboot by default
Usually the configuration for extboot is just the same. For that, before starting the editor for it, append the configuration that I'd most likely be using. Then the editor session might just be deleting the old lines and removing the warning comment. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/kbuild40
1 files changed, 38 insertions, 2 deletions
diff --git a/bin/kbuild b/bin/kbuild
index ffbcee8..1c7ed11 100755
--- a/bin/kbuild
+++ b/bin/kbuild
@@ -147,6 +147,9 @@ cat <<SCRIPT >"$INSTALL_PATH/install.sh"
set -ex
+##
+# Ensure you are root and dependencies are met.
+
if [ "\$EUID" -ne 0 ];then
echo "kbuild (error): run this as root."
exit 1
@@ -157,6 +160,9 @@ if [ ! -f /sbin/update-initramfs ] && [ ! -f /usr/bin/dracut ]; then
exit 1
fi
+##
+# Copy files into filesystem and generate initramfs.
+
cp -rv usr /
cp -rv boot /
@@ -168,6 +174,31 @@ else
update-initramfs -k $name -u
fi
+##
+# Configure /boot/extlinux/extlinux.conf by providing a default
+
+cat <<EXT >>/boot/extlinux/extlinux.conf
+###
+### NOTE: generated by kbuild.
+###
+
+label l1
+ menu label Debian GNU/Linux bookworm/sid $name
+ linux /vmlinuz-$name
+ initrd /initrd.img-$name
+
+ fdtdir /dtbs/$name
+ append root=/dev/nvme0n1p4 rw console=tty0 console=ttyS0,115200 earlycon rootwait stmmaceth=chain_mode:1 selinux=0
+
+label l1r
+ menu label Debian GNU/Linux bookworm/sid $name (rescue target)
+ linux /vmlinuz-$name
+ initrd /initrd.img-$name
+
+ fdtdir /dtbs/$name
+ append root=/dev/nvme0n1p4 rw console=tty0 console=ttyS0,115200 earlycon rootwait stmmaceth=chain_mode:1 selinux=0 single
+EXT
+
if [ -z "\$EDITOR" ]; then
EDITOR=vi
fi
@@ -191,8 +222,13 @@ if [ ! -f files.txt ]; then
fi
xargs rm -f < files.txt
-rmdir /boot/dtbs/$name
-rmdir /usr/lib/modules/$name
+rm -r /boot/dtbs/$name
+rm -r /usr/lib/modules/$name
+
+if [ -z "\$EDITOR" ]; then
+ EDITOR=vi
+fi
+\$EDITOR /boot/extlinux/extlinux.conf
SCRIPT
##