[pve-devel] [PATCH container 7/8] setup/suse: support tumbleweed container

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Aug 1 11:28:58 CEST 2017


Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 src/PVE/LXC/Setup/SUSE.pm                          |  8 ++++++++
 src/test/test-opensuse-004/config                  |  3 +++
 src/test/test-opensuse-004/etc/os-release          | 10 +++++++++
 src/test/test-opensuse-004/etc/securetty           |  7 +++++++
 src/test/test-opensuse-004/etc/securetty.exp       | 12 +++++++++++
 .../etc/sysconfig/network/ifcfg-eth0.exp           |  4 ++++
 .../etc/sysconfig/network/ifcfg-eth1.exp           |  2 ++
 .../etc/sysconfig/network/ifroute-eth0.exp         |  5 +++++
 .../root/.ssh/authorized_keys.exp                  |  3 +++
 .../lib/systemd/system/container-getty at .service    | 24 ++++++++++++++++++++++
 10 files changed, 78 insertions(+)
 create mode 100644 src/test/test-opensuse-004/config
 create mode 100644 src/test/test-opensuse-004/etc/os-release
 create mode 100644 src/test/test-opensuse-004/etc/securetty
 create mode 100644 src/test/test-opensuse-004/etc/securetty.exp
 create mode 100644 src/test/test-opensuse-004/etc/sysconfig/network/ifcfg-eth0.exp
 create mode 100644 src/test/test-opensuse-004/etc/sysconfig/network/ifcfg-eth1.exp
 create mode 100644 src/test/test-opensuse-004/etc/sysconfig/network/ifroute-eth0.exp
 create mode 100644 src/test/test-opensuse-004/root/.ssh/authorized_keys.exp
 create mode 100644 src/test/test-opensuse-004/usr/lib/systemd/system/container-getty at .service

diff --git a/src/PVE/LXC/Setup/SUSE.pm b/src/PVE/LXC/Setup/SUSE.pm
index 98427aa..3a526cf 100644
--- a/src/PVE/LXC/Setup/SUSE.pm
+++ b/src/PVE/LXC/Setup/SUSE.pm
@@ -25,6 +25,14 @@ sub new {
 	} else {
 	    die "unsupported suse release '$version'\n";
 	}
+    } elsif ($version =~ m/^(\d{4})(\d{2})(\d{2})$/) {
+	my ($year, $month, $day) = ($1, $2, $3);
+	if ($year >= 2017 && $month <= 12 && $day <= 31) {
+	    # OK
+	    $setup_ct_getty_service = 1;
+	} else {
+	    die "unsupported suse tumbleweed release '$version'\n";
+	}
     } else {
 	die "unrecognized suse release";
     }
diff --git a/src/test/test-opensuse-004/config b/src/test/test-opensuse-004/config
new file mode 100644
index 0000000..ac3e532
--- /dev/null
+++ b/src/test/test-opensuse-004/config
@@ -0,0 +1,3 @@
+hostname: pvesuse1
+net0: bridge=vmbr0,name=eth0,ip=1.2.3.4/24,gw=4.3.2.1,ip6=2001:1::/64,gw6=2001:1::ffff
+net1: bridge=vmbr0,name=eth1,ip=dhcp
diff --git a/src/test/test-opensuse-004/etc/os-release b/src/test/test-opensuse-004/etc/os-release
new file mode 100644
index 0000000..f1b47fe
--- /dev/null
+++ b/src/test/test-opensuse-004/etc/os-release
@@ -0,0 +1,10 @@
+NAME="openSUSE Tumbleweed"
+# VERSION="20170729"
+ID=opensuse
+ID_LIKE="suse"
+VERSION_ID="20170729"
+PRETTY_NAME="openSUSE Tumbleweed"
+ANSI_COLOR="0;32"
+CPE_NAME="cpe:/o:opensuse:tumbleweed:20170729"
+BUG_REPORT_URL="https://bugs.opensuse.org"
+HOME_URL="https://www.opensuse.org/"
diff --git a/src/test/test-opensuse-004/etc/securetty b/src/test/test-opensuse-004/etc/securetty
new file mode 100644
index 0000000..e0bd229
--- /dev/null
+++ b/src/test/test-opensuse-004/etc/securetty
@@ -0,0 +1,7 @@
+tty1
+tty2
+tty3
+tty4
+tty5
+tty6
+console
diff --git a/src/test/test-opensuse-004/etc/securetty.exp b/src/test/test-opensuse-004/etc/securetty.exp
new file mode 100644
index 0000000..a0f3062
--- /dev/null
+++ b/src/test/test-opensuse-004/etc/securetty.exp
@@ -0,0 +1,12 @@
+tty1
+tty2
+tty3
+tty4
+tty5
+tty6
+console
+lxc/console
+lxc/tty1
+lxc/tty2
+lxc/tty3
+lxc/tty4
diff --git a/src/test/test-opensuse-004/etc/sysconfig/network/ifcfg-eth0.exp b/src/test/test-opensuse-004/etc/sysconfig/network/ifcfg-eth0.exp
new file mode 100644
index 0000000..d5255e2
--- /dev/null
+++ b/src/test/test-opensuse-004/etc/sysconfig/network/ifcfg-eth0.exp
@@ -0,0 +1,4 @@
+STARTMODE=onboot
+BOOTPROTO=static
+IPADDR_1=1.2.3.4/24
+IPADDR_2=2001:1::/64
diff --git a/src/test/test-opensuse-004/etc/sysconfig/network/ifcfg-eth1.exp b/src/test/test-opensuse-004/etc/sysconfig/network/ifcfg-eth1.exp
new file mode 100644
index 0000000..9afa8b7
--- /dev/null
+++ b/src/test/test-opensuse-004/etc/sysconfig/network/ifcfg-eth1.exp
@@ -0,0 +1,2 @@
+STARTMODE=onboot
+BOOTPROTO=dhcp4
diff --git a/src/test/test-opensuse-004/etc/sysconfig/network/ifroute-eth0.exp b/src/test/test-opensuse-004/etc/sysconfig/network/ifroute-eth0.exp
new file mode 100644
index 0000000..31e51de
--- /dev/null
+++ b/src/test/test-opensuse-004/etc/sysconfig/network/ifroute-eth0.exp
@@ -0,0 +1,5 @@
+# --- BEGIN PVE ---
+4.3.2.1 0.0.0.0 255.255.255.255 eth0
+default 4.3.2.1 0.0.0.0 eth0
+default 2001:1::ffff - eth0
+# --- END PVE ---
diff --git a/src/test/test-opensuse-004/root/.ssh/authorized_keys.exp b/src/test/test-opensuse-004/root/.ssh/authorized_keys.exp
new file mode 100644
index 0000000..1cb3ec3
--- /dev/null
+++ b/src/test/test-opensuse-004/root/.ssh/authorized_keys.exp
@@ -0,0 +1,3 @@
+# --- BEGIN PVE ---
+ssh-rsa ABCDEFG ABC at DEF
+# --- END PVE ---
diff --git a/src/test/test-opensuse-004/usr/lib/systemd/system/container-getty at .service b/src/test/test-opensuse-004/usr/lib/systemd/system/container-getty at .service
new file mode 100644
index 0000000..5a34773
--- /dev/null
+++ b/src/test/test-opensuse-004/usr/lib/systemd/system/container-getty at .service
@@ -0,0 +1,24 @@
+[Unit]
+Description=Container Getty on /dev/pts/%I
+Documentation=man:agetty(8) man:machinectl(1)
+After=systemd-user-sessions.service plymouth-quit-wait.service
+After=rc-local.service
+Before=getty.target
+IgnoreOnIsolate=yes
+ConditionPathExists=/dev/pts/%I
+
+[Service]
+# The '-o' option value tells agetty to replace 'login' arguments with an
+# option to preserve environment (-p), followed by '--' for safety, and then
+# the entered username.
+ExecStart=-/sbin/agetty -o '-p -- \\u' --noclear --keep-baud pts/%I 115200,38400,9600 $TERM
+Type=idle
+Restart=always
+RestartSec=0
+UtmpIdentifier=pts/%I
+TTYPath=/dev/pts/%I
+TTYReset=yes
+TTYVHangup=yes
+KillMode=process
+IgnoreSIGPIPE=no
+SendSIGHUP=yes
-- 
2.11.0





More information about the pve-devel mailing list