Simplify the creation of hooks

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

View file

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