PortValhalla/scripts/Arch/OS/setup.sh

66 lines
2.2 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"}";
2023-04-03 21:33:24 +00:00
ARCH_LANG="${ARCH_LANG:-"en_US.UTF-8"}";
ARCH_KEYMAP="${ARCH_KEYMAP:-"de_CH-latin1"}";
2023-04-03 21:52:20 +00:00
ARCH_X11_KEYMAP="${ARCH_X11_KEYMAP:-"ch"}";
2023-04-03 21:33:24 +00:00
LOCALE_PATTERN="${LOCALE_PATTERN:-"\(de_CH\|en_US\)"}";
2023-04-01 11:01:39 +00:00
2023-04-03 09:00:54 +00:00
USER_NAME="${USER_NAME:-manuel}";
2023-04-03 08:35:01 +00:00
USER_DISPLAYNAME="${USER_DISPLAYNAME}";
USER_GROUPS="${USER_GROUPS}";
2023-04-03 08:21:27 +00:00
projectRoot="$(realpath ../../..)";
projectName="$(basename "$projectRoot")";
relativeDir="$(realpath --relative-to "$projectRoot" "$(pwd)")";
tempRoot="/root/$(basename "$projectName")";
tempDir="$tempRoot/$relativeDir";
2023-04-01 11:01:39 +00:00
loadkeys "$ARCH_KEYMAP";
timedatectl set-timezone "$ARCH_TIMEZONE";
. "./partition.sh";
2023-04-04 10:27:18 +00:00
pacstrap -K "$ARCH_MOUNT_ROOT" \
base \
linux \
linux-firmware \
networkmanager \
man-db \
man-pages \
texinfo;
2023-04-04 10:59:50 +00:00
cp -r "$projectRoot" "${ARCH_MOUNT_ROOT}$tempRoot";
2023-04-01 11:01:39 +00:00
genfstab -U "$ARCH_MOUNT_ROOT" >> "$ARCH_MOUNT_ROOT/etc/fstab";
2023-04-03 09:14:46 +00:00
arch-chroot "$ARCH_MOUNT_ROOT" systemctl enable NetworkManager;
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
2023-04-03 08:21:27 +00:00
arch-chroot "$ARCH_MOUNT_ROOT" bash "$tempDir/../Software/GRUB/install.sh";
2023-04-03 09:00:11 +00:00
arch-chroot "$ARCH_MOUNT_ROOT" bash "$tempDir/../Software/sudo/install.sh";
2023-04-03 09:18:37 +00:00
arch-chroot "$ARCH_MOUNT_ROOT" bash "$tempDir/../Software/GNOME/install.sh";
2023-04-03 21:52:20 +00:00
arch-chroot localectl set-x11-keymap "$ARCH_X11_KEYMAP";
2023-04-01 11:01:39 +00:00
2023-04-03 08:35:01 +00:00
USER_NAME="${USER_NAME}" \
USER_DISPLAYNAME="${USER_DISPLAYNAME}" \
USER_GROUPS="${USER_GROUPS}" \
arch-chroot "$ARCH_MOUNT_ROOT" bash "$tempDir/user.sh";
2023-04-03 08:39:17 +00:00
arch-chroot "$ARCH_MOUNT_ROOT" rm -rf "$tempRoot";
2023-04-01 11:01:39 +00:00
popd > /dev/null;