aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHolden Rohrer <hr@hrhr.dev>2020-04-16 17:51:21 -0400
committerHolden Rohrer <hr@hrhr.dev>2020-04-16 17:51:21 -0400
commiteac6e4fe4e4c46acb3174c200e3e302a2d155bf1 (patch)
treedda0fff72421702213d307eabc0c650cf17052fa
parentc7e711f6e17adb9c45ddd89a325b27444e282c90 (diff)
lvm on luks setup (untested)
-rwxr-xr-xinstall.sh55
-rw-r--r--src/etc/default/grub.orig54
-rw-r--r--src/etc/mkinitcpio.conf7
3 files changed, 89 insertions, 27 deletions
diff --git a/install.sh b/install.sh
index 64ed805..bcbc318 100755
--- a/install.sh
+++ b/install.sh
@@ -14,38 +14,39 @@ export BASE=$(basename $DRIVE)
export PART="/dev/$(basename $(echo /sys/class/block/$BASE/$BASE* | \
xargs -n1 echo | sed 1q | rev | cut -c 2- | rev ))"
# List all partitions of device, get first one, remove last char.
-sudo umount $DRIVE*
+umount $DRIVE*
if [ ! -e installed ]; then
-fdisk $DRIVE <<EOF
- g
- n
- 1
-
- +512M
- t
- 1
- n
- 2
-
- +20G
- w
-EOF
-
-yes | mkfs.vfat ${PART}1
-yes | mkfs.ext4 ${PART}2
+ parted $DRIVE mklabel gpt
+ parted $DRIVE mkpart fat32 0 512M
+ parted $DRIVE set 1 esp on
+ parted $DRIVE mkpart ext4 512M -30G
+ parted $DRIVE mkpart ntfs -30G -0
+ yes | mkfs.vfat ${PART}1
+ yes | mkfs.ntfs ${PART}3
+ cryptsetup luksFormat ${PART}2
+ cryptsetup open ${PART}2 cryptlvm
+ pvcreate /dev/mapper/cryptlvm
+ vgcreate Crypt /dev/mapper/cryptlvm
+ lvcreate -L 16G Crypt -n swap
+ mkswap /dev/Crypt/swap
+ lvcreate -L 32G Crypt -n root
+ mkfs.ext4 /dev/Crypt/root
-mount ${PART}2 /mnt
-mkdir /mnt/efi
-mount ${PART}1 /mnt/efi
+ mount /dev/Crypt/root /mnt
+ mkdir /mnt/efi
+ mount ${PART}1 /mnt/efi
+ swapon /dev/Crypt/swap
-pacstrap /mnt base || exit 1
-genfstab -U /mnt >> /mnt/etc/fstab
-cp -r . /mnt
-touch installed
+ pacstrap /mnt base || exit 1
+ genfstab -U /mnt >> /mnt/etc/fstab
+ cp -r . /mnt
+ sed "s|%%UUID%%|$(blkid ${PART}2)|" src/etc/default/grub.orig > src/etc/default/grub
+ touch installed
else
-mount ${PART}2 /mnt
-mount ${PART}1 /mnt/efi
+ cryptsetup open ${PART}2 cryptlvm
+ mount /dev/Crypt/root /mnt
+ mount ${PART}1 /mnt/efi
fi
arch-chroot /mnt << EOF
cd dotfiles
diff --git a/src/etc/default/grub.orig b/src/etc/default/grub.orig
new file mode 100644
index 0000000..83e4a5c
--- /dev/null
+++ b/src/etc/default/grub.orig
@@ -0,0 +1,54 @@
+# GRUB boot loader configuration
+
+GRUB_DEFAULT=0
+GRUB_TIMEOUT=5
+GRUB_DISTRIBUTOR="Arch"
+GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 quiet"
+GRUB_CMDLINE_LINUX="cryptdevice=UUID=%%UUID%%:cryptlvm root=/dev/Crypt/root"
+
+# Preload both GPT and MBR modules so that they are not missed
+GRUB_PRELOAD_MODULES="part_gpt part_msdos"
+
+# Uncomment to enable booting from LUKS encrypted devices
+GRUB_ENABLE_CRYPTODISK=y
+
+# Set to 'countdown' or 'hidden' to change timeout behavior,
+# press ESC key to display menu.
+GRUB_TIMEOUT_STYLE=menu
+
+# Uncomment to use basic console
+GRUB_TERMINAL_INPUT=console
+
+# Uncomment to disable graphical terminal
+#GRUB_TERMINAL_OUTPUT=console
+
+# The resolution used on graphical terminal
+# note that you can use only modes which your graphic card supports via VBE
+# you can see them in real GRUB with the command `vbeinfo'
+GRUB_GFXMODE=auto
+
+# Uncomment to allow the kernel use the same resolution used by grub
+GRUB_GFXPAYLOAD_LINUX=keep
+
+# Uncomment if you want GRUB to pass to the Linux kernel the old parameter
+# format "root=/dev/xxx" instead of "root=/dev/disk/by-uuid/xxx"
+#GRUB_DISABLE_LINUX_UUID=true
+
+# Uncomment to disable generation of recovery mode menu entries
+GRUB_DISABLE_RECOVERY=true
+
+# Uncomment and set to the desired menu colors. Used by normal and wallpaper
+# modes only. Entries specified as foreground/background.
+#GRUB_COLOR_NORMAL="light-blue/black"
+#GRUB_COLOR_HIGHLIGHT="light-cyan/blue"
+
+# Uncomment one of them for the gfx desired, a image background or a gfxtheme
+#GRUB_BACKGROUND="/path/to/wallpaper"
+#GRUB_THEME="/path/to/gfxtheme"
+
+# Uncomment to get a beep at GRUB start
+#GRUB_INIT_TUNE="480 440 1"
+
+# Uncomment to make GRUB remember the last selection. This requires
+# setting 'GRUB_DEFAULT=saved' above.
+#GRUB_SAVEDEFAULT="true"
diff --git a/src/etc/mkinitcpio.conf b/src/etc/mkinitcpio.conf
new file mode 100644
index 0000000..ed06478
--- /dev/null
+++ b/src/etc/mkinitcpio.conf
@@ -0,0 +1,7 @@
+MODULES=()
+
+BINARIES=()
+
+FILES=()
+
+HOOKS=(base udev autodetect keyboard keymap consolefont modconf block encrypt lvm2 filesystems fsck)