2024-03-24 23:26:12 +00:00
|
|
|
#!/bin/bash -e
|
2024-06-23 13:03:20 +00:00
|
|
|
PARTITION_MODULE="${PARTITION_MODULE:+"$(realpath "$PARTITION_MODULE")"}";
|
2023-04-01 11:01:39 +00:00
|
|
|
pushd "${BASH_SOURCE%/*}" > /dev/null;
|
|
|
|
|
2024-06-22 21:32:57 +00:00
|
|
|
PARTITION_MODULE="${PARTITION_MODULE:-"./partition.nix"}";
|
2023-04-04 20:55:37 +00:00
|
|
|
ARCH_TIMEZONE="${ARCH_TIMEZONE:-"Europe/Zurich"}";
|
2023-04-01 11:01:39 +00:00
|
|
|
ARCH_HOSTNAME="${ARCH_HOSTNAME}";
|
2024-06-22 21:32:57 +00:00
|
|
|
ARCH_MOUNT_ROOT="${ARCH_MOUNT_ROOT:-"$(../../eval-module.sh "$PARTITION_MODULE" partition.rootDir --raw)"}";
|
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-04 21:41:44 +00:00
|
|
|
LOCALE_PATTERN="${LOCALE_PATTERN:-\(de_CH\|en_US\)}";
|
2023-04-01 11:01:39 +00:00
|
|
|
|
2023-04-04 20:55:37 +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";
|
2024-06-22 21:32:57 +00:00
|
|
|
|
|
|
|
. "../../Common/OS/partition.sh";
|
2023-04-04 10:27:18 +00:00
|
|
|
|
2023-06-09 21:31:42 +00:00
|
|
|
pacman-key --init;
|
|
|
|
pacman-key --populate;
|
|
|
|
|
2023-04-04 10:27:18 +00:00
|
|
|
pacstrap -K "$ARCH_MOUNT_ROOT" \
|
|
|
|
base \
|
|
|
|
linux \
|
|
|
|
linux-firmware \
|
|
|
|
networkmanager \
|
|
|
|
man-db \
|
|
|
|
man-pages \
|
2023-05-24 05:13:45 +00:00
|
|
|
texinfo \
|
2024-03-07 18:15:46 +00:00
|
|
|
;
|
2023-04-04 10:27:18 +00:00
|
|
|
|
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-04 21:41:44 +00:00
|
|
|
arch-chroot "$ARCH_MOUNT_ROOT" sed -i "s/^#\?\($LOCALE_PATTERN.*\)$/\1/" /etc/locale.gen;
|
2023-04-01 11:13:52 +00:00
|
|
|
arch-chroot "$ARCH_MOUNT_ROOT" locale-gen;
|
2023-05-25 18:06:37 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
echo "LANG=de_CH.UTF-8"
|
|
|
|
echo "LANGUAGE=en_US.UTF-8"
|
|
|
|
echo "LC_MESSAGES=en_US.UTF-8"
|
|
|
|
} | arch-chroot "$ARCH_MOUNT_ROOT" tee /etc/locale.conf > /dev/null;
|
|
|
|
|
2023-04-01 13:21:28 +00:00
|
|
|
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-06 11:41:09 +00:00
|
|
|
echo "$ARCH_HOSTNAME" | arch-chroot "$ARCH_MOUNT_ROOT" tee /etc/hostname;
|
2023-04-01 11:13:52 +00:00
|
|
|
arch-chroot "$ARCH_MOUNT_ROOT" mkinitcpio -P;
|
2023-04-01 11:01:39 +00:00
|
|
|
|
2023-05-04 19:53:07 +00:00
|
|
|
arch-chroot "$ARCH_MOUNT_ROOT" pacman -Syu;
|
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-08-04 16:09:09 +00:00
|
|
|
pacstrap -K "$ARCH_MOUNT_ROOT" git;
|
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-04 21:00:00 +00:00
|
|
|
cp ./set-keymap.service "$ARCH_MOUNT_ROOT/etc/systemd/system";
|
|
|
|
systemd-nspawn -D "$ARCH_MOUNT_ROOT" systemctl enable set-keymap;
|
|
|
|
systemd-nspawn -bD "$ARCH_MOUNT_ROOT" -E "ARCH_X11_KEYMAP=${ARCH_X11_KEYMAP}";
|
|
|
|
systemd-nspawn -D "$ARCH_MOUNT_ROOT" systemctl disable set-keymap;
|
|
|
|
rm "$ARCH_MOUNT_ROOT/etc/systemd/system/set-keymap.service";
|
|
|
|
|
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;
|