83 lines
2.8 KiB
Bash
Executable file
83 lines
2.8 KiB
Bash
Executable file
#!/bin/bash -e
|
|
PARTITION_MODULE="${PARTITION_MODULE:+"$(realpath "$PARTITION_MODULE")"}";
|
|
pushd "${BASH_SOURCE%/*}" > /dev/null;
|
|
|
|
PARTITION_MODULE="${PARTITION_MODULE:-"./partition.nix"}";
|
|
ARCH_TIMEZONE="${ARCH_TIMEZONE:-"Europe/Zurich"}";
|
|
ARCH_HOSTNAME="${ARCH_HOSTNAME}";
|
|
ARCH_MOUNT_ROOT="${ARCH_MOUNT_ROOT:-"$(../../eval-module.sh "$PARTITION_MODULE" partition.rootDir --raw)"}";
|
|
ARCH_LANG="${ARCH_LANG:-"en_US.UTF-8"}";
|
|
ARCH_KEYMAP="${ARCH_KEYMAP:-"de_CH-latin1"}";
|
|
ARCH_X11_KEYMAP="${ARCH_X11_KEYMAP:-"ch"}";
|
|
LOCALE_PATTERN="${LOCALE_PATTERN:-\(de_CH\|en_US\)}";
|
|
|
|
USER_NAME="${USER_NAME:-"manuel"}";
|
|
USER_DISPLAYNAME="${USER_DISPLAYNAME}";
|
|
USER_GROUPS="${USER_GROUPS}";
|
|
|
|
projectRoot="$(realpath ../../..)";
|
|
projectName="$(basename "$projectRoot")";
|
|
relativeDir="$(realpath --relative-to "$projectRoot" "$(pwd)")";
|
|
tempRoot="/root/$(basename "$projectName")";
|
|
tempDir="$tempRoot/$relativeDir";
|
|
|
|
loadkeys "$ARCH_KEYMAP";
|
|
timedatectl set-timezone "$ARCH_TIMEZONE";
|
|
|
|
. "../../Common/OS/partition.sh";
|
|
|
|
pacman-key --init;
|
|
pacman-key --populate;
|
|
|
|
pacstrap -K "$ARCH_MOUNT_ROOT" \
|
|
base \
|
|
linux \
|
|
linux-firmware \
|
|
networkmanager \
|
|
man-db \
|
|
man-pages \
|
|
texinfo \
|
|
;
|
|
|
|
cp -r "$projectRoot" "${ARCH_MOUNT_ROOT}$tempRoot";
|
|
genfstab -U "$ARCH_MOUNT_ROOT" >> "$ARCH_MOUNT_ROOT/etc/fstab";
|
|
|
|
arch-chroot "$ARCH_MOUNT_ROOT" systemctl enable NetworkManager;
|
|
|
|
arch-chroot "$ARCH_MOUNT_ROOT" ln -sf /usr/share/zoneinfo/Europe/Zurich /etc/localtime;
|
|
arch-chroot "$ARCH_MOUNT_ROOT" hwclock --systohc;
|
|
|
|
arch-chroot "$ARCH_MOUNT_ROOT" sed -i "s/^#\?\($LOCALE_PATTERN.*\)$/\1/" /etc/locale.gen;
|
|
arch-chroot "$ARCH_MOUNT_ROOT" locale-gen;
|
|
|
|
{
|
|
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;
|
|
|
|
echo "KEYMAP=$ARCH_KEYMAP" | arch-chroot "$ARCH_MOUNT_ROOT" tee /etc/vconsole.conf > /dev/null;
|
|
|
|
echo "$ARCH_HOSTNAME" | arch-chroot "$ARCH_MOUNT_ROOT" tee /etc/hostname;
|
|
arch-chroot "$ARCH_MOUNT_ROOT" mkinitcpio -P;
|
|
|
|
arch-chroot "$ARCH_MOUNT_ROOT" pacman -Syu;
|
|
arch-chroot "$ARCH_MOUNT_ROOT" bash "$tempDir/../Software/GRUB/install.sh";
|
|
arch-chroot "$ARCH_MOUNT_ROOT" bash "$tempDir/../Software/sudo/install.sh";
|
|
pacstrap -K "$ARCH_MOUNT_ROOT" git;
|
|
|
|
|
|
USER_NAME="${USER_NAME}" \
|
|
USER_DISPLAYNAME="${USER_DISPLAYNAME}" \
|
|
USER_GROUPS="${USER_GROUPS}" \
|
|
arch-chroot "$ARCH_MOUNT_ROOT" bash "$tempDir/user.sh";
|
|
|
|
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";
|
|
|
|
arch-chroot "$ARCH_MOUNT_ROOT" rm -rf "$tempRoot";
|
|
|
|
popd > /dev/null;
|