]> 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 9f5fcbcc892c602282935e4b27d338819ed5bf2a..26db7ad9eb3b97263f3de6b5ab617e2a87222a30 100644 (file)
--- a/DAB.pm
+++ b/DAB.pm
@@ -61,10 +61,10 @@ sub __url_to_filename {
 #  origin: debian
 my $supported_suites = {
     'bullseye' => {
-       ostype => "debian-11.0",
+       ostype => "debian-11",
     },
     'buster' => {
-       ostype => "debian-10.0",
+       ostype => "debian-10",
     },
     'stretch' => {
        ostype => "debian-9.0",
@@ -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 {
@@ -471,6 +485,12 @@ sub new {
                    'http://ftp.debian.org/debian SUITE main contrib',
                    'http://security.debian.org SUITE/updates main contrib',
                );
+           } elsif ($suite eq 'bullseye') {
+               push @{$config->{source}}, (
+                   "http://ftp.debian.org/debian SUITE main contrib",
+                   "http://ftp.debian.org/debian SUITE-updates main contrib",
+                   "http://security.debian.org SUITE-security main contrib",
+               );
            } else {
                push @{$config->{source}}, (
                    "http://ftp.debian.org/debian SUITE main contrib",
@@ -550,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') {
@@ -770,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);
@@ -1259,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";
@@ -1378,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') {
@@ -1563,18 +1608,16 @@ EOD
        $self->run_command ($cmd);
     }
 
-    if ($suite eq 'intrepid') {
+    if ($suite eq 'intrepid' || $suite eq 'jaunty') {
        # remove sysctl setup (avoid warnings at startup)
        my $filelist = "$rootdir/etc/sysctl.d/10-console-messages.conf";
-       $filelist .= " $rootdir/etc/sysctl.d/10-process-security.conf";
+       $filelist .= " $rootdir/etc/sysctl.d/10-process-security.conf" if $suite eq 'intrepid';
        $filelist .= " $rootdir/etc/sysctl.d/10-network-security.conf";
        $self->run_command ("rm $filelist");
     }
-    if ($suite eq 'jaunty') {
-       # remove sysctl setup (avoid warnings at startup)
-       my $filelist = "$rootdir/etc/sysctl.d/10-console-messages.conf";
-       $filelist .= " $rootdir/etc/sysctl.d/10-network-security.conf";
-       $self->run_command ("rm $filelist");
+
+    if (-e "$rootdir/lib/systemd/system/sys-kernel-config.mount") {
+       $self->ve_command ("ln -s /dev/null /etc/systemd/system/sys-kernel-debug.mount");
     }
 }