From 0483a25a9411fb25a11dec3ab0574a1827ee6acc Mon Sep 17 00:00:00 2001 From: tdback Date: Wed, 25 Dec 2024 11:26:35 -0500 Subject: add checks for unset variables and quit on errors --- modules/scripts/zquota/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/scripts/zquota/default.nix b/modules/scripts/zquota/default.nix index 449bf76..cfa08ee 100644 --- a/modules/scripts/zquota/default.nix +++ b/modules/scripts/zquota/default.nix @@ -7,6 +7,8 @@ let pkgs.writeShellScriptBin "zquota" '' #!/usr/bin/env bash + set -eu + if [ "$#" -ne 2 ]; then echo "failed to provide both a dataset and quota" >&2 exit 1 @@ -60,7 +62,7 @@ in environment.systemPackages = [ zquota ]; systemd.services."zquota" = { - description = "Perform and report routine quota checks on ZFS datasets"; + description = "Perform and report scheduled quota checks on ZFS datasets."; serviceConfig.Type = "oneshot"; script = strings.concatStringsSep "\n" <| mapAttrsToList ( dataset: quota: "/run/current-system/sw/bin/zquota ${dataset} ${builtins.toString quota}" -- cgit v1.2.3