diff options
| author | Michael Hoang <enzime@users.noreply.github.com> | 2023-06-24 13:58:56 +1000 |
|---|---|---|
| committer | Michael Hoang <enzime@users.noreply.github.com> | 2023-07-11 18:59:05 +1000 |
| commit | cad8954f75809eda533cfb01dc92de8d32f5332d (patch) | |
| tree | 51c321213f01db650e7f1b2e37af67e04af0ed19 /modules/system | |
| parent | 4b90ea84e4e90aab2bcaec117ceddf83e02d6adf (diff) | |
etc: fail if we can't add a file
Fixes #598
Diffstat (limited to 'modules/system')
| -rw-r--r-- | modules/system/etc.nix | 6 |
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 "[1;31merror: not linking environment.etc.\"''${l#/etc/}\" because $l already exists, skipping...[0m" >&2 echo "[1;31mexisting file has unknown content $o, move and activate again to apply[0m" >&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/} |
