]> git.proxmox.com Git - pve-container.git/commitdiff
setup: debian: use hash map for translating dev versions
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 9 Feb 2021 09:18:49 +0000 (10:18 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 9 Feb 2021 09:18:49 +0000 (10:18 +0100)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/LXC/Setup/Debian.pm

index 0cb01c41f383f1df6361d9aae027067e310c0f78..265e2a5031cbf1e4f64159ec41607b690311c5c2 100644 (file)
@@ -19,11 +19,14 @@ sub new {
 
     die "unable to read version info\n" if !defined($version);
 
-    # translate testing version names
-    $version = 9.1 if $version eq 'stretch/sid';
-    $version = 10 if $version eq 'buster/sid';
-    $version = 11 if $version eq 'bullseye/sid';
-    $version = 11 if $version eq 'kali-rolling';
+    # translate testing version and os-release incompat derivates names
+    my $version_map = {
+       'stretch/sid' => 9.1,
+       'buster/sid' => 10,
+       'bullseye/sid' => 11,
+       'kali-rolling' => 11,
+    };
+    $version = $version_map->{$version} if exists($version_map->{$version});
 
     die "unable to parse version info '$version'\n"
        if $version !~ m/^(\d+(\.\d+)?)(\.\d+)?/;