$data =~ s/=\"err\"/=0/m;
PVE::Tools::file_set_contents($filename, $data);
}
-
- if ($version eq '12.04' || $version eq '14.04') {
- my $ttycount = defined($conf->{tty}) ? $conf->{tty} : 4;
- for (my $i = $ttycount; $i < 7; $i++) {
- unlink "$rootdir/etc/init/tty$i.conf";
- }
- }
}
sub setup_init {
my ($self, $conf) = @_;
my $rootdir = $self->{rootdir};
+ my $version = $self->{version};
- # works out of the box
+ if ($version eq '12.04' || $version eq '14.04') {
+ my $ttycount = defined($conf->{tty}) ? $conf->{tty} : 4;
+ for (my $i = 1; $i < 7; $i++) {
+ my $filename = "$rootdir/etc/init/tty$i.conf";
+ if ($i <= $ttycount) {
+ my $tty_conf = <<__EOD__;
+# tty$i - getty
+#
+# This service maintains a getty on tty$i from the point the system is
+# started until it is shut down again.
+
+start on stopped rc RUNLEVEL=[2345] and (
+ not-container or
+ container CONTAINER=lxc or
+ container CONTAINER=lxc-libvirt)
+
+stop on runlevel [!2345]
+
+respawn
+exec /sbin/getty -8 38400 tty$i
+__EOD__
+ PVE::Tools::file_set_contents($filename, $tty_conf);
+ } else {
+ for (my $i = $ttycount + 1; $i < 7; $i++) {
+ unlink $filename;
+ }
+ }
+ }
+ }
}
1;