#!/bin/sh set -ex do_edit() { printf "Edit \"$1\" ? : " read -r resp case $resp in Y|y) arch-chroot "${_install_path}" nvim "$1" ;; *) ;; esac } do_chroot() { arch-chroot "$_install_path" "$@" } _install_path="${INSTALL_PATH:-/mnt}" _tz="${TZ:-America/New_York}" _hostname="${INSTALL_HOSTNAME:-arch}" PACSTRAP="${PACSTRAP:-1}" set +x if ! awk '{print $2}' /proc/mounts | grep -q '^'"$_install_path"'$' ; then echo "Cannot install to \"$_install_path\" because it is not a mountpoint" echo "if you've mounted somewhere other than /mnt use:" echo " env INSTALL_PATH= ./arch-install.sh" echo where '' is the mount point in question exit 1 fi set -x if [ $PACSTRAP -eq 1 ] ; then pacstrap -K "$_install_path" \ arch-install-scripts \ base \ base-devel \ cryptsetup \ dosfstools \ e2fsprogs \ efibootmgr \ git \ gptfdisk \ grub \ linux \ linux-firmware \ linux-firmware-marvell \ lvm2 \ networkmanager \ nvim \ sof-firmware \ tmux \ xfsprogs \ fi genfstab -U "$_install_path" >> "${_install_path}/etc/fstab" do_edit /etc/fstab do_edit /etc/locale.gen do_chroot locale-gen do_chroot ln -sf "/usr/share/zoneinfo/$_tz" /etc/localtime do_edit /etc/mkinitcpio.conf do_chroot mkinitcpio -p linux do_edit /etc/default/grub do_chroot grub-install --target=x86_64-efi --removable --efi-directory=/boot/efi do_chroot grub-mkconfig -o /boot/grub/grub.cfg do_chroot passwd