diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100755 index 0000000..4129209 --- /dev/null +++ b/bootstrap.sh @@ -0,0 +1,124 @@ +#!/bin/bash + +while getopts "p:n:d:" opt; +do case $opt in + p) PASSWD=${OPTARG} ;; + n) NAME=${OPTARG} ;; + d) DEV=${OPTARG} ;; + \?) echo "-$OPTARG is not valid" >&2 && exit ;; + esac +done + +# stop on error +set -e + + +PASSWD=${PASSWD:="toor"} +NAME=${NAME:="archibald"} +PASSWD=${DEV:="nvme0n1"} + + +echo "+---------------------+" +echo "| Archlinux Bootstrap |" +echo "+---------------------+" +echo "ROOTPWD = $PASSWD" +echo "HOSTNAME = $NAME" +echo -e "DEVICE = $DEV\n" +sleep 2 + +timedatectl set-ntp true + +gdisk < /etc/pacman.d/mirrorlist + +pacstrap /mnt base base-devel wpa_supplicant dialog +genfstab -p /mnt > /mnt/etc/fstab + +cat < /mnt/root/bootstrap2.sh +#!/bin/bash + +ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime +hwclock --systohc -utc + +echo "en_US.UTF-8 UTF-8" > /etc/locale.gen +locale-gen + +echo "LANG=en_US.UTF-8" > /etc/locale.conf +echo $NAME > /etc/hostname + +mkinitcpio -p linux + +pacman -Sy --noconfirm efibootmgr dosfstools gptfdisk + +bootctl install + +cat < /boot/loader/entries/arch-uefi.conf +title Arch +linux /vmlinuz-linux +initrd /initramfs-linux.img +options root=LABEL=P_ROOT rw resume=LABEL=P_SWAP +EEE + +cat < /boot/loader/entries/arch-uefi-fallback.conf +title Arch +title Arch Linux Fallback +linux /vmlinuz-linux +initrd /initramfs-linux-fallback.img +options root=LABEL=P_ROOT rw resume=LABEL=P_SWAP +EEE + + +cat < /boot/loader/loader.conf +default arch-uefi +timeout 1 +EEE + +pacman --noconfirm -Sy reflector +reflector --country 'Germany' --sort rate --protocol https --save /etc/pacman.d/mirrorlist + +printf "${PWD}\n${PWD}\n" | passwd root + +exit +EOF + +chmod u+x /mnt/root/bootstrap2.sh + +arch-chroot /mnt /root/bootstrap2.sh +rm /mnt/root/bootstrap2.sh && rm ./bootstrap.sh + +# reboot