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.
This commit is contained in:
parent
1073633d89
commit
9bdd2f852c
5
nixos/modules/system/activation/switch-to-configuration.pl
Normal file → Executable file
5
nixos/modules/system/activation/switch-to-configuration.pl
Normal file → Executable file
|
@ -67,7 +67,10 @@ openlog("nixos", "", LOG_USER);
|
||||||
|
|
||||||
# Install or update the bootloader.
|
# Install or update the bootloader.
|
||||||
if ($action eq "switch" || $action eq "boot") {
|
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.
|
# Just in case the new configuration hangs the system, do a sync now.
|
||||||
|
|
Loading…
Reference in a new issue