darwin.linux-builder: Exit scripts on error
For example, if the user decided to ctrl-c upon getting the sudo password prompt, the script previously continued on to start the VM, but that should not be the case.
This commit is contained in:
parent
0ad13a6833
commit
24ae983076
@ -145,6 +145,8 @@ in
|
|||||||
# This installCredentials script is written so that it's as easy as
|
# This installCredentials script is written so that it's as easy as
|
||||||
# possible for a user to audit before confirming the `sudo`
|
# possible for a user to audit before confirming the `sudo`
|
||||||
installCredentials = hostPkgs.writeShellScript "install-credentials" ''
|
installCredentials = hostPkgs.writeShellScript "install-credentials" ''
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
KEYS="''${1}"
|
KEYS="''${1}"
|
||||||
INSTALL=${hostPkgs.coreutils}/bin/install
|
INSTALL=${hostPkgs.coreutils}/bin/install
|
||||||
"''${INSTALL}" -g nixbld -m 600 "''${KEYS}/${user}_${keyType}" ${privateKey}
|
"''${INSTALL}" -g nixbld -m 600 "''${KEYS}/${user}_${keyType}" ${privateKey}
|
||||||
@ -154,6 +156,9 @@ in
|
|||||||
hostPkgs = config.virtualisation.host.pkgs;
|
hostPkgs = config.virtualisation.host.pkgs;
|
||||||
|
|
||||||
script = hostPkgs.writeShellScriptBin "create-builder" (
|
script = hostPkgs.writeShellScriptBin "create-builder" (
|
||||||
|
''
|
||||||
|
set -euo pipefail
|
||||||
|
'' +
|
||||||
# When running as non-interactively as part of a DarwinConfiguration the working directory
|
# When running as non-interactively as part of a DarwinConfiguration the working directory
|
||||||
# must be set to a writeable directory.
|
# must be set to a writeable directory.
|
||||||
(if cfg.workingDirectory != "." then ''
|
(if cfg.workingDirectory != "." then ''
|
||||||
|
Loading…
Reference in New Issue
Block a user