]>
git.proxmox.com Git - pve-container.git/blob - src/PVE/LXC/Setup/Ubuntu.pm
28eb1182fe9f48fea5194d3c18a2c7b5ba0906ae
1 package PVE
::LXC
::Setup
::Ubuntu
;
10 use PVE
::LXC
::Setup
::Debian
;
12 use base
qw(PVE::LXC::Setup::Debian);
14 my $known_versions = {
15 '16.10' => 1, # yakkety
16 '16.04' => 1, # xenial
19 '14.04' => 1, # trusty LTS
20 '12.04' => 1, # precise LTS
24 my ($class, $conf, $rootdir) = @_;
26 my $lsb_fn = "$rootdir/etc/lsb-release";
27 my $lsbinfo = PVE
::Tools
::file_get_contents
($lsb_fn);
29 die "got unknown DISTRIB_ID\n" if $lsbinfo !~ m/^DISTRIB_ID=Ubuntu$/mi;
32 if ($lsbinfo =~ m/^DISTRIB_RELEASE=(\d+\.\d+)$/mi) {
36 die "unable to read version info\n" if !defined($version);
38 die "unsupported Ubuntu version '$version'\n"
39 if !$known_versions->{$version};
41 my $self = { conf
=> $conf, rootdir
=> $rootdir, version
=> $version };
43 $conf->{ostype
} = "ubuntu";
45 return bless $self, $class;
49 my ($self, $conf) = @_;
51 my $version = $self->{version
};
53 if ($version eq '15.04' || $version eq '15.10' || $version eq '16.04') {
54 # edit /etc/securetty (enable login on console)
55 $self->setup_securetty($conf, qw(pts/0));
58 if ($version eq '12.04') {
59 # suppress log level output for udev
60 my $filename = '/etc/udev/udev.conf';
61 my $data = $self->ct_file_get_contents($filename);
62 $data =~ s/=\"err\"/=0/m;
63 $self->ct_file_set_contents($filename, $data);
68 my ($self, $conf) = @_;
70 my $version = $self->{version
};
72 if ($version eq '16.10') {
73 $self->setup_container_getty_service($conf);
76 if ($version eq '12.04' || $version eq '14.04') {
77 my $ttycount = PVE
::LXC
::Config-
>get_tty_count($conf);
78 for (my $i = 1; $i < 7; $i++) {
79 my $filename = "/etc/init/tty$i.conf";
80 if ($i <= $ttycount) {
81 my $tty_conf = <<__EOD__;
84 # This service maintains a getty on tty$i from the point the system is
85 # started until it is shut down again.
87 start on stopped rc RUNLEVEL=[2345] and (
89 container CONTAINER=lxc or
90 container CONTAINER=lxc-libvirt)
92 stop on runlevel [!2345]
95 exec /sbin/getty -8 38400 tty$i
97 $self->ct_file_set_contents($filename, $tty_conf);
99 for (my $i = $ttycount + 1; $i < 7; $i++) {
100 $self->ct_unlink($filename);