Simplify the creation of hooks

This commit is contained in:
Manuel Thalmann 2024-07-09 03:57:03 +02:00
parent 2de0d9a565
commit d4fa8f2ebd
2 changed files with 14 additions and 6 deletions

View file

@ -2,6 +2,7 @@
begin
set -l dir (status dirname)
. "$dir/../../Common/Scripts/config.fish"
. "$dir/../../Common/Scripts/hooks.fish"
set -q CONFIG_MODULE || set -l CONFIG_MODULE "$dir/config.nix"
set -q ARCH_TIMEZONE || set -l ARCH_TIMEZONE "Europe/Zurich"
@ -37,12 +38,7 @@ begin
man-pages \
texinfo
and if type -q installDrivers
echo "Installing drivers…"
installDrivers
else
true
end
and runHook installDrivers "Installing drivers…" || true
and "$dir/../../copy-repo.fish" "$ARCH_MOUNT_ROOT$tempRoot"
and genfstab -U "$ARCH_MOUNT_ROOT" >> "$ARCH_MOUNT_ROOT/etc/fstab"

View file

@ -0,0 +1,12 @@
function runHook -S -a name message
if type -q "$name"
if test -n "$message"
echo "$message"
end
"$name"
or exit
else
return 1
end
end