diff options
author | Naïm Favier <n@monade.li> | 2022-03-14 02:11:10 +0100 |
---|---|---|
committer | Naïm Favier <n@monade.li> | 2022-03-14 02:12:52 +0100 |
commit | 9bdd2f852cdcaadd65ba38876c3379e10a967290 (patch) | |
tree | 524e7186bf2111f5fd58f3697178d1556df8cce4 /nixos | |
parent | 1073633d8914364109bf453af7bed0aa06e5f5bf (diff) | |
download | nixpkgs-9bdd2f852cdcaadd65ba38876c3379e10a967290.tar nixpkgs-9bdd2f852cdcaadd65ba38876c3379e10a967290.tar.gz nixpkgs-9bdd2f852cdcaadd65ba38876c3379e10a967290.tar.bz2 nixpkgs-9bdd2f852cdcaadd65ba38876c3379e10a967290.tar.lz nixpkgs-9bdd2f852cdcaadd65ba38876c3379e10a967290.tar.xz nixpkgs-9bdd2f852cdcaadd65ba38876c3379e10a967290.tar.zst nixpkgs-9bdd2f852cdcaadd65ba38876c3379e10a967290.zip |
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')
-rwxr-xr-x[-rw-r--r--] | nixos/modules/system/activation/switch-to-configuration.pl | 5 |
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 07ee281feec..459d09faa53 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. |