]> git.proxmox.com Git - mirror_lxc.git/commitdiff
lxc-opensuse: template now understands release arguments
authorJohannes Kastl <mail@ojkastl.de>
Thu, 6 Nov 2014 15:24:40 +0000 (16:24 +0100)
committerStéphane Graber <stgraber@ubuntu.com>
Tue, 25 Nov 2014 19:31:48 +0000 (14:31 -0500)
Signed-off-by: Johannes Kastl <git@ojkastl.de>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
templates/lxc-opensuse.in

index c4dce5defb923d70b2c061eba3015b18ab187675..7149e42b424d28d174b87cc2ee755e256c0e07ee 100644 (file)
@@ -39,8 +39,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
@@ -164,6 +162,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
@@ -175,6 +179,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
@@ -219,7 +226,7 @@ copy_opensuse()
 
 install_opensuse()
 {
-    cache="@LOCALSTATEDIR@/cache/lxc/opensuse"
+    cache="@LOCALSTATEDIR@/cache/lxc/opensuse/$DISTRO"
     rootfs=$1
     mkdir -p @LOCALSTATEDIR@/lock/subsys/
     (
@@ -379,7 +386,7 @@ EOF
 # Make arch a global.  This may become configurable?
 arch=$(uname -m)
 
-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
@@ -393,6 +400,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 ;;
@@ -415,6 +423,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