]> git.proxmox.com Git - pve-container.git/commitdiff
setup getty: drop now obsolete setup_systemd_console
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 18 Jul 2019 15:17:17 +0000 (17:17 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 19 Jul 2019 12:32:28 +0000 (14:32 +0200)
The setup_container_getty_service can now handle also old
getty@.service if the newer container-getty@.service is not
available. So drop, and convert the two remaining users to calling
the now compatible setup_container_getty_service

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Acked-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
src/PVE/LXC/Setup/Base.pm
src/PVE/LXC/Setup/CentOS.pm
src/PVE/LXC/Setup/SUSE.pm

index e811043ecc3cc0c333f12037b4ddae749684f954..65b5466ab80ecd006b59e2f86360f919092ea1d4 100644 (file)
@@ -155,31 +155,6 @@ sub setup_init {
     die "please implement this inside subclass"
 }
 
-sub setup_systemd_console {
-    my ($self, $conf) = @_;
-
-    my $systemd_dir_rel = $self->ct_is_executable("/lib/systemd/systemd") ?
-       "/lib/systemd/system" : "/usr/lib/systemd/system";
-
-    my $systemd_getty_service_rel = "$systemd_dir_rel/getty\@.service";
-
-    return if !$self->ct_file_exists($systemd_getty_service_rel);
-
-    my $ttycount = PVE::LXC::Config->get_tty_count($conf);
-
-    for (my $i = 1; $i < 7; $i++) {
-       my $tty_service_lnk = "/etc/systemd/system/getty.target.wants/getty\@tty$i.service";
-       if ($i > $ttycount) {
-           $self->ct_unlink($tty_service_lnk);
-       } else {
-           if (!$self->ct_is_symlink($tty_service_lnk)) {
-               $self->ct_unlink($tty_service_lnk);
-               $self->ct_symlink($systemd_getty_service_rel, $tty_service_lnk);
-           }
-       }
-    }
-}
-
 # A few distros as well as unprivileged containers cannot deal with the
 # /dev/lxc/ tty subdirectory.
 sub devttydir {
index f72dbc094fdebff48e332259027758b255ec0f2b..a18aeadbf2efb682df442865477a51ed31aa90e5 100644 (file)
@@ -117,7 +117,7 @@ sub setup_init {
 
     $self->fixup_old_getty();
 
-    $self->setup_systemd_console($conf);
+    $self->setup_container_getty_service($conf);
 }
 
 sub set_hostname {
index 4a037b43c5a09a838e09a6cc3f0b3d38934ee796..a983afd1550072ab6746176772caf27b13ce24a9 100644 (file)
@@ -12,22 +12,17 @@ sub new {
 
     my $version = $os_release->{VERSION_ID};
     my $ostype = $os_release->{ID};
-    my $setup_ct_getty_service;
 
     if ($version =~ m/^(\d+)\.(\d+)$/) {
        my ($major, $minor) = ($1, $2);
        if ($major >= 42) {
            # OK
-           $setup_ct_getty_service = 1;
        } elsif ($major == 13 && $minor <= 2) {
            # OK
-           $setup_ct_getty_service = 1 if $minor >= 2;
        } elsif ($ostype eq 'sles' && $major == 12) {
            # OK - shares base with LEAP (42)
-           $setup_ct_getty_service = 1;
        } elsif ($major == 15) {
            # OK for SLES and openSUSE Leap, see: https://lwn.net/Articles/720924/
-           $setup_ct_getty_service = 1;
        } else {
            die "unsupported suse release '$version'\n";
        }
@@ -35,7 +30,6 @@ sub new {
        my ($year, $month, $day) = ($1, $2, $3);
        if ($year >= 2017 && $month <= 12 && $day <= 31) {
            # OK
-           $setup_ct_getty_service = 1;
        } else {
            die "unsupported suse tumbleweed release '$version'\n";
        }
@@ -44,7 +38,6 @@ sub new {
     }
 
     my $self = { conf => $conf, rootdir => $rootdir, version => $version, os_release => $os_release };
-    $self->{setup_ct_getty_service} = 1 if $setup_ct_getty_service;
 
     $conf->{ostype} = 'opensuse';
 
@@ -62,10 +55,7 @@ sub setup_init {
 
     $self->fixup_old_getty();
 
-    if ($self->{setup_ct_getty_service}) {
-       $self->setup_container_getty_service($conf);
-    }
-    $self->setup_systemd_console($conf);
+    $self->setup_container_getty_service($conf);
 }
 
 sub setup_network {