aboutsummaryrefslogtreecommitdiff
path: root/share/config/templates/bootless
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
parentf1c55982006fa5e2a8706f7460a4cd16e9f767d3 (diff)
downloadhydra-4e7b5ca4b492a72186840677b990b2b543a76900.tar.gz
hydra-4e7b5ca4b492a72186840677b990b2b543a76900.tar.bz2
Bootless: enhanced bootfde and bootimg configs
Diffstat (limited to 'share/config/templates/bootless')
-rw-r--r--share/config/templates/bootless/custom.cfg21
-rw-r--r--share/config/templates/bootless/grub.cfg58
2 files changed, 63 insertions, 16 deletions
diff --git a/share/config/templates/bootless/custom.cfg b/share/config/templates/bootless/custom.cfg
index 5eaf786..87de184 100644
--- a/share/config/templates/bootless/custom.cfg
+++ b/share/config/templates/bootless/custom.cfg
@@ -8,22 +8,19 @@ set menu_color_highlight=yellow/red
# Example: imagens stored in the USB stick: just put your images under custom/debian/images.
#
menuentry 'Example: Darkstar' {
- set version=3.16.0-4
- set source=/dev/mapper/vg-root
- set target=root
-
- echo 'Loading AMD64 Debian Desktop (Jessie)...'
- linux /boot/custom/debian/vmlinuz-${version}-amd64 root=/dev/mapper/root cryptopts=target=${target},source=${source} ro quiet apparmor=1 security=apparmor
- echo 'Loading initial ramdisk ...'
- initrd /boot/custom/debian/initrd.img-${version}-amd64
+ set volume=/dev/sda5
+ set version=3.16.0-4-amd64
+ set target=sda5_crypt
+ set rootfs=darkstar--vg-root
+ set distro=debian
+ bootimg ${volume} ${version} ${source} ${target} ${distro}
}
#
# Example: Full Disk Encryption: images are loaded from encrypted partition.
#
menuentry 'Example: Darkstar FDE' {
- set machine=darkstar
- set version=3.16.0-4
-
- bootfde ${machine} ${version}
+ set volume=darkstar
+ set version=3.16.0-4-amd64
+ bootfde ${volume} ${version}
}
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