summaryrefslogtreecommitdiff
path: root/airootfs/root/.loader
diff options
context:
space:
mode:
authorTom Barrett <tom@tombarrett.xyz>2021-07-21 22:20:48 +0200
committerTom Barrett <tom@tombarrett.xyz>2021-07-21 22:20:48 +0200
commitfff917132ec4ddb5ef8f34ac790d9959963dd74a (patch)
tree091871643fe86021115bc43f55002fe53f21963b /airootfs/root/.loader
parent11c7f231d2cf06245b52e302868337ea44b6081f (diff)
now with encryption
Diffstat (limited to 'airootfs/root/.loader')
-rwxr-xr-xairootfs/root/.loader27
1 files changed, 25 insertions, 2 deletions
diff --git a/airootfs/root/.loader b/airootfs/root/.loader
index 3f4bed6..2b50ba4 100755
--- a/airootfs/root/.loader
+++ b/airootfs/root/.loader
@@ -1,6 +1,12 @@
#!/bin/bash
set -e
+dd if=/dev/zero of=/swapfile bs=1M count=512 status=progress
+chmod 0600 /swapfile
+mkswap /swapfile
+swapon /swapfile
+genfstab -U / | grep -v resolv > /etc/fstab
+
ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
hwclock --systohc
@@ -14,5 +20,22 @@ echo "127.0.0.1 localhost" > /etc/hosts
echo "::1 localhost" >> /etc/hosts
echo "127.0.1.1 $2.lan $2" >> /etc/hosts
-grub-install $1
-grub-mkconfig -o /boot/grub/grub.cfg
+OLD="HOOKS=(base udev autodetect modconf block filesystems keyboard fsck)"
+NEW="HOOKS=(base udev autodetect keyboard keymap consolefont modconf block encrypt filesystems fsck)"
+sed -i "s|$OLD|$NEW|g" /etc/mkinitcpio.conf
+mkinitcpio -P
+
+UUID=$(lsblk --output UUID,PATH | grep "$3" | cut -f 1 -d ' ')
+OLD="GRUB_CMDLINE_LINUX_DEFAULT=\"loglevel=3 quiet\""
+NEW="GRUB_CMDLINE_LINUX_DEFAULT=\"loglevel=3 quiet cryptdevice=UUID=$UUID:cryptroot root=/dev/mapper/cryptroot\""
+sed -i "s|$OLD|$NEW|g" /etc/default/grub
+
+grub-install "$1"
+if ! test -e "/sys/firmware/efi/efivars"; then
+ grub-mkconfig -o /boot/grub/grub.cfg
+else
+ grub-mkconfig -o /boot/grub/grub.cfg --efi-directory=/boot/
+fi
+passwd
+rm /root/loader
+echo "good to go !"