]> git.proxmox.com Git - dab.git/blobdiff - DAB.pm
add support for upcomming Ubuntu 20.04 "Focal Fossa"
[dab.git] / DAB.pm
diff --git a/DAB.pm b/DAB.pm
index b686141f153dbd41a90c44bfb30db090bc437073..b0e140335893bd478721ac97cb51b9e0d5670da2 100644 (file)
--- a/DAB.pm
+++ b/DAB.pm
@@ -42,6 +42,8 @@ mynetworks = 127.0.0.0/8
 inet_interfaces = loopback-only
 recipient_delimiter = +
 
+compatibility_level = 2
+
 EOD
 
 # produce apt compatible filenames (/var/lib/apt/lists)
@@ -55,6 +57,126 @@ sub __url_to_filename {
     return $url;
 }
 
+# defaults:
+#  origin: debian
+my $supported_suites = {
+    'bullseye' => {
+       ostype => "debian-11.0",
+    },
+    'buster' => {
+       ostype => "debian-10.0",
+    },
+    'stretch' => {
+       ostype => "debian-9.0",
+    },
+    'jessie' => {
+       ostype => "debian-8.0",
+    },
+    'wheezy' => {
+       ostype => "debian-7.0",
+    },
+    'squeeze' => {
+       ostype => "debian-6.0",
+    },
+    'lenny' => {
+       ostype => "debian-5.0",
+    },
+    'etch' => {
+       ostype => "debian-4.0",
+    },
+
+# DEVUAN
+    'devuan-jessie' => {
+       suite => 'jessie',
+       ostype => "devuan-1.0",
+    },
+    'devuan-ascii' => {
+       suite => 'ascii',
+       ostype => "devuan-2.0",
+    },
+    'ascii' => {
+       ostype => "devuan-2.0",
+    },
+
+# UBUNTU
+    'hardy' => {
+       ostype => "ubuntu-8.04",
+       origin => 'ubuntu',
+    },
+    'intrepid' => {
+       ostype => "ubuntu-8.10",
+       origin => 'ubuntu',
+    },
+    'jaunty' => {
+       ostype => "ubuntu-9.04",
+       origin => 'ubuntu',
+    },
+    'precise' => {
+       ostype => "ubuntu-12.04",
+       origin => 'ubuntu',
+    },
+    'trusty' => {
+       ostype => "ubuntu-14.04",
+       origin => 'ubuntu',
+    },
+    'vivid' => {
+       ostype => "ubuntu-15.04",
+       origin => 'ubuntu',
+    },
+    'wily' => {
+       ostype => "ubuntu-15.10",
+       origin => 'ubuntu',
+    },
+    'xenial' => {
+       ostype => "ubuntu-16.04",
+       origin => 'ubuntu',
+    },
+    'yakkety' => {
+       ostype => "ubuntu-16.10",
+       origin => 'ubuntu',
+    },
+    'zesty' => {
+       ostype => "ubuntu-17.04",
+       origin => 'ubuntu',
+    },
+    'artful' => {
+       ostype => "ubuntu-17.10",
+       origin => 'ubuntu',
+    },
+    'bionic' => {
+       ostype => "ubuntu-18.04",
+       origin => 'ubuntu',
+    },
+    'cosmic' => {
+       ostype => "ubuntu-18.10",
+       origin => 'ubuntu',
+    },
+    'disco' => {
+       ostype => "ubuntu-19.04",
+       origin => 'ubuntu',
+    },
+    'eoan' => {
+       ostype => "ubuntu-19.10",
+       origin => 'ubuntu',
+    },
+    'focal' => {
+       ostype => "ubuntu-20.04",
+       origin => 'ubuntu',
+    },
+};
+
+sub get_suite_info {
+    my ($suite) = @_;
+
+    my $suiteinfo = $supported_suites->{$suite} || die "unsupported suite '$suite'!\n";
+
+    # set defaults
+    $suiteinfo->{origin} //= 'debian';
+    $suiteinfo->{suite} //= $suite;
+
+    return $suiteinfo;
+}
+
 sub download {
     my ($self, $url, $path) = @_;
 
@@ -244,8 +366,8 @@ sub __sample_config {
     } else {
        die "unknown os type '$ostype'\n";
     }
-    $data .= "lxc.utsname = localhost\n";
-    $data .= "lxc.rootfs = $self->{rootfs}\n";
+    $data .= "lxc.uts.name = localhost\n";
+    $data .= "lxc.rootfs.path = $self->{rootfs}\n";
     
     return $data;
 }
@@ -319,49 +441,10 @@ sub new {
        if $arch !~ m/^(i386|amd64)$/;
 
     my $suite = $config->{suite} || die "no 'suite' specified\n";
-    if ($suite eq 'stretch') {
-       $config->{ostype} = "debian-9.0";
-    } elsif ($suite eq 'jessie') {
-         $config->{ostype} = "debian-8.0";
-    } elsif ($suite eq 'wheezy') {
-         $config->{ostype} = "debian-7.0";
-    } elsif ($suite eq 'squeeze') {
-       $config->{ostype} = "debian-6.0";
-    } elsif ($suite eq 'lenny') { 
-       $config->{ostype} = "debian-5.0";
-    } elsif ($suite eq 'etch') { 
-       $config->{ostype} = "debian-4.0";
-    } elsif ($suite eq 'devuan-jessie') {
-       $suite = 'jessie';
-       $config->{ostype} = "devuan-1.0";
-    } elsif ($suite eq 'devuan-ascii' || $suite eq 'ascii') {
-       $suite = 'ascii';
-       $config->{ostype} = "devuan-2.0";
-    } elsif ($suite eq 'hardy') { 
-       $config->{ostype} = "ubuntu-8.04";
-    } elsif ($suite eq 'intrepid') { 
-       $config->{ostype} = "ubuntu-8.10";
-    } elsif ($suite eq 'jaunty') { 
-       $config->{ostype} = "ubuntu-9.04";
-    } elsif ($suite eq 'precise') { 
-       $config->{ostype} = "ubuntu-12.04";
-    } elsif ($suite eq 'trusty') { 
-       $config->{ostype} = "ubuntu-14.04";
-    } elsif ($suite eq 'vivid') { 
-       $config->{ostype} = "ubuntu-15.04";
-    } elsif ($suite eq 'wily') {
-       $config->{ostype} = "ubuntu-15.10";
-    } elsif ($suite eq 'xenial') {
-       $config->{ostype} = "ubuntu-16.04";
-    } elsif ($suite eq 'yakkety') {
-       $config->{ostype} = "ubuntu-16.10";
-    } elsif ($suite eq 'zesty') {
-       $config->{ostype} = "ubuntu-17.04";
-    } elsif ($suite eq 'artful') {
-       $config->{ostype} = "ubuntu-17.10";
-    } else {
-       die "unsupported debian suite '$suite'\n";
-    }
+
+    my $suiteinfo = get_suite_info($suite);
+    $suite = $suiteinfo->{suite};
+    $config->{ostype} = $suiteinfo->{ostype};
 
     my $name = $config->{name} || die "no 'name' specified\n";
 
@@ -382,22 +465,26 @@ sub new {
     }
 
     if (!$config->{source}) {
-       if ($suite eq 'etch' || $suite eq 'lenny') {
-           push @{$config->{source}}, "http://ftp.debian.org/debian SUITE main contrib";
-           push @{$config->{source}}, "http://security.debian.org SUITE/updates main contrib";
-       } elsif ($suite eq 'squeeze' || $suite eq 'wheezy' ||
-                $suite eq 'jessie' || $suite eq 'stretch' ) {
-           push @{$config->{source}}, "http://ftp.debian.org/debian SUITE main contrib";
-           push @{$config->{source}}, "http://ftp.debian.org/debian SUITE-updates main contrib";
-           push @{$config->{source}}, "http://security.debian.org SUITE/updates main contrib";
-       } elsif ($suite eq 'hardy' || $suite eq 'intrepid' || $suite eq 'jaunty' ||
-                $suite eq 'xenial' || $suite eq 'wily' || $suite eq 'vivid' ||
-                $suite eq 'trusty' || $suite eq 'precise' || $suite eq 'yakkety' ||
-                $suite eq 'zesty' || $suite eq 'artful' ) {
+       if (lc($suiteinfo->{origin}) eq 'debian') {
+           if ($suite eq 'etch' || $suite eq 'lenny') {
+               push @{$config->{source}}, (
+                   'http://ftp.debian.org/debian SUITE main contrib',
+                   'http://security.debian.org SUITE/updates main contrib',
+               );
+           } else {
+               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/updates main contrib",
+               );
+           }
+       } elsif (lc($suiteinfo->{origin}) eq 'ubuntu') {
            my $comp = "main restricted universe multiverse";
-           push @{$config->{source}}, "http://archive.ubuntu.com/ubuntu SUITE $comp"; 
-           push @{$config->{source}}, "http://archive.ubuntu.com/ubuntu SUITE-updates $comp"; 
-           push @{$config->{source}}, "http://archive.ubuntu.com/ubuntu SUITE-security $comp";
+           push @{$config->{source}}, (
+               "http://archive.ubuntu.com/ubuntu SUITE $comp",
+               "http://archive.ubuntu.com/ubuntu SUITE-updates $comp",
+               "http://archive.ubuntu.com/ubuntu SUITE-security $comp",
+           );
        } else {
            die "implement me";
        }
@@ -461,7 +548,9 @@ sub new {
     # we cannot exclude it (instead we disable udevd)
 
     if ($suite eq 'vivid' || $suite eq 'wily' || $suite eq 'xenial' ||
-       $suite eq 'yakkety' || $suite eq 'zesty' || $suite eq 'artful') {
+       $suite eq 'yakkety' || $suite eq 'zesty' || $suite eq 'artful' ||
+       $suite eq 'bionic' || $suite eq 'cosmic' || $suite eq 'disco' ||
+       $suite eq 'eoan' || $suite eq 'focal') {
        push @$incl, 'isc-dhcp-client';
        push @$excl, qw(libmodule-build-perl);
     } elsif ($suite eq 'trusty') {
@@ -480,7 +569,7 @@ sub new {
        push @$incl, 'libperl4-corelibs-perl'; # to make lsof happy
        push @$excl, qw(systemd systemd-sysv udev module-init-tools pciutils hdparm 
                        memtest86+ parted);
-    } elsif ($suite eq 'stretch') {
+    } elsif ($suite eq 'stretch' || $suite eq 'buster' || $suite eq 'bullseye') {
        push @$excl, qw(module-init-tools pciutils hdparm
                        memtest86+ parted);
      } else {
@@ -1145,7 +1234,9 @@ sub install_init_script {
     if ($suite eq 'etch' || $suite eq 'lenny') {
        $self->ve_command ("update-rc.d $base start $prio $runlevel .");
     } elsif ($suite eq 'xenial' || $suite eq 'wily' || $suite eq 'vivid' ||
-            $suite eq 'yakkety' || $suite eq 'zesty' || $suite eq 'artful') {
+            $suite eq 'yakkety' || $suite eq 'zesty' || $suite eq 'artful' ||
+            $suite eq 'bionic' || $suite eq 'cosmic' || $suite eq 'disco' ||
+            $suite eq 'eoan' || $suite eq 'focal') {
        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";
@@ -1264,8 +1355,10 @@ sub bootstrap {
     # avoid warnings about non-existent resolv.conf
     write_file ("", "$rootdir/etc/resolv.conf", 0644);
 
-    if ($suite eq 'artful' || $suite eq 'zesty' || $suite eq 'yakkety' ||
-       $suite eq 'xenial' || $suite eq 'wily') {
+    if ($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') {
        # no need to configure loopback device
     } else {
        $data = "auto lo\niface lo inet loopback\n";
@@ -1549,6 +1642,13 @@ sub task_postgres {
     } elsif ($suite eq 'stretch') {
         @supp = ('9.6');
         $pgversion = '9.6';
+    } elsif ($suite eq 'buster') {
+        @supp = ('11');
+        $pgversion = '11';
+    } elsif ($suite eq 'bullseye') {
+       # FIXME update on freeze!
+       @supp = ('12');
+       $pgversion = '12';
     }
 
     $pgversion = $opts->{version} if $opts->{version};