diff --git a/scripts/Arch/OS/setup.fish b/scripts/Arch/OS/setup.fish index 0438ed54..1bb1be24 100644 --- a/scripts/Arch/OS/setup.fish +++ b/scripts/Arch/OS/setup.fish @@ -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" diff --git a/scripts/Common/Scripts/hooks.fish b/scripts/Common/Scripts/hooks.fish new file mode 100644 index 00000000..beef08dc --- /dev/null +++ b/scripts/Common/Scripts/hooks.fish @@ -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