PortValhalla/scripts/Arch/OS/setup.sh

40 lines
1.5 KiB
Bash
Raw Normal View History

2023-04-01 11:01:39 +00:00
#!/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";
2023-04-01 11:13:52 +00:00
arch-chroot "$ARCH_MOUNT_ROOT" ln -sf /usr/share/zoneinfo/Europe/Zurich /etc/localtime;
arch-chroot "$ARCH_MOUNT_ROOT" hwclock --systohc;
2023-04-01 11:01:39 +00:00
2023-04-01 11:13:52 +00:00
arch-chroot "$ARCH_MOUNT_ROOT" sed -i "s/#$LOCALE_PATTERN/\1/" /etc/locale.gen;
arch-chroot "$ARCH_MOUNT_ROOT" locale-gen;
2023-04-01 13:21:28 +00:00
echo "LANG=$ARCH_LANG" | arch-chroot "$ARCH_MOUNT_ROOT" tee /etc/locale.conf > /dev/null;
echo "KEYMAP=$ARCH_KEYMAP" | arch-chroot "$ARCH_MOUNT_ROOT" tee /etc/vconsole.conf > /dev/null;
2023-04-01 11:01:39 +00:00
2023-04-01 11:13:52 +00:00
arch-chroot "$ARCH_MOUNT_ROOT" echo "$ARCH_HOSTNAME" > /etc/hostname;
arch-chroot "$ARCH_MOUNT_ROOT" mkinitcpio -P;
2023-04-01 11:01:39 +00:00
echo "Please choose a password for the user \`root\`";
2023-04-01 11:13:52 +00:00
arch-chroot "$ARCH_MOUNT_ROOT" passwd;
2023-04-01 11:01:39 +00:00
2023-04-01 11:55:04 +00:00
dir="$(realpath ../../..)";
2023-04-01 12:05:01 +00:00
scriptRoot="$(realpath --relative-to "$dir" "$(pwd)")";
2023-04-01 12:17:27 +00:00
tempDir="/root/$(basename "$dir")";
cp -r "$dir" "$ARCH_MOUNT_ROOT/root/";
2023-04-01 15:08:17 +00:00
arch-chroot "$ARCH_MOUNT_ROOT" bash "$tempDir/$scriptRoot/../Software/GRUB/install.sh";
2023-04-01 12:21:10 +00:00
arch-chroot "$ARCH_MOUNT_ROOT" rm -rf "$tempDir";
2023-04-01 11:01:39 +00:00
popd > /dev/null;