Streamline hooks in fish
scripts
This commit is contained in:
parent
db3955a090
commit
e6f7934c7e
4 changed files with 9 additions and 15 deletions
|
@ -81,7 +81,6 @@ begin
|
||||||
and echo (getOSConfig hostname) | arch-chroot "$mountDir" tee /etc/hostname >/dev/null
|
and echo (getOSConfig hostname) | arch-chroot "$mountDir" tee /etc/hostname >/dev/null
|
||||||
|
|
||||||
and arch-chroot "$mountDir" mkinitcpio -P
|
and arch-chroot "$mountDir" mkinitcpio -P
|
||||||
and runHook installDrivers "Installing drivers..." || true
|
|
||||||
and runInOS fish "$tempDir/../Software/GRUB/main.fish"
|
and runInOS fish "$tempDir/../Software/GRUB/main.fish"
|
||||||
|
|
||||||
and if set -l keyLayout (getOSConfig keyboardLayout)
|
and if set -l keyLayout (getOSConfig keyboardLayout)
|
||||||
|
|
|
@ -8,7 +8,7 @@ if [ (id -u) -eq 0 ]
|
||||||
set -l sudoConfig "/etc/sudoers.d/PortValhalla"
|
set -l sudoConfig "/etc/sudoers.d/PortValhalla"
|
||||||
rm ~/.bash_profile
|
rm ~/.bash_profile
|
||||||
|
|
||||||
runHook createUser || begin
|
begin
|
||||||
echo "Creating setup user"
|
echo "Creating setup user"
|
||||||
|
|
||||||
and useradd \
|
and useradd \
|
||||||
|
|
|
@ -22,13 +22,6 @@ function runSetup
|
||||||
end
|
end
|
||||||
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
|
function getCloneFile -S -a path
|
||||||
set -l relativeDir (realpath --relative-to "$projectRoot" "$dir")
|
set -l relativeDir (realpath --relative-to "$projectRoot" "$dir")
|
||||||
set -l relativePath (realpath --relative-to "$dir" "$path")
|
set -l relativePath (realpath --relative-to "$dir" "$path")
|
||||||
|
@ -64,15 +57,15 @@ function runSetup
|
||||||
end
|
end
|
||||||
|
|
||||||
and echo "Installing dependencies..."
|
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 echo "Cloning project..."
|
||||||
and source "$dir/../../copy-repo.fish" "$mountDir$PROJECT_CLONE_ROOT"
|
and source "$dir/../../copy-repo.fish" "$mountDir$PROJECT_CLONE_ROOT"
|
||||||
runChroot "$mountDir" git config --system --add safe.directory "$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 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
|
and begin
|
||||||
set -l script (string escape (getCloneFile (getInstallerScript)))
|
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"
|
if type -q "$name"
|
||||||
|
"$name"
|
||||||
|
or exit 1
|
||||||
|
else if $force
|
||||||
if test -n "$message"
|
if test -n "$message"
|
||||||
echo "$message"
|
echo "$message"
|
||||||
end
|
end
|
||||||
|
|
||||||
"$name"
|
exit 1
|
||||||
or exit
|
|
||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue