lxc-opensuse: template now understands release arguments

Signed-off-by: Johannes Kastl <git@ojkastl.de>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
This commit is contained in:
Johannes Kastl 2014-11-06 16:24:40 +01:00 committed by Stéphane Graber
parent 3726cda21a
commit 2e7a16a5a5

View 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