summaryrefslogtreecommitdiffstats
path: root/nixos/modules
diff options
context:
space:
mode:
authorNaïm Favier <n@monade.li>2022-03-14 02:11:10 +0100
committerNaïm Favier <n@monade.li>2022-03-14 02:12:52 +0100
commit9bdd2f852cdcaadd65ba38876c3379e10a967290 (patch)
tree524e7186bf2111f5fd58f3697178d1556df8cce4 /nixos/modules
parent1073633d8914364109bf453af7bed0aa06e5f5bf (diff)
nixos/switch-to-configuration: fix installBootLoader escaping
Use a quoted heredoc to inject installBootLoader safely into the script, and restore the previous invocation of `system` with a single argument so that shell commands keep working.
Diffstat (limited to 'nixos/modules')
-rwxr-xr-x[-rw-r--r--]nixos/modules/system/activation/switch-to-configuration.pl5
1 files changed, 4 insertions, 1 deletions
diff --git a/nixos/modules/system/activation/switch-to-configuration.pl b/nixos/modules/system/activation/switch-to-configuration.pl
index 07ee281feec1..459d09faa53b 100644..100755
--- a/nixos/modules/system/activation/switch-to-configuration.pl
+++ b/nixos/modules/system/activation/switch-to-configuration.pl
@@ -67,7 +67,10 @@ openlog("nixos", "", LOG_USER);
# Install or update the bootloader.
if ($action eq "switch" || $action eq "boot") {
- system('@installBootLoader@', $out) == 0 or exit 1;
+ chomp(my $installBootLoader = <<'EOFBOOTLOADER');
+@installBootLoader@
+EOFBOOTLOADER
+ system("$installBootLoader $out") == 0 or exit 1;
}
# Just in case the new configuration hangs the system, do a sync now.