Streamline hooks in fish scripts

This commit is contained in:
Manuel Thalmann 2024-10-12 17:19:59 +02:00
parent db3955a090
commit e6f7934c7e
4 changed files with 9 additions and 15 deletions
scripts/Common/OS

View file

@ -8,7 +8,7 @@ if [ (id -u) -eq 0 ]
set -l sudoConfig "/etc/sudoers.d/PortValhalla"
rm ~/.bash_profile
runHook createUser || begin
begin
echo "Creating setup user"
and useradd \

View file

@ -22,13 +22,6 @@ function runSetup
end
end
if not type -q installValhallaDeps
function installValhallaDeps
echo 'Please set up the hook `installValhallaDeps` for installing `fish`, `git`, `jq`, `nix`, `sudo` and `tmux`.'
exit 1
end
end
function getCloneFile -S -a path
set -l relativeDir (realpath --relative-to "$projectRoot" "$dir")
set -l relativePath (realpath --relative-to "$dir" "$path")
@ -64,15 +57,15 @@ function runSetup
end
and echo "Installing dependencies..."
and runHook installValhallaDeps
and runHook installValhallaDeps true 'Please set up a function `installValhallaDeps` for installing `fish`, `git`, `jq`, `nix`, `sudo` and `tmux`.'
and echo "Cloning project..."
and source "$dir/../../copy-repo.fish" "$mountDir$PROJECT_CLONE_ROOT"
runChroot "$mountDir" git config --system --add safe.directory "$PROJECT_CLONE_ROOT"
and runHook setupOS || true
and runHook setupOS
and echo "Preparing auto-login..."
and runHook autologin || true
and runHook autologin true "Please set up a function `autologin` for setting up autologin for the `root` user"
and begin
set -l script (string escape (getCloneFile (getInstallerScript)))