parent
3a31043b43
commit
22d2fc3657
@ -10,6 +10,7 @@ let
|
|||||||
isExecutable = true;
|
isExecutable = true;
|
||||||
src = ./nixos-container.pl;
|
src = ./nixos-container.pl;
|
||||||
perl = "${pkgs.perl}/bin/perl -I${pkgs.perlPackages.FileSlurp}/lib/perl5/site_perl";
|
perl = "${pkgs.perl}/bin/perl -I${pkgs.perlPackages.FileSlurp}/lib/perl5/site_perl";
|
||||||
|
su = "${pkgs.shadow.su}/bin/su";
|
||||||
inherit (pkgs) utillinux;
|
inherit (pkgs) utillinux;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ use Fcntl ':flock';
|
|||||||
use Getopt::Long qw(:config gnu_getopt);
|
use Getopt::Long qw(:config gnu_getopt);
|
||||||
|
|
||||||
my $nsenter = "@utillinux@/bin/nsenter";
|
my $nsenter = "@utillinux@/bin/nsenter";
|
||||||
|
my $su = "@su@";
|
||||||
|
|
||||||
# Ensure a consistent umask.
|
# Ensure a consistent umask.
|
||||||
umask 0022;
|
umask 0022;
|
||||||
@ -271,14 +272,14 @@ elsif ($action eq "login") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
elsif ($action eq "root-login") {
|
elsif ($action eq "root-login") {
|
||||||
runInContainer("su", "root", "-l");
|
runInContainer("@su@", "root", "-l");
|
||||||
}
|
}
|
||||||
|
|
||||||
elsif ($action eq "run") {
|
elsif ($action eq "run") {
|
||||||
shift @ARGV; shift @ARGV;
|
shift @ARGV; shift @ARGV;
|
||||||
# Escape command.
|
# Escape command.
|
||||||
my $s = join(' ', map { s/'/'\\''/g; "'$_'" } @ARGV);
|
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") {
|
elsif ($action eq "show-ip") {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user