]> git.proxmox.com Git - dab.git/blobdiff - DAB.pm
debian 11: use short ostype
[dab.git] / DAB.pm
diff --git a/DAB.pm b/DAB.pm
index cb04f7e005a139350a6ee3606ed53cedca988158..26db7ad9eb3b97263f3de6b5ab617e2a87222a30 100644 (file)
--- a/DAB.pm
+++ b/DAB.pm
@@ -61,7 +61,7 @@ sub __url_to_filename {
 #  origin: debian
 my $supported_suites = {
     'bullseye' => {
-       ostype => "debian-11.0",
+       ostype => "debian-11",
     },
     'buster' => {
        ostype => "debian-10",
@@ -97,6 +97,12 @@ my $supported_suites = {
     'ascii' => {
        ostype => "devuan-2.0",
     },
+    'beowulf' => {
+       ostype => "devuan-3.0",
+    },
+    'chimaera' => {
+       ostype => "devuan-4.0",
+    },
 
 # UBUNTU
     'hardy' => {
@@ -163,6 +169,14 @@ my $supported_suites = {
        ostype => "ubuntu-20.04",
        origin => 'ubuntu',
     },
+    'groovy' => {
+       ostype => "ubuntu-20.10",
+       origin => 'ubuntu',
+    },
+    'hirsute' => {
+       ostype => "ubuntu-21.04",
+       origin => 'ubuntu',
+    },
 };
 
 sub get_suite_info {
@@ -556,7 +570,9 @@ sub new {
     if ($suite eq 'vivid' || $suite eq 'wily' || $suite eq 'xenial' ||
        $suite eq 'yakkety' || $suite eq 'zesty' || $suite eq 'artful' ||
        $suite eq 'bionic' || $suite eq 'cosmic' || $suite eq 'disco' ||
-       $suite eq 'eoan' || $suite eq 'focal') {
+       $suite eq 'eoan' || $suite eq 'focal' || $suite eq 'groovy'
+       || $suite eq 'hirsute'
+    ) {
        push @$incl, 'isc-dhcp-client';
        push @$excl, qw(libmodule-build-perl);
     } elsif ($suite eq 'trusty') {
@@ -776,13 +792,32 @@ sub finalize {
     $self->logmsg ("creating final appliance archive\n");
 
     my $target = "$self->{targetname}.tar";
-    my $final_archive = "${target}.gz";
+
+    my $compressor = $opts->{compressor} // 'gz';
+    my $compressor2cmd_map = {
+       gz => 'gzip',
+       gzip => 'gzip',
+       zst => 'zstd -9',
+       zstd => 'zstd -9',
+       'zstd-max' => 'zstd -19 -T0', # maximal level where the decompressor can still run efficiently
+    };
+    my $compressor2ending = {
+       gzip => 'gz',
+       zstd => 'zst',
+       'zstd-max' => 'zst',
+    };
+    my $compressor_cmd = $compressor2cmd_map->{$compressor};
+    die "unkown compressor '$compressor', use one of: ". join(', ', sort keys %$compressor2cmd_map)
+       if !defined($compressor_cmd);
+
+    my $ending = $compressor2ending->{$compressor} // $compressor;
+    my $final_archive = "${target}.${ending}";
     unlink $target;
     unlink $final_archive;
 
     $self->run_command ("tar cpf $target --numeric-owner -C '$rootdir' ./etc/appliance.info");
     $self->run_command ("tar rpf $target --numeric-owner -C '$rootdir' --exclude ./etc/appliance.info .");
-    $self->run_command ("gzip $target");
+    $self->run_command ("$compressor_cmd $target");
 
     $self->logmsg ("detecting final commpressed appliance size: ");
     $size = $get_path_size->($final_archive);
@@ -1265,7 +1300,9 @@ sub install_init_script {
     } elsif ($suite eq 'xenial' || $suite eq 'wily' || $suite eq 'vivid' ||
             $suite eq 'yakkety' || $suite eq 'zesty' || $suite eq 'artful' ||
             $suite eq 'bionic' || $suite eq 'cosmic' || $suite eq 'disco' ||
-            $suite eq 'eoan' || $suite eq 'focal') {
+            $suite eq 'eoan' || $suite eq 'focal' || $suite eq 'groovy'
+            || $suite eq 'hirsute'
+    ) {
        die "unable to install init script (system uses systemd)\n";
     } elsif ($suite eq 'trusty' || $suite eq 'precise') {
        die "unable to install init script (system uses upstart)\n";
@@ -1384,7 +1421,9 @@ sub bootstrap {
     # avoid warnings about non-existent resolv.conf
     write_file ("", "$rootdir/etc/resolv.conf", 0644);
 
-    if ($suite eq 'focal' || $suite eq 'eoan' || $suite eq 'disco' || $suite eq 'cosmic' ||
+    if (
+       $suite eq 'hirsute' || $suite eq 'groovy' || $suite eq 'focal' ||
+       $suite eq 'eoan' || $suite eq 'disco' || $suite eq 'cosmic' ||
        $suite eq 'bionic' || $suite eq 'artful' ||
        $suite eq 'zesty' || $suite eq 'yakkety' || $suite eq 'xenial' ||
        $suite eq 'wily') {