[pve-devel] [PATCH container 1/2] setup: move setup_container_getty_service to Base
Wolfgang Bumiller
w.bumiller at proxmox.com
Mon Feb 15 10:57:08 CET 2016
And reuse it for ArchLinux.
---
src/PVE/LXC/Setup/ArchLinux.pm | 5 +++--
src/PVE/LXC/Setup/Base.pm | 9 +++++++++
src/PVE/LXC/Setup/SUSE.pm | 9 ---------
3 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/src/PVE/LXC/Setup/ArchLinux.pm b/src/PVE/LXC/Setup/ArchLinux.pm
index 352d21a..1e60fa6 100644
--- a/src/PVE/LXC/Setup/ArchLinux.pm
+++ b/src/PVE/LXC/Setup/ArchLinux.pm
@@ -39,11 +39,12 @@ sub template_fixup {
'/etc/systemd/system/socket.target.wants/systemd-networkd.socket');
# edit /etc/securetty (enable login on console)
- $self->setup_securetty($conf, qw(pts/0));
+ $self->setup_securetty($conf, qw(lxc/console lxc/tty1 lxc/tty2 lxc/tty3 lxc/tty4));
}
sub setup_init {
- # Nothing to do
+ my ($self, $conf) = @_;
+ $self->setup_container_getty_service();
}
sub setup_network {
diff --git a/src/PVE/LXC/Setup/Base.pm b/src/PVE/LXC/Setup/Base.pm
index 8991b29..d84c80e 100644
--- a/src/PVE/LXC/Setup/Base.pm
+++ b/src/PVE/LXC/Setup/Base.pm
@@ -243,6 +243,15 @@ sub setup_systemd_console {
}
}
+sub setup_container_getty_service {
+ my ($self) = @_;
+ my $servicefile = '/usr/lib/systemd/system/container-getty at .service';
+ my $raw = $self->ct_file_get_contents($servicefile);
+ if ($raw =~ s at pts/%I at lxc/tty%I at g) {
+ $self->ct_file_set_contents($servicefile, $raw);
+ }
+}
+
sub setup_systemd_networkd {
my ($self, $conf) = @_;
diff --git a/src/PVE/LXC/Setup/SUSE.pm b/src/PVE/LXC/Setup/SUSE.pm
index 165f2da..b7814fa 100644
--- a/src/PVE/LXC/Setup/SUSE.pm
+++ b/src/PVE/LXC/Setup/SUSE.pm
@@ -49,15 +49,6 @@ sub setup_init {
$self->setup_systemd_console($conf);
}
-sub setup_container_getty_service {
- my ($self) = @_;
- my $servicefile = '/usr/lib/systemd/system/container-getty at .service';
- my $raw = $self->ct_file_get_contents($servicefile);
- if ($raw =~ s at pts/%I at lxc/tty%I at g) {
- $self->ct_file_set_contents($servicefile, $raw);
- }
-}
-
sub setup_network {
my ($self, $conf) = @_;
--
2.1.4
More information about the pve-devel
mailing list