switch-to-configuration: use absolute path to systemd-escape

Fixes issue when upgrading from very old NixOS systems that don't have
systemd-escape in $PATH:

  $ sudo nixos-rebuild switch
  ...
  building the system configuration...
  updating GRUB 2 menu...
  Can't exec "systemd-escape": No such file or directory at /nix/var/nix/profiles/system/bin/switch-to-configuration line 264.
  Unable to escape /!
This commit is contained in:
Bjørn Forsman 2016-07-01 08:28:04 +02:00
parent 17e8032adb
commit 9050077cff
1 changed files with 1 additions and 1 deletions

View File

@ -261,7 +261,7 @@ while (my ($unit, $state) = each %{$activePrev}) {
sub pathToUnitName {
my ($path) = @_;
open my $cmd, "-|", "systemd-escape", "--suffix=mount", "-p", $path
open my $cmd, "-|", "@systemd@/bin/systemd-escape", "--suffix=mount", "-p", $path
or die "Unable to escape $path!\n";
my $escaped = join "", <$cmd>;
chomp $escaped;