Skip to content

Commit

Permalink
Merge pull request #241 from leomeinel/temp
Browse files Browse the repository at this point in the history
Merge main from temp
  • Loading branch information
leomeinel authored May 8, 2023
2 parents 07ba9d5 + 40879a5 commit 8b7216c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 15 deletions.
15 changes: 8 additions & 7 deletions post.sh
Original file line number Diff line number Diff line change
Expand Up @@ -214,28 +214,29 @@ YES)
doas cryptboot-efikeys create
doas cryptboot-efikeys enroll
doas cryptboot systemd-boot-sign
source "/etc/cryptboot.conf"
doas sh -c "{
echo "uefi_secureboot_cert=\"/etc/secureboot/keys/db.crt\""
echo "uefi_secureboot_key=\"/etc/secureboot/keys/db.key\""
echo "uefi_secureboot_cert=\""$EFI_KEYS_DIR"/keys/db.crt\""
echo "uefi_secureboot_key=\""$EFI_KEYS_DIR"/keys/db.key\""
} >/etc/dracut.conf.d/secureboot.conf"
;;
*)
{
echo '#!/bin/bash'
echo ''
echo 'EFI_KEYS_DIR="/etc/secureboot/keys"'
echo 'source "/etc/cryptboot.conf"'
echo 'read -rp "Have you transferred your keys to $EFI_KEYS_DIR? (Type '"'"'yes'"'"' in capital letters): " choice'
echo 'case "$choice" in'
echo 'YES)'
echo 'chmod 000 "$EFI_KEYS_DIR"/*'
echo ' if mountpoint -q /efi; then'
echo ' doas umount -AR /efi'
echo ' fi'
echo ' doas mount /efi'
echo ' doas cryptboot systemd-boot-sign'
echo ' doas sh -c "{'
echo ' echo "uefi_secureboot_cert=\"/etc/secureboot/keys/db.crt\""'
echo ' echo "uefi_secureboot_key=\"/etc/secureboot/keys/db.key\""'
echo ' echo "uefi_secureboot_cert=\""$EFI_KEYS_DIR"/db.crt\""'
echo ' echo "uefi_secureboot_key=\""$EFI_KEYS_DIR"/db.key\""'
echo ' } >/etc/dracut.conf.d/secureboot.conf"'
echo ' ;;'
echo '*)'
Expand All @@ -244,10 +245,10 @@ YES)
echo ' ;;'
echo 'esac'
} >~/secureboot.sh
mkdir -p "$EFI_KEYS_DIR"
chmod 700 "$EFI_KEYS_DIR"
chmod 700 ~/secureboot.sh
echo "WARNING: User aborted enrolling secureboot keys"
EFI_KEYS_DIR="/etc/secureboot/keys"
source "/etc/cryptboot.conf"
echo " Deploy your own keys in $EFI_KEYS_DIR and run ~/secureboot.sh to sign your bootloader"
;;
esac
Expand Down
16 changes: 8 additions & 8 deletions prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -138,22 +138,22 @@ OPTIONS1="nodev,noatime,space_cache=v2,compress=zstd,ssd,discard=async,subvol=/@
OPTIONS2="nodev,nosuid,noatime,space_cache=v2,compress=zstd,ssd,discard=async,subvol=/@"
OPTIONS3="noexec,nodev,nosuid,noatime,space_cache=v2,compress=zstd,ssd,discard=async,subvol=/@"
mount_subs0() {
mkdir "/mnt$1"
mkdir -p "/mnt$1"
mount -o "$3$2" "$4" "/mnt$1"
mkdir "/mnt$1.snapshots"
mkdir -p "/mnt$1.snapshots"
mount -o "$OPTIONS3${2}_snapshots" "$4" "/mnt${SUBVOLUMES[$i]}.snapshots"
mount_subs1 "$1" "$3" "$4"
}
mount_subs1() {
for ((a = 0; a < SUBVOLUMES_LENGTH; a++)); do
if [[ "${SUBVOLUMES[$a]}" != "$1" ]] && grep -nq "^$1" <<<"${SUBVOLUMES[$a]}"; then
mkdir "/mnt${SUBVOLUMES[$a]}"
mkdir -p "/mnt${SUBVOLUMES[$a]}"
if grep -nq "^${1}lib/" <<<"${SUBVOLUMES[$a]}"; then
mount -o "$OPTIONS3${CONFIGS[$a]}" "$3" "/mnt${SUBVOLUMES[$a]}"
else
mount -o "$2${CONFIGS[$a]}" "$3" "/mnt${SUBVOLUMES[$a]}"
fi
mkdir "/mnt${SUBVOLUMES[$a]}.snapshots"
mkdir -p "/mnt${SUBVOLUMES[$a]}.snapshots"
mount -o "$OPTIONS3${CONFIGS[$a]}_snapshots" "$3" "/mnt${SUBVOLUMES[$a]}.snapshots"
fi
done
Expand All @@ -162,7 +162,7 @@ for ((i = 0; i < SUBVOLUMES_LENGTH; i++)); do
case "${SUBVOLUMES[$i]}" in
"/")
mount -o "$OPTIONS0" /dev/mapper/vg0-lv0 "/mnt${SUBVOLUMES[$i]}"
mkdir "/mnt${SUBVOLUMES[$i]}.snapshots"
mkdir -p "/mnt${SUBVOLUMES[$i]}.snapshots"
mount -o "${OPTIONS3}snapshots" /dev/mapper/vg0-lv0 "/mnt${SUBVOLUMES[$i]}.snapshots"
;;
"/usr/")
Expand All @@ -178,10 +178,10 @@ for ((i = 0; i < SUBVOLUMES_LENGTH; i++)); do
done
chmod 775 /mnt/var/games
## /efi
mkdir /mnt/efi
mkdir -p /mnt/efi
mount -o noexec,nodev,nosuid "$DISK1P1" /mnt/efi
## /boot
mkdir /mnt/boot
mkdir -p /mnt/boot

# Set SSD state to "frozen" after sleep
for link in /dev/disk/by-id/*; do
Expand Down Expand Up @@ -253,6 +253,6 @@ genfstab -U /mnt >>/mnt/etc/fstab
} >>/mnt/etc/fstab

# Prepare /mnt/git/arch-install
mkdir /mnt/git
mkdir -p /mnt/git
mv "$SCRIPT_DIR" /mnt/git/
chmod +x /mnt/git/arch-install/setup.sh
3 changes: 3 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ MD0UUID="$(blkid -s UUID -o value $DISK1P2)"
{
echo "md0_crypt UUID=$MD0UUID none luks,key-slot=0"
} >/etc/crypttab
## Create /etc/encryption/keys directory
mkdir -p /etc/encryption/keys
chown 700 /etc/encryption/keys
## Configure /etc/localtime /etc/vconsole.conf /etc/hostname /etc/hosts
ln -sf /usr/share/zoneinfo/"$TIMEZONE" /etc/localtime
hwclock --systohc
Expand Down
3 changes: 3 additions & 0 deletions sysuser.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,8 @@ cp "$SCRIPT_DIR/post.sh" ~/
cp "$SCRIPT_DIR/install.conf" ~/
chmod +x ~/post.sh

# Create backups directory
mkdir -p ~/backups

# Remove repo
rm -rf ~/git

0 comments on commit 8b7216c

Please sign in to comment.