Fix "systemctl reload container@"

Fixes #5179.
This commit is contained in:
Eelco Dolstra 2015-02-27 14:32:22 +01:00
parent 3a31043b43
commit 22d2fc3657
2 changed files with 4 additions and 2 deletions

View File

@ -10,6 +10,7 @@ let
isExecutable = true;
src = ./nixos-container.pl;
perl = "${pkgs.perl}/bin/perl -I${pkgs.perlPackages.FileSlurp}/lib/perl5/site_perl";
su = "${pkgs.shadow.su}/bin/su";
inherit (pkgs) utillinux;
};

View File

@ -8,6 +8,7 @@ use Fcntl ':flock';
use Getopt::Long qw(:config gnu_getopt);
my $nsenter = "@utillinux@/bin/nsenter";
my $su = "@su@";
# Ensure a consistent umask.
umask 0022;
@ -271,14 +272,14 @@ elsif ($action eq "login") {
}
elsif ($action eq "root-login") {
runInContainer("su", "root", "-l");
runInContainer("@su@", "root", "-l");
}
elsif ($action eq "run") {
shift @ARGV; shift @ARGV;
# Escape command.
my $s = join(' ', map { s/'/'\\''/g; "'$_'" } @ARGV);
runInContainer("su", "root", "-l", "-c", "exec " . $s);
runInContainer("@su@", "root", "-l", "-c", "exec " . $s);
}
elsif ($action eq "show-ip") {