summaryrefslogtreecommitdiff
path: root/modules/system
diff options
context:
space:
mode:
authorMichael Hoang <enzime@users.noreply.github.com>2023-06-24 13:58:56 +1000
committerMichael Hoang <enzime@users.noreply.github.com>2023-07-11 18:59:05 +1000
commitcad8954f75809eda533cfb01dc92de8d32f5332d (patch)
tree51c321213f01db650e7f1b2e37af67e04af0ed19 /modules/system
parent4b90ea84e4e90aab2bcaec117ceddf83e02d6adf (diff)
etc: fail if we can't add a file
Fixes #598
Diffstat (limited to 'modules/system')
-rw-r--r--modules/system/etc.nix6
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/system/etc.nix b/modules/system/etc.nix
index b6c5827..d26c45e 100644
--- a/modules/system/etc.nix
+++ b/modules/system/etc.nix
@@ -51,6 +51,7 @@ in
ln -sfn "$(readlink -f $systemConfig/etc)" /etc/static
+ errorOccurred=false
for f in $(find /etc/static/* -type l); do
l=/etc/''${f#/etc/static/}
d=''${l%/*}
@@ -79,6 +80,7 @@ in
if [ -z "$h" ]; then
echo "error: not linking environment.etc.\"''${l#/etc/}\" because $l already exists, skipping..." >&2
echo "existing file has unknown content $o, move and activate again to apply" >&2
+ errorOccurred=true
fi
fi
fi
@@ -87,6 +89,10 @@ in
fi
done
+ if [ "$errorOccurred" != "false" ]; then
+ exit 1
+ fi
+
for l in $(find /etc/* -type l 2> /dev/null); do
f="$(echo $l | sed 's,/etc/,/etc/static/,')"
f=/etc/static/''${l#/etc/}