1
0
Fork 1
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:
Eelco Dolstra 2014-08-15 03:35:55 +02:00
parent 82666653d2
commit e6c00e60c3

View file

@ -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'`;