Streamline hooks in fish
scripts
This commit is contained in:
parent
db3955a090
commit
e6f7934c7e
|
@ -81,7 +81,6 @@ begin
|
|||
and echo (getOSConfig hostname) | arch-chroot "$mountDir" tee /etc/hostname >/dev/null
|
||||
|
||||
and arch-chroot "$mountDir" mkinitcpio -P
|
||||
and runHook installDrivers "Installing drivers..." || true
|
||||
and runInOS fish "$tempDir/../Software/GRUB/main.fish"
|
||||
|
||||
and if set -l keyLayout (getOSConfig keyboardLayout)
|
||||
|
|
|
@ -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 \
|
||||
|
|
|
@ -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)))
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
function runHook -S -a name message
|
||||
function runHook -S -a name force message
|
||||
if type -q "$name"
|
||||
"$name"
|
||||
or exit 1
|
||||
else if $force
|
||||
if test -n "$message"
|
||||
echo "$message"
|
||||
end
|
||||
|
||||
"$name"
|
||||
or exit
|
||||
exit 1
|
||||
else
|
||||
return 1
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue