summaryrefslogtreecommitdiff
path: root/share/config/templates/bootless/grub.cfg
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2016-07-02 19:12:57 -0300
committerSilvio Rhatto <rhatto@riseup.net>2016-07-02 19:12:57 -0300
commit4e7b5ca4b492a72186840677b990b2b543a76900 (patch)
treed3d7062d0150ae225f7d53072c740a46a3c08be8 /share/config/templates/bootless/grub.cfg
parentf1c55982006fa5e2a8706f7460a4cd16e9f767d3 (diff)
downloadhydra-4e7b5ca4b492a72186840677b990b2b543a76900.tar.gz
hydra-4e7b5ca4b492a72186840677b990b2b543a76900.tar.bz2
Bootless: enhanced bootfde and bootimg configs
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