#!/bin/bash # WARNING: this script will destroy data on the selected disk. # This script can be run by executing the following: # curl -sL https://git.io/vAoV8 | bash set -uo pipefail trap 's=$?; echo "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR REPO_URL="https:mkessler-arch.maximilian-kessler.de" MIRRORLIST_URL="https://archlinux.org/mirrorlist/?country=DE&protocol=https&use_mirror_status=on" echo "Updating mirror list" curl -s "$MIRRORLIST_URL" | \ sed -e 's/^#Server/Server/' -e '/^#/d' | \ rankmirrors -n 5 - > /etc/pacman.d/mirrorlist ### Get infomation from user ### hostname=$(dialog --stdout --inputbox "Enter hostname" 0 0) || exit 1 clear : ${hostname:?"hostname cannot be empty"} user=$(dialog --stdout --inputbox "Enter username" 0 0) || exit 1 clear : ${user:?"user cannot be empty"} password=$(dialog --stdout --passwordbox "Enter disk encryption password" 0 0) || exit 1 clear : ${password:?"password cannot be empty"} password2=$(dialog --stdout --passwordbox "Enter disk encryption password again" 0 0) || exit 1 clear [[ "$password" == "$password2" ]] || ( echo "Passwords did not match"; exit 1; ) devicelist=$(lsblk -dplnx size -o name,size | grep -Ev "boot|rpmb|loop" | tac) device=$(dialog --stdout --menu "Select installation disk" 0 0 0 ${devicelist}) || exit 1 clear # set up all further variables cryptlvm="cryptlvm" vlgrp="vlgrp" key_fingerprint="B419CDA93D7544F8214B3216A23D90C2433DAFBC" mapped_device="/dev/mapper/${cryptlvm}" part_boot="${device}p1" part_luks="${device}p2" part_swap="/dev/${vlgrp}/swap" part_root="/dev/${vlgrp}/root" part_home="/dev/${vlgrp}/home" ### Set up logging ### exec 1> >(tee "stdout.log") exec 2> >(tee "stderr.log") timedatectl set-ntp true ### Setup the disk and partitions ### ram_size=$(free --mebi | awk '/Mem:/ {print $2}') swap_size=$((ram_size + 1024))M # 1 Gigabyte more swap space than available ram root_size=60G # creates two partitions: one boot partition and another partition, filling the rest of space echo "Creating partitions on ${device}..." fdisk "${device}" <> /mnt/etc/fstab echo "${hostname}" > /mnt/etc/hostname ### Set up custom repo on installed system as well cat >>/mnt/etc/pacman.conf <