aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederic Crozat <fcrozat@suse.com>2011-10-25 11:25:18 +0200
committerDaniel Lezcano <daniel.lezcano@free.fr>2011-10-28 23:55:38 +0200
commit44ee8a102e3d8052631fbb119f58a55ce678d039 (patch)
tree38406d93da4376b6f36ffc4c665920a62fd9a456 /templates
parentDrop resolvconf from oneiric container package list (diff)
downloadlxc-44ee8a102e3d8052631fbb119f58a55ce678d039.tar.gz
lxc-44ee8a102e3d8052631fbb119f58a55ce678d039.tar.bz2
lxc-44ee8a102e3d8052631fbb119f58a55ce678d039.zip
templates: update openSUSE template for openSUSE 12.1
rely on "build" package, to ensure chroot can be created with distribution older than 12.1 Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Diffstat (limited to 'templates')
-rw-r--r--templates/lxc-opensuse.in75
1 files changed, 48 insertions, 27 deletions
diff --git a/templates/lxc-opensuse.in b/templates/lxc-opensuse.in
index 811876a..d30147d 100644
--- a/templates/lxc-opensuse.in
+++ b/templates/lxc-opensuse.in
@@ -25,7 +25,7 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-DISTRO=11.4
+DISTRO=12.1
configure_opensuse()
{
@@ -106,28 +106,11 @@ cons:2345:respawn:/sbin/mingetty --noclear console screen
c1:2345:respawn:/sbin/mingetty --noclear tty1 screen
EOF
- # patch boot script, no longer needed in openSUSE 12.1 / SLE11-SP2
- patch --quiet -d $rootfs/etc/init.d/ << EOF
---- boot.orig 2011-05-26 16:03:07.000000000 +0200
-+++ boot 2011-05-26 16:03:19.000000000 +0200
-@@ -98,12 +98,12 @@
- echo "***************************************************************"
- /sbin/halt -f
- fi
-- echo -n "Mounting devtmpfs at /dev"
-- mount -n -t devtmpfs -o mode=0755 devtmpfs /dev
-- rc_status -v -r
-+# echo -n "Mounting devtmpfs at /dev"
-+# mount -n -t devtmpfs -o mode=0755 devtmpfs /dev
-+# rc_status -v -r
- fi
-
--cp -axT --remove-destination /lib/udev/devices /dev
-+#cp -axT --remove-destination /lib/udev/devices /dev
-
- if test -d /sys/kernel/debug -a "$HAVE_DEBUGFS" = "1" ; then
- mount -n -t debugfs debugfs /sys/kernel/debug > /dev/null 2>&1
+ # set /dev/console as securetty
+ cat << EOF >> $rootfs/etc/securetty
+console
EOF
+
cat <<EOF >> $rootfs/etc/sysconfig/boot
# disable root fsck
ROOTFS_FSCK="0"
@@ -136,7 +119,7 @@ EOF
# remove pointless services in a container
- insserv -r -f -p $rootfs/etc/init.d boot.udev boot.udev_retry boot.md boot.lvm boot.loadmodules boot.device-mapper boot.clock boot.swap boot.klog
+ chroot $rootfs /sbin/insserv -r -f boot.udev boot.loadmodules boot.device-mapper boot.clock boot.swap boot.klog kbd
echo "Please change root-password !"
echo "root:root" | chroot $rootfs chpasswd
@@ -149,6 +132,12 @@ download_opensuse()
cache=$1
arch=$2
+ if [ ! -x /usr/bin/build ]; then
+ echo "Could not create openSUSE template :"
+ echo "you need to install \"build\" package"
+ return 1
+ fi
+
# check the mini opensuse was not already downloaded
mkdir -p "$cache/partial-$arch"
@@ -159,18 +148,50 @@ download_opensuse()
# download a mini opensuse into a cache
echo "Downloading opensuse minimal ..."
+ mkdir -p "$cache/partial-$arch-packages"
+ zypper --quiet --root $cache/partial-$arch-packages --non-interactive ar http://download.opensuse.org/distribution/$DISTRO/repo/oss/ repo-oss
+ zypper --quiet --root $cache/partial-$arch-packages --non-interactive ar http://download.opensuse.org/update/$DISTRO/ update
+ zypper --quiet --root $cache/partial-$arch-packages --non-interactive --gpg-auto-import-keys update
+ zypper --root $cache/partial-$arch-packages --non-interactive in --auto-agree-with-licenses --download-only zypper lxc patterns-openSUSE-base sysvinit-init
+ cat > $cache/partial-$arch-packages/opensuse.conf << EOF
+Preinstall: aaa_base bash coreutils diffutils
+Preinstall: filesystem fillup glibc grep insserv libacl1 libattr1
+Preinstall: libbz2-1 libgcc46 libxcrypt libncurses5 pam
+Preinstall: permissions libreadline6 rpm sed tar zlib libselinux1
+Preinstall: liblzma5 libcap2 libpcre0
+Preinstall: libpopt0 libelf1 liblua5_1
+
+RunScripts: aaa_base
+
+Support: zypper
+Support: patterns-openSUSE-base
+Support: lxc
+Prefer: sysvinit-init
+
+Ignore: patterns-openSUSE-base:patterns-openSUSE-yast2_install_wf
+EOF
+
+ CLEAN_BUILD=1 BUILD_ROOT="$cache/partial-$arch" BUILD_DIST="$cache/partial-$arch-packages/opensuse.conf" /usr/lib/build/init_buildsystem --clean --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
+ chroot $cache/partial-$arch /usr/bin/zypper --quiet --non-interactive ar http://download.opensuse.org/distribution/$DISTRO/repo/oss repo-oss
+ chroot $cache/partial-$arch /usr/bin/zypper --quiet --non-interactive ar http://download.opensuse.org/update/$DISTRO/ update
+ chroot $cache/partial-$arch rpm -e patterns-openSUSE-base
+ umount $cache/partial-$arch/proc
+# really clean the image
+ rm -fr $cache/partial-$arch/{.build,.guessed_dist,.srcfiles*,installed-pkg}
+ rm -fr $cache/partial-$arch/dev
+# make sure we have a minimal /dev
mkdir -p "$cache/partial-$arch/dev"
mknod -m 666 $cache/partial-$arch/dev/null c 1 3
mknod -m 666 $cache/partial-$arch/dev/zero c 1 5
- zypper --quiet --root $cache/partial-$arch --non-interactive ar http://download.opensuse.org/distribution/$DISTRO/repo/oss/ repo-oss
- zypper --quiet --root $cache/partial-$arch --non-interactive ar http://download.opensuse.org/update/$DISTRO/ update
- zypper --quiet --root $cache/partial-$arch --non-interactive --gpg-auto-import-keys in --auto-agree-with-licenses -t pattern base
- zypper --quiet --root $cache/partial-$arch --non-interactive --gpg-auto-import-keys in +lxc -kbd -patterns-openSUSE-base
+# create mtab symlink
+ rm -f $cache/partial-$arch/etc/mtab
+ ln -sf /proc/self/mounts $cache/partial-$arch/etc/mtab
if [ $? -ne 0 ]; then
echo "Failed to download the rootfs, aborting."
return 1
fi
+ rm -fr "$cache/partial-$arch-packages"
mv "$1/partial-$arch" "$1/rootfs-$arch"
echo "Download complete."