From 9bdd2f852cdcaadd65ba38876c3379e10a967290 Mon Sep 17 00:00:00 2001 From: Naïm Favier Date: Mon, 14 Mar 2022 02:11:10 +0100 Subject: 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. --- nixos/modules/system/activation/switch-to-configuration.pl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) mode change 100644 => 100755 nixos/modules/system/activation/switch-to-configuration.pl diff --git a/nixos/modules/system/activation/switch-to-configuration.pl b/nixos/modules/system/activation/switch-to-configuration.pl old mode 100644 new mode 100755 index 07ee281feec..459d09faa53 --- 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. -- cgit 1.4.1