use strict;
use warnings;
-use Data::Dumper;
+
use PVE::Tools qw($IPV6RE);
use PVE::LXC;
use PVE::Network;
die "unable to read version info\n" if !defined($version);
- # translate stretch/sid => 9.0 (used on debian testing repository)
- $version = 9.0 if $version eq 'stretch/sid';
+ # translate testing version names
+ $version = 9.1 if $version eq 'stretch/sid';
+ $version = 10 if $version eq 'buster/sid';
die "unable to parse version info '$version'\n"
if $version !~ m/^(\d+(\.\d+)?)(\.\d+)?/;
$version = $1;
die "unsupported debian version '$version'\n"
- if !($version >= 4 && $version <= 9);
+ if !($version >= 4 && $version <= 10);
my $self = { conf => $conf, rootdir => $rootdir, version => $version };
return bless $self, $class;
}
+# Debian doesn't support the /dev/lxc/ subdirectory.
+sub devttydir {
+ return '';
+}
+
sub setup_init {
my ($self, $conf) = @_;
my $systemd = $self->ct_readlink('/sbin/init');
if (defined($systemd) && $systemd =~ m@/systemd$@) {
- $self->setup_container_getty_service(1);
+ $self->setup_container_getty_service($conf);
}
my $filename = "/etc/inittab";
my @lines = grep {
# remove getty lines
- !/^\s*\d+:\d+:[^:]*:.*getty/ &&
+ !/^\s*\d+:\d*:[^:]*:.*getty/ &&
# remove power lines
!/^\s*p[fno0]:/
} split(/\n/, $inittab);
if ($section->{type} eq 'ipv4') {
$done_v4_hash->{$ifname} = 1;
- if (defined($net->{address}) && $net->{address} =~ /^(dhcp|manual)$/) {
- $interfaces .= "iface $ifname inet $1\n";
+ if (!defined($net->{address})) {
+ # no address => no iface line
+ } elsif ($net->{address} =~ /^(dhcp|manual)$/) {
+ $interfaces .= "iface $ifname inet $1\n\n";
} else {
$interfaces .= "iface $ifname inet static\n";
$interfaces .= "\taddress $net->{address}\n" if defined($net->{address});
foreach my $attr (@{$section->{attr}}) {
$interfaces .= "\t$attr\n";
}
+ $interfaces .= "\n";
}
-
- $interfaces .= "\n";
-
} elsif ($section->{type} eq 'ipv6') {
$done_v6_hash->{$ifname} = 1;
- if (defined($net->{address6}) && $net->{address6} =~ /^(auto|dhcp|manual)$/) {
- $interfaces .= "iface $ifname inet6 $1\n";
+ if (!defined($net->{address6})) {
+ # no address => no iface line
+ } elsif ($net->{address6} =~ /^(auto|dhcp|manual)$/) {
+ $interfaces .= "iface $ifname inet6 $1\n\n";
} else {
$interfaces .= "iface $ifname inet6 static\n";
$interfaces .= "\taddress $net->{address6}\n" if defined($net->{address6});
foreach my $attr (@{$section->{attr}}) {
$interfaces .= "\t$attr\n";
}
+ $interfaces .= "\n";
}
-
- $interfaces .= "\n";
} else {
die "unknown section type '$section->{type}'";
}