about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-08-15 01:57:36 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-08-15 02:14:34 +0200
commit785ed2b528322676a256fc14a2201773626f46bb (patch)
tree43fc06481eb73940f901153574d4ac8106dc8fda /nixos
parent883fa4f9205b2aa699760a73e1f1a26bb4f5296e (diff)
downloadnixlib-785ed2b528322676a256fc14a2201773626f46bb.tar
nixlib-785ed2b528322676a256fc14a2201773626f46bb.tar.gz
nixlib-785ed2b528322676a256fc14a2201773626f46bb.tar.bz2
nixlib-785ed2b528322676a256fc14a2201773626f46bb.tar.lz
nixlib-785ed2b528322676a256fc14a2201773626f46bb.tar.xz
nixlib-785ed2b528322676a256fc14a2201773626f46bb.tar.zst
nixlib-785ed2b528322676a256fc14a2201773626f46bb.zip
Don't silently ignore errors from the activation script
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/installer/tools/nixos-rebuild.sh5
-rw-r--r--nixos/modules/security/setuid-wrappers.nix3
-rw-r--r--nixos/modules/system/activation/activation-script.nix5
3 files changed, 10 insertions, 3 deletions
diff --git a/nixos/modules/installer/tools/nixos-rebuild.sh b/nixos/modules/installer/tools/nixos-rebuild.sh
index be37e61151aa..52b64c37578e 100644
--- a/nixos/modules/installer/tools/nixos-rebuild.sh
+++ b/nixos/modules/installer/tools/nixos-rebuild.sh
@@ -225,7 +225,10 @@ fi
 # If we're not just building, then make the new configuration the boot
 # default and/or activate it now.
 if [ "$action" = switch -o "$action" = boot -o "$action" = test ]; then
-    $pathToConfig/bin/switch-to-configuration "$action"
+    if ! $pathToConfig/bin/switch-to-configuration "$action"; then
+        echo "warning: there were error switching to the new configuration" >&2
+        exit 1
+    fi
 fi
 
 
diff --git a/nixos/modules/security/setuid-wrappers.nix b/nixos/modules/security/setuid-wrappers.nix
index 4cdc1023baab..373afffd3fb5 100644
--- a/nixos/modules/security/setuid-wrappers.nix
+++ b/nixos/modules/security/setuid-wrappers.nix
@@ -97,8 +97,7 @@ in
           }:
 
           ''
-            source=${if source != "" then source else "$(PATH=$SETUID_PATH type -tP ${program})"}
-            if test -z "$source"; then
+            if ! source=${if source != "" then source else "$(PATH=$SETUID_PATH type -tP ${program})"}; then
                 # If we can't find the program, fall back to the
                 # system profile.
                 source=/nix/var/nix/profiles/default/bin/${program}
diff --git a/nixos/modules/system/activation/activation-script.nix b/nixos/modules/system/activation/activation-script.nix
index b1bad956b4bb..2e5a70b3aa54 100644
--- a/nixos/modules/system/activation/activation-script.nix
+++ b/nixos/modules/system/activation/activation-script.nix
@@ -66,6 +66,9 @@ in
                 PATH=$PATH:$i/bin:$i/sbin
             done
 
+            _status=0
+            trap "_status=1" ERR
+
             # Ensure a consistent umask.
             umask 0022
 
@@ -84,6 +87,8 @@ in
 
             # Prevent the current configuration from being garbage-collected.
             ln -sfn /run/current-system /nix/var/nix/gcroots/current-system
+
+            exit $_status
           '';
       };