]> git.proxmox.com Git - pve-container.git/commitdiff
close #1668: add Devuan support
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 16 Feb 2018 07:40:48 +0000 (08:40 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 16 Feb 2018 09:43:50 +0000 (10:43 +0100)
Add separate Plugin as the Debian Plugin will get more systemd
specific stuff in the future, while this here is as anti-systemd as
it gets, so make the split from the start.

But only overwrite the plugin constructor for now, the rest is still
backward compatible.

20 files changed:
src/PVE/LXC/Setup.pm
src/PVE/LXC/Setup/Devuan.pm [new file with mode: 0644]
src/PVE/LXC/Setup/Makefile
src/test/test-devuan-001/config [new file with mode: 0644]
src/test/test-devuan-001/etc/devuan_version [new file with mode: 0644]
src/test/test-devuan-001/etc/hostname.exp [new file with mode: 0644]
src/test/test-devuan-001/etc/hosts.exp [new file with mode: 0644]
src/test/test-devuan-001/etc/network/interfaces.exp [new file with mode: 0644]
src/test/test-devuan-001/etc/os-release [new file with mode: 0644]
src/test/test-devuan-001/root/.ssh/authorized_keys.exp [new file with mode: 0644]
src/test/test-devuan-002/config [new file with mode: 0644]
src/test/test-devuan-002/etc/devuan_version [new file with mode: 0644]
src/test/test-devuan-002/etc/hostname.exp [new file with mode: 0644]
src/test/test-devuan-002/etc/hosts [new file with mode: 0644]
src/test/test-devuan-002/etc/hosts.exp [new file with mode: 0644]
src/test/test-devuan-002/etc/network/interfaces [new file with mode: 0644]
src/test/test-devuan-002/etc/network/interfaces.exp [new file with mode: 0644]
src/test/test-devuan-002/etc/resolv.conf [new file with mode: 0644]
src/test/test-devuan-002/etc/resolv.conf.exp [new file with mode: 0644]
src/test/test-devuan-002/root/.ssh/authorized_keys.exp [new file with mode: 0644]

index 9b91539fd65785088eee39a51ed5eeccfa72f00d..ea0d4150cb6c7ddef3f1a411c4f244556d64361d 100644 (file)
@@ -13,9 +13,11 @@ use PVE::LXC::Setup::SUSE;
 use PVE::LXC::Setup::ArchLinux;
 use PVE::LXC::Setup::Alpine;
 use PVE::LXC::Setup::Gentoo;
+use PVE::LXC::Setup::Devuan;
 
 my $plugins = {
     debian    => 'PVE::LXC::Setup::Debian',
+    devuan    => 'PVE::LXC::Setup::Devuan',
     ubuntu    => 'PVE::LXC::Setup::Ubuntu',
     centos    => 'PVE::LXC::Setup::CentOS',
     fedora    => 'PVE::LXC::Setup::Fedora',
@@ -51,6 +53,8 @@ my $autodetect_type = sub {
 
     if (-f "$rootdir/etc/debian_version") {
        return "debian";
+    } elsif (-f "$rootdir/etc/devuan_version") {
+       return "devuan";
     } elsif (-f  "$rootdir/etc/SuSE-brand" || -f "$rootdir/etc/SuSE-release") {
        return "opensuse";
     } elsif (-f  "$rootdir/etc/fedora-release") {
diff --git a/src/PVE/LXC/Setup/Devuan.pm b/src/PVE/LXC/Setup/Devuan.pm
new file mode 100644 (file)
index 0000000..db8c8fe
--- /dev/null
@@ -0,0 +1,31 @@
+package PVE::LXC::Setup::Devuan;
+
+use strict;
+use warnings;
+
+use PVE::Tools qw($IPV6RE);
+
+use PVE::LXC::Setup::Debian;
+use base qw(PVE::LXC::Setup::Debian);
+
+sub new {
+    my ($class, $conf, $rootdir) = @_;
+
+    my $version = PVE::Tools::file_read_firstline("$rootdir/etc/devuan_version");
+
+    die "unable to read version info\n" if !defined($version);
+
+    die "unsupported Devuan version '$version'\n"
+       if $version !~ /jessie|ascii/;
+
+    my $self = { conf => $conf, rootdir => $rootdir, version => $version };
+
+    $conf->{ostype} = "devuan";
+
+    return bless $self, $class;
+}
+
+# the rest gets handled by the Debian plugin, which is compatible with older
+# non-systemd Debian versions for now.
+
+1;
index f971e0bfc8fe62fa60a0bf69e2f5d2693020e318..df0faff00d95791ecc2e1d198b5ec0553c39e1ba 100644 (file)
@@ -1,4 +1,4 @@
-SOURCES=Base.pm Debian.pm Ubuntu.pm CentOS.pm Fedora.pm SUSE.pm ArchLinux.pm Alpine.pm Gentoo.pm
+SOURCES=Base.pm Debian.pm Ubuntu.pm CentOS.pm Fedora.pm SUSE.pm ArchLinux.pm Alpine.pm Gentoo.pm Devuan.pm
 
 .PHONY: install
 install:
diff --git a/src/test/test-devuan-001/config b/src/test/test-devuan-001/config
new file mode 100644 (file)
index 0000000..5191092
--- /dev/null
@@ -0,0 +1,4 @@
+hostname: test1
+net0: bridge=vmbr0,name=eth0,ip=1.2.3.4/24,gw=1.2.3.1
+net1: bridge=vmbr0,name=eth1,ip=10.2.3.4/24
+net2: bridge=vmbr0,name=eth2,ip=manual
diff --git a/src/test/test-devuan-001/etc/devuan_version b/src/test/test-devuan-001/etc/devuan_version
new file mode 100644 (file)
index 0000000..dc797ba
--- /dev/null
@@ -0,0 +1 @@
+jessie
diff --git a/src/test/test-devuan-001/etc/hostname.exp b/src/test/test-devuan-001/etc/hostname.exp
new file mode 100644 (file)
index 0000000..a5bce3f
--- /dev/null
@@ -0,0 +1 @@
+test1
diff --git a/src/test/test-devuan-001/etc/hosts.exp b/src/test/test-devuan-001/etc/hosts.exp
new file mode 100644 (file)
index 0000000..01ac197
--- /dev/null
@@ -0,0 +1,5 @@
+# --- BEGIN PVE ---
+127.0.0.1 localhost.localnet localhost
+::1 localhost.localnet localhost
+1.2.3.4 test1.proxmox.com test1
+# --- END PVE ---
diff --git a/src/test/test-devuan-001/etc/network/interfaces.exp b/src/test/test-devuan-001/etc/network/interfaces.exp
new file mode 100644 (file)
index 0000000..0c7dae1
--- /dev/null
@@ -0,0 +1,18 @@
+auto lo
+iface lo inet loopback
+iface lo inet6 loopback
+
+auto eth0
+iface eth0 inet static
+       address 1.2.3.4
+       netmask 255.255.255.0
+       gateway 1.2.3.1
+
+auto eth1
+iface eth1 inet static
+       address 10.2.3.4
+       netmask 255.255.255.0
+
+auto eth2
+iface eth2 inet manual
+
diff --git a/src/test/test-devuan-001/etc/os-release b/src/test/test-devuan-001/etc/os-release
new file mode 100644 (file)
index 0000000..7a10aca
--- /dev/null
@@ -0,0 +1,8 @@
+PRETTY_NAME="Devuan GNU/Linux 1 (jessie)"
+NAME="Devuan GNU/Linux"
+VERSION_ID="1"
+VERSION="1 (jessie)"
+ID=devuan
+HOME_URL="http://www.devuan.org/"
+SUPPORT_URL="http://www.devuan.org/support/"
+BUG_REPORT_URL="https://bugs.devuan.org/"
\ No newline at end of file
diff --git a/src/test/test-devuan-001/root/.ssh/authorized_keys.exp b/src/test/test-devuan-001/root/.ssh/authorized_keys.exp
new file mode 100644 (file)
index 0000000..1cb3ec3
--- /dev/null
@@ -0,0 +1,3 @@
+# --- BEGIN PVE ---
+ssh-rsa ABCDEFG ABC@DEF
+# --- END PVE ---
diff --git a/src/test/test-devuan-002/config b/src/test/test-devuan-002/config
new file mode 100644 (file)
index 0000000..dd187fc
--- /dev/null
@@ -0,0 +1,9 @@
+arch: i386
+cpulimit: 1
+memory: 512
+swap: 512
+ostype: devuan
+hostname: CT102
+nameserver: 8.8.8.8,8.8.8.9
+searchdomain: proxmox.com
+net0: bridge=vmbr0,name=eth0,hwaddr=2A:31:01:D5:A4:BF,ip=192.168.3.102/20,gw=192.168.2.1
diff --git a/src/test/test-devuan-002/etc/devuan_version b/src/test/test-devuan-002/etc/devuan_version
new file mode 100644 (file)
index 0000000..c9c3825
--- /dev/null
@@ -0,0 +1 @@
+ascii
diff --git a/src/test/test-devuan-002/etc/hostname.exp b/src/test/test-devuan-002/etc/hostname.exp
new file mode 100644 (file)
index 0000000..473d65d
--- /dev/null
@@ -0,0 +1 @@
+CT102
diff --git a/src/test/test-devuan-002/etc/hosts b/src/test/test-devuan-002/etc/hosts
new file mode 100644 (file)
index 0000000..e7bce03
--- /dev/null
@@ -0,0 +1,2 @@
+127.0.0.1 localhost.localdomain localhost
+127.0.1.1 CT102
diff --git a/src/test/test-devuan-002/etc/hosts.exp b/src/test/test-devuan-002/etc/hosts.exp
new file mode 100644 (file)
index 0000000..7f540b4
--- /dev/null
@@ -0,0 +1,6 @@
+127.0.0.1 localhost.localdomain localhost
+127.0.1.1 CT102
+# --- BEGIN PVE ---
+::1 localhost.localnet localhost
+192.168.3.102 CT102.proxmox.com CT102
+# --- END PVE ---
diff --git a/src/test/test-devuan-002/etc/network/interfaces b/src/test/test-devuan-002/etc/network/interfaces
new file mode 100644 (file)
index 0000000..f1bd92e
--- /dev/null
@@ -0,0 +1,2 @@
+auto lo
+iface lo inet loopback
diff --git a/src/test/test-devuan-002/etc/network/interfaces.exp b/src/test/test-devuan-002/etc/network/interfaces.exp
new file mode 100644 (file)
index 0000000..b5ce7f8
--- /dev/null
@@ -0,0 +1,9 @@
+auto lo
+iface lo inet loopback
+
+auto eth0
+iface eth0 inet static
+       address 192.168.3.102
+       netmask 255.255.240.0
+       gateway 192.168.2.1
+
diff --git a/src/test/test-devuan-002/etc/resolv.conf b/src/test/test-devuan-002/etc/resolv.conf
new file mode 100644 (file)
index 0000000..c5c5a1c
--- /dev/null
@@ -0,0 +1,8 @@
+# Existing data
+# Will be kept because there's a PVE section to be replaced
+
+# --- BEGIN PVE ---
+# Stuff gets filled here
+# --- END PVE ---
+
+# This will be kept, too
diff --git a/src/test/test-devuan-002/etc/resolv.conf.exp b/src/test/test-devuan-002/etc/resolv.conf.exp
new file mode 100644 (file)
index 0000000..b50943a
--- /dev/null
@@ -0,0 +1,10 @@
+# Existing data
+# Will be kept because there's a PVE section to be replaced
+
+# --- BEGIN PVE ---
+search proxmox.com
+nameserver 8.8.8.8
+nameserver 8.8.8.9
+# --- END PVE ---
+
+# This will be kept, too
diff --git a/src/test/test-devuan-002/root/.ssh/authorized_keys.exp b/src/test/test-devuan-002/root/.ssh/authorized_keys.exp
new file mode 100644 (file)
index 0000000..1cb3ec3
--- /dev/null
@@ -0,0 +1,3 @@
+# --- BEGIN PVE ---
+ssh-rsa ABCDEFG ABC@DEF
+# --- END PVE ---