Add a script for setting up arch

This commit is contained in:
Manuel Thalmann 2023-04-01 13:01:39 +02:00
parent 8c5e68beb0
commit b13731eb6f

36
scripts/OS/Arch/setup.sh Normal file
View file

@ -0,0 +1,36 @@
#!/bin/bash
pushd "${BASH_SOURCE%/*}" > /dev/null;
ARCH_TIMEZONE="${ARCH_TIMEZONE:-Europe/Zurich}";
ARCH_DISK="${ARCH_DISK}";
ARCH_HOSTNAME="${ARCH_HOSTNAME}";
ARCH_MOUNT_ROOT="${ARCH_MOUNT_ROOT:-"/mnt"}";
ARCH_LANG="en_US.UTF-8";
ARCH_KEYMAP="de_CH-latin1";
LOCALE_PATTERN="\(de_CH\|en_US\)";
loadkeys "$ARCH_KEYMAP";
timedatectl set-timezone "$ARCH_TIMEZONE";
. "./partition.sh";
pacstrap -K "$ARCH_MOUNT_ROOT" base linux linux-firmware networkmanager;
genfstab -U "$ARCH_MOUNT_ROOT" >> "$ARCH_MOUNT_ROOT/etc/fstab";
sudo --chroot="$ARCH_MOUNT_ROOT" . ./init.sh;
sudo --chroot="$ARCH_MOUNT_ROOT" ln -sf /usr/share/zoneinfo/Europe/Zurich /etc/localtime;
sudo --chroot="$ARCH_MOUNT_ROOT" hwclock --systohc;
sudo --chroot="$ARCH_MOUNT_ROOT" sed -i "s/#$LOCALE_PATTERN/\1/" /etc/locale.gen;
sudo --chroot="$ARCH_MOUNT_ROOT" locale-gen;
sudo --chroot="$ARCH_MOUNT_ROOT" echo "LANG=$ARCH_LANG" >> /etc/locale.conf;
sudo --chroot="$ARCH_MOUNT_ROOT" echo "KEYMAP=$ARCH_KEYMAP" >> /etc/vconsole.conf;
sudo --chroot="$ARCH_MOUNT_ROOT" echo "$ARCH_HOSTNAME" > /etc/hostname;
sudo --chroot="$ARCH_MOUNT_ROOT" mkinitcpio -P;
echo "Please choose a password for the user \`root\`";
sudo --chroot="$ARCH_MOUNT_ROOT" passwd;
sudo --chroot="$ARCH_MOUNT_ROOT" . ../../Software/GRUB/install.sh;
popd > /dev/null;