mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 15:11:35 +00:00
nixos-container destroy: Make idempotent
This commit is contained in:
parent
82666653d2
commit
e6c00e60c3
|
@ -154,7 +154,10 @@ my $root = "/var/lib/containers/$containerName";
|
|||
my $profileDir = "/nix/var/nix/profiles/per-container/$containerName";
|
||||
my $gcRootsDir = "/nix/var/nix/gcroots/per-container/$containerName";
|
||||
my $confFile = "/etc/containers/$containerName.conf";
|
||||
die "$0: container ‘$containerName’ does not exist\n" if !-e $confFile;
|
||||
if (!-e $confFile) {
|
||||
exit 0 if $action eq "destroy";
|
||||
die "$0: container ‘$containerName’ does not exist\n" ;
|
||||
}
|
||||
|
||||
sub isContainerRunning {
|
||||
my $status = `systemctl show 'container\@$containerName'`;
|
||||
|
|
Loading…
Reference in a new issue