]> git.proxmox.com Git - pve-manager.git/commitdiff
pve7to8: use loop for systemd version extraction
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 12 Jun 2023 14:44:39 +0000 (16:44 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 12 Jun 2023 14:44:39 +0000 (16:44 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
PVE/CLI/pve7to8.pm

index 1d29880a553e5078069b656bbfd0bd099ba7d8ed..105a0e7381f6198e4640551fc685c919680d5ba8 100644 (file)
@@ -1016,12 +1016,10 @@ sub check_containers_cgroup_compat {
        my $get_systemd_version = sub {
            my ($self) = @_;
 
-           my $libsd = PVE::Tools::dir_glob_regex("/lib/systemd", "libsystemd-shared-.+\.so");
-           if (!defined($libsd)) {
-               $libsd = PVE::Tools::dir_glob_regex("/usr/lib/systemd", "libsystemd-shared-.+\.so");
-           }
-           if (!defined($libsd)) {
-               $libsd = PVE::Tools::dir_glob_regex("/usr/lib/x86_64-linux-gnu/systemd", "libsystemd-shared-.+\.so");
+           my $libsd;
+           for my $dir ('/lib/systemd', '/usr/lib/systemd', '/usr/lib/x86_64-linux-gnu/systemd') {
+               $libsd = PVE::Tools::dir_glob_regex($dir, "libsystemd-shared-.+\.so");
+               last if defined($libsd);
            }
            if (defined($libsd) && $libsd =~ /libsystemd-shared-(\d+)(\.\d-\d)?\.so/) {
                return $1;