From 6a25a35e704689d2bfa6c39032844674e6fdb3fd Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Sun, 5 Aug 2018 19:15:14 -0400 Subject: [PATCH] nixos/activation: Identifies the snippet that failed This allows a developer to better identify in which snippet the failure happened. Furthermore, users seeking help will have more information available about the failure. --- nixos/modules/system/activation/activation-script.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nixos/modules/system/activation/activation-script.nix b/nixos/modules/system/activation/activation-script.nix index c563614caaaf..93a1b13a81dd 100644 --- a/nixos/modules/system/activation/activation-script.nix +++ b/nixos/modules/system/activation/activation-script.nix @@ -8,7 +8,12 @@ let addAttributeName = mapAttrs (a: v: v // { text = '' #### Activation script snippet ${a}: + _localstatus=0 ${v.text} + + if (( _localstatus > 0 )); then + printf "Activation script snippet '%s' failed (%s)\n" "${a}" "$_localstatus" + fi ''; }); @@ -71,7 +76,7 @@ in done _status=0 - trap "_status=1" ERR + trap "_status=1 _localstatus=\$?" ERR # Ensure a consistent umask. umask 0022