nixos-container: Allow auto-starting containers
This commit is contained in:
parent
2337a85fc3
commit
b10a3e9145
@ -17,7 +17,7 @@ umask 0022;
|
|||||||
sub showHelp {
|
sub showHelp {
|
||||||
print <<EOF;
|
print <<EOF;
|
||||||
Usage: nixos-container list
|
Usage: nixos-container list
|
||||||
nixos-container create <container-name> [--config <string>] [--ensure-unique-name]
|
nixos-container create <container-name> [--config <string>] [--ensure-unique-name] [--auto-start]
|
||||||
nixos-container destroy <container-name>
|
nixos-container destroy <container-name>
|
||||||
nixos-container start <container-name>
|
nixos-container start <container-name>
|
||||||
nixos-container stop <container-name>
|
nixos-container stop <container-name>
|
||||||
@ -32,11 +32,13 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
my $ensureUniqueName = 0;
|
my $ensureUniqueName = 0;
|
||||||
|
my $autoStart = 0;
|
||||||
my $extraConfig;
|
my $extraConfig;
|
||||||
|
|
||||||
GetOptions(
|
GetOptions(
|
||||||
"help" => sub { showHelp() },
|
"help" => sub { showHelp() },
|
||||||
"ensure-unique-name" => \$ensureUniqueName,
|
"ensure-unique-name" => \$ensureUniqueName,
|
||||||
|
"auto-start" => \$autoStart,
|
||||||
"config=s" => \$extraConfig
|
"config=s" => \$extraConfig
|
||||||
) or exit 1;
|
) or exit 1;
|
||||||
|
|
||||||
@ -123,6 +125,7 @@ if ($action eq "create") {
|
|||||||
push @conf, "PRIVATE_NETWORK=1\n";
|
push @conf, "PRIVATE_NETWORK=1\n";
|
||||||
push @conf, "HOST_ADDRESS=$hostAddress\n";
|
push @conf, "HOST_ADDRESS=$hostAddress\n";
|
||||||
push @conf, "LOCAL_ADDRESS=$localAddress\n";
|
push @conf, "LOCAL_ADDRESS=$localAddress\n";
|
||||||
|
push @conf, "AUTO_START=$autoStart\n";
|
||||||
write_file($confFile, \@conf);
|
write_file($confFile, \@conf);
|
||||||
|
|
||||||
close($lock);
|
close($lock);
|
||||||
|
Loading…
Reference in New Issue
Block a user