forked from mirrors/nixpkgs
Merge pull request #67332 from uvNikita/nixos-container/run
nixos-container: use systemd-run instead of nsenter
This commit is contained in:
commit
a0a3f5c86c
|
@ -9,7 +9,6 @@ use Getopt::Long qw(:config gnu_getopt);
|
|||
use Cwd 'abs_path';
|
||||
use Time::HiRes;
|
||||
|
||||
my $nsenter = "@utillinux@/bin/nsenter";
|
||||
my $su = "@su@";
|
||||
|
||||
# Ensure a consistent umask.
|
||||
|
@ -270,9 +269,10 @@ sub restartContainer {
|
|||
# Run a command in the container.
|
||||
sub runInContainer {
|
||||
my @args = @_;
|
||||
my $leader = getLeader;
|
||||
exec($nsenter, "-t", $leader, "-m", "-u", "-i", "-n", "-p", "--", @args);
|
||||
die "cannot run ‘nsenter’: $!\n";
|
||||
|
||||
exec("systemd-run", "--machine", $containerName, "--pty", "--quiet", "--", @args);
|
||||
|
||||
die "cannot run ‘systemd-run’: $!\n";
|
||||
}
|
||||
|
||||
# Remove a directory while recursively unmounting all mounted filesystems within
|
||||
|
|
Loading…
Reference in a new issue