2024-07-08 00:47:49 +00:00
|
|
|
#!/bin/env fish
|
|
|
|
begin
|
|
|
|
set -l dir (status dirname)
|
2024-07-16 13:22:15 +00:00
|
|
|
source "$dir/../../Common/OS/setup.fish"
|
2024-07-13 07:52:30 +00:00
|
|
|
source "$dir/../../Common/Scripts/config.fish"
|
2024-07-08 00:47:49 +00:00
|
|
|
|
2024-07-16 20:10:42 +00:00
|
|
|
function runChroot -S
|
|
|
|
arch-chroot $argv
|
|
|
|
end
|
|
|
|
|
2024-09-30 12:56:49 +00:00
|
|
|
function installValhallaDeps -S
|
2024-09-19 19:23:16 +00:00
|
|
|
pacstrap -K "$mountDir" fish git jq nix sudo tmux
|
2024-07-16 20:16:21 +00:00
|
|
|
end
|
|
|
|
|
2024-09-30 12:56:49 +00:00
|
|
|
function installDrivers -S
|
2024-09-22 15:50:05 +00:00
|
|
|
if isOSEnabled hardware.surfaceBook
|
2024-10-06 19:25:34 +00:00
|
|
|
pacstrap -K "$mountDir" linux-firmware-marvell
|
2024-09-21 13:43:52 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2024-09-12 19:44:14 +00:00
|
|
|
function getInstallerScript -V dir -S
|
|
|
|
echo "$dir/install.fish"
|
|
|
|
end
|
|
|
|
|
2024-09-30 12:56:49 +00:00
|
|
|
function setupOS -S -V dir -S
|
2024-07-13 07:52:30 +00:00
|
|
|
source "$dir/../../Common/Scripts/hooks.fish"
|
|
|
|
source "$dir/../../Common/Scripts/wait-network.fish"
|
2024-07-08 16:44:47 +00:00
|
|
|
|
2024-07-13 07:52:30 +00:00
|
|
|
waitNetwork
|
2024-07-09 00:22:12 +00:00
|
|
|
and begin
|
2024-07-13 08:59:09 +00:00
|
|
|
set -l relativeDir (realpath --relative-to "$dir/../../.." "$dir")
|
|
|
|
set -l tempDir "$PROJECT_CLONE_ROOT/$relativeDir"
|
2024-07-13 07:52:30 +00:00
|
|
|
|
2024-09-22 15:50:05 +00:00
|
|
|
if set -l keyMap (getOSConfig keyMap)
|
2024-07-13 07:52:30 +00:00
|
|
|
loadkeys "$keyMap"
|
|
|
|
end
|
|
|
|
|
2024-09-22 15:50:05 +00:00
|
|
|
and if set -l timezone (getOSConfig timeZone)
|
2024-07-13 07:52:30 +00:00
|
|
|
timedatectl set-timezone "$timezone"
|
|
|
|
end
|
|
|
|
|
|
|
|
and pacman-key --init
|
|
|
|
and pacman-key --populate
|
|
|
|
|
|
|
|
and pacstrap -K "$mountDir" \
|
|
|
|
base \
|
|
|
|
linux \
|
|
|
|
linux-firmware \
|
|
|
|
networkmanager \
|
|
|
|
man-db \
|
|
|
|
man-pages \
|
|
|
|
texinfo
|
|
|
|
|
2024-10-06 19:25:34 +00:00
|
|
|
and genfstab -U "$mountDir" >>"$mountDir/etc/fstab"
|
2024-07-13 07:52:30 +00:00
|
|
|
and arch-chroot "$mountDir" systemctl enable NetworkManager
|
|
|
|
|
|
|
|
and if set -q timezone
|
|
|
|
arch-chroot "$mountDir" ln -sf "/usr/share/zoneinfo/$timezone" /etc/localtime
|
|
|
|
end
|
|
|
|
|
|
|
|
and arch-chroot "$mountDir" hwclock --systohc
|
|
|
|
|
|
|
|
and begin
|
2024-09-22 15:50:05 +00:00
|
|
|
getOSConfig i18n.localeSettings --json | \
|
2024-07-13 07:52:30 +00:00
|
|
|
jq --raw-output '[.[] | split(".") | .[0]] | unique | join("\\\\|")'
|
|
|
|
end | begin
|
|
|
|
read LOCALES
|
|
|
|
and arch-chroot "$mountDir" sed -i "s/^#\?\(\($LOCALES\).*\)\$/\1/" /etc/locale.gen
|
2024-07-28 21:45:09 +00:00
|
|
|
and arch-chroot "$mountDir" locale-gen
|
2024-07-13 07:52:30 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
and begin
|
2024-09-22 15:50:05 +00:00
|
|
|
getOSConfig i18n.localeSettings --json | \
|
2024-07-13 07:52:30 +00:00
|
|
|
jq --raw-output '[keys[] as $key | "\($key)=\(.[$key])"] | join("\n")'
|
2024-10-06 19:25:34 +00:00
|
|
|
end | arch-chroot "$mountDir" tee /etc/locale.conf >/dev/null
|
2024-07-13 07:52:30 +00:00
|
|
|
|
|
|
|
and if set -q keyMap
|
2024-10-06 19:25:34 +00:00
|
|
|
echo "KEYMAP=$keyMap" | arch-chroot "$mountDir" tee /etc/vconsole.conf >/dev/null
|
2024-07-13 07:52:30 +00:00
|
|
|
end
|
|
|
|
|
2024-10-06 19:25:34 +00:00
|
|
|
and echo (getOSConfig hostname) | arch-chroot "$mountDir" tee /etc/hostname >/dev/null
|
2024-07-13 07:52:30 +00:00
|
|
|
|
|
|
|
and arch-chroot "$mountDir" mkinitcpio -P
|
2024-10-13 13:35:24 +00:00
|
|
|
and runInOS fish "$tempDir/../Software/grub/main.fish"
|
2024-07-13 07:52:30 +00:00
|
|
|
|
2024-09-22 15:50:05 +00:00
|
|
|
and if set -l keyLayout (getOSConfig keyboardLayout)
|
2024-07-13 07:52:30 +00:00
|
|
|
set -l serviceName set-keymap.service
|
|
|
|
and set -l serviceFile "$mountDir/etc/systemd/system/$serviceName"
|
|
|
|
and cp "$dir/$serviceName" "$serviceFile"
|
|
|
|
and systemd-nspawn -D "$mountDir" systemctl enable "$serviceName"
|
|
|
|
and systemd-nspawn -bD "$mountDir" -E "ARCH_X11_KEYMAP=$keyLayout"
|
|
|
|
and systemd-nspawn -D "$mountDir" systemctl disable "$serviceName"
|
|
|
|
and rm "$serviceFile"
|
|
|
|
end
|
2024-07-09 00:22:12 +00:00
|
|
|
end
|
2024-07-13 07:52:30 +00:00
|
|
|
end
|
2024-07-08 00:47:49 +00:00
|
|
|
|
2024-07-13 07:52:30 +00:00
|
|
|
function autologin -S
|
|
|
|
set -l file "/etc/systemd/system/getty@tty1.service.d/autologin.conf"
|
|
|
|
arch-chroot "$mountDir" mkdir -p (dirname "$file")
|
2024-07-11 20:05:36 +00:00
|
|
|
|
2024-09-12 16:52:03 +00:00
|
|
|
and begin
|
2024-07-13 07:52:30 +00:00
|
|
|
printf %s\n \
|
|
|
|
"[Service]" \
|
|
|
|
"ExecStart=" \
|
|
|
|
"ExecStart=-/sbin/agetty -o '-p -f -- \\u' --noclear --autologin root %I \$TERM"
|
2024-10-06 19:25:34 +00:00
|
|
|
end | arch-chroot "$mountDir" tee "$file" >/dev/null
|
2024-07-08 00:47:49 +00:00
|
|
|
end
|
2024-07-13 07:52:30 +00:00
|
|
|
|
2024-07-13 11:03:56 +00:00
|
|
|
if not type -q getInstallerScript
|
|
|
|
function getInstallerScript -S
|
|
|
|
echo "$dir/install.fish"
|
|
|
|
end
|
2024-07-13 10:36:10 +00:00
|
|
|
end
|
|
|
|
|
2024-07-16 13:22:15 +00:00
|
|
|
runSetup
|
2024-07-08 00:47:49 +00:00
|
|
|
end
|