diff options
author | Joachim F <joachifm@users.noreply.github.com> | 2016-08-05 23:03:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-05 23:03:38 +0200 |
commit | dece583a94e8018c55f3a82824dc1b904b4a535a (patch) | |
tree | 39267ddfa3c0e12daa6a8649de79c4b475447f94 /pkgs/tools/virtualization/nixos-container | |
parent | f4e1041e318ef83ede7b6162b87191f25f01e534 (diff) | |
parent | d6c55c16f6f2305a853c94239bf8b1162fd36556 (diff) |
Merge pull request #17484 from srp/nixos-container-terminate
nixos-container: add 'terminate' command which 'destroy' now uses
Diffstat (limited to 'pkgs/tools/virtualization/nixos-container')
-rwxr-xr-x | pkgs/tools/virtualization/nixos-container/nixos-container.pl | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/pkgs/tools/virtualization/nixos-container/nixos-container.pl b/pkgs/tools/virtualization/nixos-container/nixos-container.pl index ec2e05c387a5..7ad8d34344cc 100755 --- a/pkgs/tools/virtualization/nixos-container/nixos-container.pl +++ b/pkgs/tools/virtualization/nixos-container/nixos-container.pl @@ -23,7 +23,7 @@ Usage: nixos-container list nixos-container destroy <container-name> nixos-container start <container-name> nixos-container stop <container-name> - nixos-container kill <container-name> [--signal <signal-specifier>] + nixos-container terminate <container-name> nixos-container status <container-name> nixos-container update <container-name> [--config <string>] [--config-file <path>] nixos-container login <container-name> @@ -210,12 +210,9 @@ sub isContainerRunning { return $status =~ /ActiveState=active/; } -sub killContainer { - my @args = (); - push(@args, ("--signal", $signal)) if ($signal ne ""); - - system("machinectl", "kill", $containerName, @args) == 0 - or die "$0: failed to kill container\n"; +sub terminateContainer { + system("machinectl", "terminate", $containerName) == 0 + or die "$0: failed to terminate container\n"; } sub stopContainer { @@ -260,8 +257,7 @@ if ($action eq "destroy") { die "$0: cannot destroy declarative container (remove it from your configuration.nix instead)\n" unless POSIX::access($confFile, &POSIX::W_OK); - $signal = "SIGKILL"; - killContainer if (isContainerRunning); + terminateContainer if (isContainerRunning); safeRemoveTree($profileDir) if -e $profileDir; safeRemoveTree($gcRootsDir) if -e $gcRootsDir; @@ -278,8 +274,8 @@ elsif ($action eq "stop") { stopContainer; } -elsif ($action eq "kill") { - killContainer; +elsif ($action eq "terminate") { + terminateContainer; } elsif ($action eq "status") { |