summaryrefslogtreecommitdiff
path: root/share/config/templates/bootless/grub.cfg
diff options
context:
space:
mode:
Diffstat (limited to 'share/config/templates/bootless/grub.cfg')
-rw-r--r--share/config/templates/bootless/grub.cfg58
1 files changed, 54 insertions, 4 deletions
diff --git a/share/config/templates/bootless/grub.cfg b/share/config/templates/bootless/grub.cfg
index b4e9e25..3864c4a 100644
--- a/share/config/templates/bootless/grub.cfg
+++ b/share/config/templates/bootless/grub.cfg
@@ -23,18 +23,66 @@ set menu_color_highlight=yellow/red
#
# Handles boot from fully encrypted /boot volumes.
+# Usage: bootfde <volume> <kernel-version> [source] [target]
#
function bootfde {
insmod luks
insmod lvm
- cryptomount lvm/${1}-root
+ cryptomount lvm/${1}
set root=(crypto0)
+ set volume=${1}
+ set version=${2}
+
+ if [ "${3}" ]; then
+ set source=${3}
+ else
+ set source=/dev/mapper/${1}
+ fi
+
+ if [ "${4}" ]; then
+ set target=${4}
+ else
+ set target=root
+ fi
+
+ echo "Loading ${volume}..."
+ linux /boot/vmlinuz-${version} root=/dev/mapper/${target} cryptopts=target=${target},source=${source} ro quiet
+ echo 'Loading initial ramdisk ...'
+ initrd /boot/initrd.img-${version}
+}
+
+#
+# Handles boot from images stored in the USB stick.
+# Usage: bootfde <volume> <kernel-version> [target] [rootfs] [distro]
+#
+function bootimg {
+ set volume=${1}
+ set version=${2}
+
+ if [ "${3}" ]; then
+ set target=${3}
+ else
+ set target=root
+ fi
+
+ if [ "${4}" ]; then
+ set rootfs=${4}
+ else
+ set rootfs=${target}
+ fi
+
+ if [ "${5}" ]; then
+ set distro=${5}
+ else
+ set distro=debian
+ fi
+
echo "Loading ${1}..."
- linux /boot/vmlinuz-${2}-amd64 root=/dev/mapper/root cryptopts=target=root,source=/dev/mapper/${1}-root ro quiet
+ linux /boot/custom/${distro}/vmlinuz-${version} root=/dev/mapper/${rootfs} cryptopts=target=${target},source=${volume} ro quiet apparmor=1 security=apparmor
echo 'Loading initial ramdisk ...'
- initrd /boot/initrd.img-${2}-amd64
+ initrd /boot/custom/${distro}/initrd.img-${version}
}
#
@@ -48,5 +96,7 @@ menuentry "Memtest86+" {
# Custom menu entries
#
if [ -e "/boot/custom/custom.cfg" ]; then
- configfile /boot/custom/custom.cfg
+ menuentry "Custom configurations" {
+ configfile /boot/custom/custom.cfg
+ }
fi