The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/1724

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Allows building a tumbleweed and Leap 42.3 template
From b65414618e5ee131ffd184fde9e19a48f1148f65 Mon Sep 17 00:00:00 2001
From: Thomas Lamprecht <[email protected]>
Date: Tue, 1 Aug 2017 07:34:43 +0200
Subject: [PATCH 1/4] templates/opensuse: tumbleweed has no update repo

As tumbleweed is a rolling release it has not update repository.
---
 templates/lxc-opensuse.in | 37 ++++++++++++++++++++++++-------------
 1 file changed, 24 insertions(+), 13 deletions(-)

diff --git a/templates/lxc-opensuse.in b/templates/lxc-opensuse.in
index edecad5e3..f4a4564e9 100644
--- a/templates/lxc-opensuse.in
+++ b/templates/lxc-opensuse.in
@@ -12,6 +12,7 @@
 # Frederic Crozat <[email protected]>
 # Michael H. Warfield <[email protected]>
 # Johannes Kastl <[email protected]>
+# Thomas Lamprecht <[email protected]>
 
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -138,19 +139,26 @@ download_opensuse()
     # download a mini opensuse into a cache
     echo "Downloading opensuse minimal ..."
     mkdir -p "$cache/partial-$arch-packages"
+
+    oss_repo_url="http://download.opensuse.org/distribution/$DISTRO/repo/oss/";
     if [[ $DISTRO == "tumbleweed" ]]; then
-        zypper --quiet --root $cache/partial-$arch-packages --non-interactive 
ar http://download.opensuse.org/$DISTRO/repo/oss/ repo-oss || return 1
-    else
-        zypper --quiet --root $cache/partial-$arch-packages --non-interactive 
ar http://download.opensuse.org/distribution/$DISTRO/repo/oss/ repo-oss || 
return 1
+        oss_repo_url="http://download.opensuse.org/$DISTRO/repo/oss/";
     fi
+    zypper --quiet --root $cache/partial-$arch-packages --non-interactive ar 
"$oss_repo_url" repo-oss || return 1
+
+    update_repo_url="http://download.opensuse.org/update/$DISTRO/repo/oss";
     # Leap update repos were rearranged
     if [[ $DISTRO == "leap/4"* ]]; then
-        zypper --quiet --root $cache/partial-$arch-packages --non-interactive 
ar http://download.opensuse.org/update/$DISTRO/oss/ update || return 1
-    else
-        zypper --quiet --root $cache/partial-$arch-packages --non-interactive 
ar http://download.opensuse.org/update/$DISTRO/ update || return 1
+        update_repo_url="http://download.opensuse.org/update/$DISTRO/oss/";
+    fi
+    # tumbleweed has no update repo
+    if [[ $DISTRO != "tumbleweed" ]]; then
+        zypper --quiet --root $cache/partial-$arch-packages --non-interactive 
ar "$update_repo_url" update || return 1
     fi
-       zypper --quiet --root $cache/partial-$arch-packages --non-interactive 
--gpg-auto-import-keys update || return 1
+
+    zypper --quiet --root $cache/partial-$arch-packages --non-interactive 
--gpg-auto-import-keys update || return 1
     zypper --root $cache/partial-$arch-packages --non-interactive in 
--auto-agree-with-licenses --download-only zypper lxc patterns-openSUSE-base 
bash iputils sed tar rsyslog || return 1
+
     cat > $cache/partial-$arch-packages/opensuse.conf << EOF
 Preinstall: aaa_base bash coreutils diffutils
 Preinstall: filesystem fillup glibc grep insserv-compat perl-base
@@ -207,13 +215,16 @@ EOF
     # openSUSE 13.2 has no noarch directory in update
     [ -d $cache/partial-$arch-packages/var/cache/zypp/packages/update/noarch ] 
|| mkdir -p $cache/partial-$arch-packages/var/cache/zypp/packages/update/noarch
 
-    CLEAN_BUILD=1 BUILD_ARCH="$arch" BUILD_ROOT="$cache/partial-$arch" 
BUILD_DIST="$cache/partial-$arch-packages/opensuse.conf" 
PATH="$PATH:$BUILD_DIR" $BUILD_DIR/init_buildsystem  --clean --configdir 
$BUILD_DIR/configs --cachedir $cache/partial-$arch-cache --repository 
$cache/partial-$arch-packages/var/cache/zypp/packages/repo-oss/suse/$arch 
--repository 
$cache/partial-$arch-packages/var/cache/zypp/packages/repo-oss/suse/noarch 
--repository $cache/partial-$arch-packages/var/cache/zypp/packages/update/$arch 
--repository 
$cache/partial-$arch-packages/var/cache/zypp/packages/update/noarch || return 1
-    chroot $cache/partial-$arch /usr/bin/zypper --quiet --non-interactive ar 
http://download.opensuse.org/distribution/$DISTRO/repo/oss repo-oss || return 1
+    repos=("--repository" 
"$cache/partial-$arch-packages/var/cache/zypp/packages/repo-oss/suse/$arch" 
"--repository" 
"$cache/partial-$arch-packages/var/cache/zypp/packages/repo-oss/suse/noarch")
+    if [[ $DISTRO != "tumbleweed" ]]; then # tumbleweed has no update repo
+       repos+=("--repository" 
"$cache/partial-$arch-packages/var/cache/zypp/packages/update/$arch" 
"--repository" 
"$cache/partial-$arch-packages/var/cache/zypp/packages/update/noarch")
+    fi
 
-    if [[ $DISTRO == "leap/4"* ]]; then
-        chroot $cache/partial-$arch /usr/bin/zypper --quiet --non-interactive 
ar http://download.opensuse.org/update/$DISTRO/oss update || return 1
-    else
-        chroot $cache/partial-$arch /usr/bin/zypper --quiet --non-interactive 
ar http://download.opensuse.org/update/$DISTRO/ update || return 1
+    CLEAN_BUILD=1 BUILD_ARCH="$arch" BUILD_ROOT="$cache/partial-$arch" 
BUILD_DIST="$cache/partial-$arch-packages/opensuse.conf" 
PATH="$PATH:$BUILD_DIR" $BUILD_DIR/init_buildsystem  --clean --configdir 
$BUILD_DIR/configs --cachedir $cache/partial-$arch-cache ${repos[*]} || return 1
+
+    chroot $cache/partial-$arch /usr/bin/zypper --quiet --non-interactive ar 
"$oss_repo_url" repo-oss || return 1
+    if [[ $DISTRO != "tumbleweed" ]]; then
+        chroot $cache/partial-$arch /usr/bin/zypper --quiet --non-interactive 
ar "$update_repo_url" update || return 1
     fi
 
 #   really clean the image

From a2ee37d3896d9e1923884d1499561e6d16d0ec4d Mon Sep 17 00:00:00 2001
From: Thomas Lamprecht <[email protected]>
Date: Tue, 1 Aug 2017 07:48:21 +0200
Subject: [PATCH 2/4] templates/opensuse: fix tumbleweed software selection

tumbleweed needs a newer version for a few packages, namely:
* liblua5_3
* bncurses6
* breadline7

As Leap it also has no dhcpd, but udhcp which gets pulled in already.
Further iproute2 and net-tools need manual instalation.
---
 templates/lxc-opensuse.in | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/templates/lxc-opensuse.in b/templates/lxc-opensuse.in
index f4a4564e9..9f3a827be 100644
--- a/templates/lxc-opensuse.in
+++ b/templates/lxc-opensuse.in
@@ -162,10 +162,10 @@ download_opensuse()
     cat > $cache/partial-$arch-packages/opensuse.conf << EOF
 Preinstall: aaa_base bash coreutils diffutils
 Preinstall: filesystem fillup glibc grep insserv-compat perl-base
-Preinstall: libbz2-1 libncurses5 pam
-Preinstall: permissions libreadline6 rpm sed tar libz1 libselinux1
+Preinstall: libbz2-1 pam
+Preinstall: permissions rpm sed tar libz1 libselinux1
 Preinstall: liblzma5 libcap2 libacl1 libattr1
-Preinstall: libpopt0 libelf1 liblua5_1
+Preinstall: libpopt0 libelf1
 Preinstall: libpcre1
 
 RunScripts: aaa_base
@@ -178,7 +178,7 @@ Support: iputils
 Support: udev
 Support: netcfg
 Support: hwinfo insserv-compat module-init-tools openSUSE-release openssh
-Support: pwdutils rpcbind sysconfig
+Support: pwdutils sysconfig
 
 Ignore: rpm:suse-build-key,build-key
 Ignore: systemd:systemd-presets-branding
@@ -189,16 +189,21 @@ EOF
        echo "Support: python3-base" >> 
$cache/partial-$arch-packages/opensuse.conf
     fi
 
-    # dhcpcd is not in the default repos since Leap 42.1
-    if [[ $DISTRO != "leap/4"* ]]
-    then
-    echo "Support: dhcpcd" >> $cache/partial-$arch-packages/opensuse.conf
+    if [[ $DISTRO == "tumbleweed" ]]; then
+       echo "Preinstall: liblua5_3 libncurses6 libreadline7" >> 
$cache/partial-$arch-packages/opensuse.conf
+    else
+       echo "Preinstall: liblua5_1 libncurses5 libreadline6" >> 
$cache/partial-$arch-packages/opensuse.conf
+       echo "Support: rpcbind" >> $cache/partial-$arch-packages/opensuse.conf
     fi
 
-    # Leap doesn't seem to have iproute2 utils installed
-    if [[ $DISTRO == "leap/4"* ]]
-    then
-    echo "Support: net-tools iproute2" >> 
$cache/partial-$arch-packages/opensuse.conf
+    # dhcpcd is not in the default repos since Leap 42.1, neither in tumbleweed
+    if [[ $DISTRO != "leap/4"* ]] && [[ $DISTRO != "tumbleweed" ]]; then
+        echo "Support: dhcpcd" >> $cache/partial-$arch-packages/opensuse.conf
+    fi
+
+    # Leap and tumbleweed doesn't seem to have iproute2 utils installed
+    if [[ $DISTRO == "leap/4"* ]] || [[ $DISTRO == "tumbleweed" ]]; then
+        echo "Support: net-tools iproute2" >> 
$cache/partial-$arch-packages/opensuse.conf
     fi
 
     if [ "$arch" = "i686" ]; then

From 1c477b6844728fbee26e5cf6df5ddf07ed198453 Mon Sep 17 00:00:00 2001
From: Thomas Lamprecht <[email protected]>
Date: Tue, 1 Aug 2017 08:03:07 +0200
Subject: [PATCH 3/4] templates/opensuse: getty.target.wants does not always
 exists

---
 templates/lxc-opensuse.in | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/templates/lxc-opensuse.in b/templates/lxc-opensuse.in
index 9f3a827be..2cb6be6db 100644
--- a/templates/lxc-opensuse.in
+++ b/templates/lxc-opensuse.in
@@ -102,8 +102,10 @@ EOF
     ln -s /dev/null 
$rootfs/etc/systemd/system/proc-sys-fs-binfmt_misc.automount
     ln -s /dev/null $rootfs/etc/systemd/system/console-shell.service
     ln -s /dev/null $rootfs/etc/systemd/system/systemd-vconsole-setup.service
+    # enable getty and console services
     sed -e 's/ConditionPathExists=.*//' 
$rootfs/usr/lib/systemd/system/[email protected] > 
$rootfs/etc/systemd/system/[email protected]
     ln -s [email protected] $rootfs/etc/systemd/system/[email protected]
+    mkdir -p $rootfs/etc/systemd/system/getty.target.wants/
     ln -s ../[email protected] 
$rootfs/etc/systemd/system/getty.target.wants/[email protected]
     ln -s -f ../[email protected] 
$rootfs/etc/systemd/system/getty.target.wants/[email protected]
     ln -s ../[email protected] 
$rootfs/etc/systemd/system/getty.target.wants/[email protected]

From f2f16204b6fa33a05439c79722c6e600e6db4d6b Mon Sep 17 00:00:00 2001
From: Thomas Lamprecht <[email protected]>
Date: Tue, 1 Aug 2017 08:03:41 +0200
Subject: [PATCH 4/4] templates/opensuse: support leap 42.3

---
 templates/lxc-opensuse.in | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/templates/lxc-opensuse.in b/templates/lxc-opensuse.in
index 2cb6be6db..c2480dd60 100644
--- a/templates/lxc-opensuse.in
+++ b/templates/lxc-opensuse.in
@@ -500,7 +500,11 @@ else
         42.2|leap/42.2|422)
             echo "Selected openSUSE Leap 42.2"
             DISTRO="leap/42.2"
-            ;; 
+            ;;
+        42.3|leap/42.3|423)
+            echo "Selected openSUSE Leap 42.3"
+            DISTRO="leap/42.3"
+            ;;
         tumbleweed|factory)
             echo "Selected openSUSE Leap Tumbleweed"
             DISTRO="tumbleweed"
_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to