-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Michael,
hi list,

On 30.10.2014 Michael H. Warfield wrote:

> Most of the templates (Ubuntu, Debian, Fedora, CentOS, Oracle)
> allow for version selection.  If OpenSuSE does not (which it
> apparently does not - I just looked), that is something that needs
> to be addressed.  I think they all suffer from the problem that
> they, by default, install a fixed version and don't track "the
> latest" or "the latest supported", which can be an indeterminant
> value.

Please find attached my patch to enable release selection in the
openSUSE template.

As I cannot (yet) test the template that is in upstream HEAD, my patch
is against the stable-1.0 branch.

Basically it boils down to this:

- - cache is in /var/cache/lxc/opensuse/$DISTRO
- - DISTRO is not set at the beginning, but via argument -r 12.3 or
- --release 13.1 (like the ubuntu template does it)
- - if no -r or --release argument is given, 12.3 is installed (as was
the default before)

13.2 works, but needs two small workarounds:
- - python3-base is added explicitly, otherwise you get an havechoice
error as two packages provide the capability
- - there is no noarch directory in the update repository, but creating
it seemed easier than splitting this monster of a command in version
13.2 and earlier

I tested this with 12.3, 13.1 and 13.2, and all of them worked. At
least creating the container worked. I still have to test if the 13.2
container works, as some networking stuff changed between 13.1 and 13.2.

Comments and Hints highly appreciated.

Regards,
Johannes

P.S.: How would I test the upstream HEAD? I see there has been a lot
of work done in the openSUSE template, but only in master branch, not
in 1.0.x.
- -- 
`Three Dementor attacks in a week, and all Romilda Vane does is ask me
if it's true you've got a Hippogriff tattooed across your chest´ [...]
`I told her it's a hungarian Horntail,´ said Ginny, turning a page of
her newspaper idly.`Much more Macho´ (Ginny Weasley in Harry Potter 6)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
Comment: Using GnuPG with SeaMonkey - http://www.enigmail.net/

iEYEARECAAYFAlRbkrgACgkQzi3gQ/xETbIIaQCeKWJ+OLbFPpuxB8t3l1AgS7tv
eFAAniXPSTrhihIExlLYm/fLiRHZDCDi
=st8m
-----END PGP SIGNATURE-----
From 9116cb6f6c2ee3ded508479e4c360e7e4f990336 Mon Sep 17 00:00:00 2001
From: Johannes Kastl <[email protected]>
Date: Thu, 6 Nov 2014 16:11:38 +0100
Subject: [PATCH] lxc-opensuse template now understands release arguments

Signed-off-by: Johannes Kastl <[email protected]>
---
 templates/lxc-opensuse.in | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/templates/lxc-opensuse.in b/templates/lxc-opensuse.in
index 3999df6..e469989 100644
--- a/templates/lxc-opensuse.in
+++ b/templates/lxc-opensuse.in
@@ -38,8 +38,6 @@ done
 # Make sure the usual locations are in PATH
 export PATH=$PATH:/usr/sbin:/usr/bin:/sbin:/bin
 
-DISTRO=12.3
-
 configure_opensuse()
 {
     rootfs=$1
@@ -163,6 +161,12 @@ Support: pwdutils rpcbind sysconfig
 Ignore: rpm:suse-build-key,build-key
 Ignore: systemd:systemd-presets-branding
 EOF
+
+    if [ $DISTRO = "13.2" ]
+    then
+	echo "Support: python3-base" >> $cache/partial-$arch-packages/opensuse.conf
+    fi
+
     if [ "$arch" = "i686" ]; then
         mkdir -p $cache/partial-$arch-packages/var/cache/zypp/packages/repo-oss/suse/i686/
         for i in "$cache/partial-$arch-packages/var/cache/zypp/packages/repo-oss/suse/i586/*" ; do
@@ -174,6 +178,9 @@ EOF
 	done
     fi
 
+    # 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:/usr/lib/build" /usr/lib/build/init_buildsystem  --clean --configdir /usr/lib/build/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
     chroot $cache/partial-$arch /usr/bin/zypper --quiet --non-interactive ar http://download.opensuse.org/update/$DISTRO/ update || return 1
@@ -218,7 +225,7 @@ copy_opensuse()
 
 install_opensuse()
 {
-    cache="@LOCALSTATEDIR@/cache/lxc/opensuse"
+    cache="@LOCALSTATEDIR@/cache/lxc/opensuse/$DISTRO"
     rootfs=$1
     mkdir -p @LOCALSTATEDIR@/lock/subsys/
     (
@@ -358,7 +365,7 @@ EOF
     return 0
 }
 
-options=$(getopt -o hp:n:c -l help,rootfs:,path:,name:,clean -- "$@")
+options=$(getopt -o hp:n:r:c -l help,rootfs:,path:,name:,release:,clean -- "$@")
 if [ $? -ne 0 ]; then
     usage $(basename $0)
     exit 1
@@ -372,6 +379,7 @@ do
         -p|--path)      path=$2; shift 2;;
         --rootfs)       rootfs=$2; shift 2;;
         -n|--name)      name=$2; shift 2;;
+	-r|--release)   DISTRO=$2; shift 2;;
         -c|--clean)     clean=$2; shift 2;;
         --)             shift 1; break ;;
         *)              break ;;
@@ -394,6 +402,12 @@ if [ -z "$path" ]; then
     exit 1
 fi
 
+if [ -z "$DISTRO" ]; then
+    echo "No release selected, using openSUSE 12.3"
+    DISTRO=12.3
+fi
+
+
 if [ "$(id -u)" != "0" ]; then
     echo "This script should be run as 'root'"
     exit 1
-- 
2.1.3

_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to