diff --git a/elfLaptop.sfdisk b/elfLaptop.sfdisk new file mode 100644 index 0000000..73d6484 --- /dev/null +++ b/elfLaptop.sfdisk @@ -0,0 +1,11 @@ +label: gpt +label-id: F961223E-AB17-44CA-8DC3-082C1476070D +device: /dev/sdb +unit: sectors +first-lba: 34 +last-lba: 250069646 +sector-size: 512 + +/dev/sdb1 : start= 2048, size= 2097152, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=486DA8A9-47F3-469D-9458-F29776D786A3, name="boot" +/dev/sdb2 : start= 2099200, size= 16777216, type=0657FD6D-A4AB-43C4-84E5-0933C84B4F4F, uuid=DCA4D33F-2283-48EE-98BF-739D527ABBBB +/dev/sdb3 : start= 18876416, size= 231192576, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=ACF561E3-BE4F-479A-A9EF-2C82B324E35E, name="root" diff --git a/elfLaptop.sh b/elfLaptop.sh new file mode 100644 index 0000000..eb356c5 --- /dev/null +++ b/elfLaptop.sh @@ -0,0 +1,80 @@ + +HOSTNAME="ELFLaptop" +DISK="/dev/sdb" + +function run(){ + echo "[ ] $1" + echo "# $1" >>install.log + echo "> $2" >>install.log + bash -c "$2" &>>install.log \ + && echo -e "\e[1A\e[K[ \e[32mOK\e[0m ] $1" \ + || { + echo -e "\e[1A\e[K[\e[31mFAIL\e[0m] $1" + bash -c "$3" + exit + } + echo >>install.log +} + +echo "" >install.log + +echo +echo === setup localisation +echo + +run "enable ntp" "timedatectl set-ntp true" +run "set timezone" "timedatectl set-timezone Europe/Amsterdam" + +echo +echo === setup partitions +echo + +run "applly partion table" "sfdisk $DISK <<./sfdisk" + +echo -n "disk encryption password: " +read -s PASS +echo +echo -n "retype password: " +read -s PASSRE +echo + +if [ "$PASS" != "$PASSRE" ]; then + echo "password do not match" + exit +fi +echo + +run "format boot partition" "mkfs.fat ${DISK}1" +run "format swap partition" "mkswap ${DISK}2" +echo -n "$PASS" >keyfile.luks +run "encrypt root partition" "cryptsetup luksFormat --batch-mode --key-file keyfile.luks ${DISK}3" "rm keyfile.luks" +run "map root partitaion" "cryptsetup open --batch-mode --key-file keyfile.luks ${DISK}3 cryptroot" "rm keyfile.luks" +rm keyfile.luks +run "format root partition" "mkfs.btrfs /dev/mapper/cryptroot" + +run "mount root partition" "mount /dev/mapper/cryptroot /mnt" +run "create root btrfs subvolume" "btrfs subvolume create /mnt/@" +run "create home btrfs subvolume" "btrfs subvolume create /mnt/@home" +run "unmount btrfs" "umount /mnt" +run "mount root subvolume" "mount -o subvol=@ /dev/mapper/cryptroot /mnt" +run "make root directorys" "mkdir -p /mnt/boot /mnt/home" +run "mount boot partition" "mount ${DISK}1 /mnt/boot" +run "mount home subvolume" "mount -o subvol=@home /dev/mapper/cryptroot /mnt/home" +run "enable swap" "swapon ${DISK}2" + +echo +echo === install arch +echo + +run "install base of arch" "pacstrap /mnt base linux linux-firmware grub efibootmgr" +run "intall utitlities" "pacstrap /mnt btrfs-progs man vim" + +echo "generate fstab" +genfstab -U /mnt >>/mnt/etc/fstab +run "copy in-root script" "cp in-root.sh /mnt/root" + +echo +echo === chroot config +echo + +#arch-chroot /mnt bash /root/in-root.sh "$HOSTNAME" "$DISK"