2024-07-13 07:52:30 +00:00
|
|
|
#!/bin/env fish
|
|
|
|
begin
|
|
|
|
set -l dir (status dirname)
|
|
|
|
source "$dir/../Scripts/config.fish"
|
|
|
|
source "$dir/../Scripts/hooks.fish"
|
|
|
|
set -l name (getConfig valhalla.setupUser.name)
|
|
|
|
set -l mountDir (getConfig valhalla.partition.rootDir)
|
2024-07-13 08:59:09 +00:00
|
|
|
set -l projectRoot (realpath "$dir/../../..")
|
|
|
|
set -l projectName (basename "$projectRoot")
|
|
|
|
set -l PROJECT_CLONE_ROOT "/opt/$(basename "$projectName")"
|
2024-07-13 09:23:14 +00:00
|
|
|
set -l script (mktemp)
|
2024-07-13 08:59:09 +00:00
|
|
|
|
2024-07-13 10:36:10 +00:00
|
|
|
function getCloneFile -S -a path
|
|
|
|
set -l relativeDir (realpath --relative-to "$projectRoot" "$dir")
|
|
|
|
set -l relativePath (realpath --relative-to "$dir" "$path")
|
|
|
|
echo "$PROJECT_CLONE_ROOT/$relativeDir/$relativePath"
|
|
|
|
end
|
|
|
|
|
2024-07-13 09:23:14 +00:00
|
|
|
getConfig valhalla.partition.script > "$script"
|
|
|
|
bash "$script"
|
2024-07-13 08:59:09 +00:00
|
|
|
and source "$dir/../../copy-repo.fish" "$mountDir$PROJECT_CLONE_ROOT"
|
|
|
|
and runHook setupOS || true
|
2024-07-13 07:52:30 +00:00
|
|
|
and runHook autologin || true
|
2024-07-13 10:36:10 +00:00
|
|
|
|
|
|
|
and begin
|
2024-07-13 11:23:16 +00:00
|
|
|
set -l script (string escape (getCloneFile (getInstallerScript)))
|
2024-07-13 10:36:10 +00:00
|
|
|
printf %s\n \
|
|
|
|
"export CONFIG_MODULE=$(string escape (getCloneFile "$CONFIG_MODULE"))" \
|
2024-07-13 11:23:16 +00:00
|
|
|
"export INSTALLER_SCRIPT=$script" \
|
|
|
|
"$script"
|
2024-07-13 10:36:10 +00:00
|
|
|
end | chroot "$mountDir" tee /root/.bash_profile > /dev/null
|
|
|
|
|
2024-07-13 07:52:30 +00:00
|
|
|
and echo "Setup finished!"
|
|
|
|
and echo "Please reboot your machine"
|
|
|
|
end
|