Commit 44ee8a10 by Frederic Crozat Committed by Daniel Lezcano

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: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
parent 5fe95ad1
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
# License along with this library; if not, write to the Free Software # License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
DISTRO=11.4 DISTRO=12.1
configure_opensuse() configure_opensuse()
{ {
...@@ -106,28 +106,11 @@ cons:2345:respawn:/sbin/mingetty --noclear console screen ...@@ -106,28 +106,11 @@ cons:2345:respawn:/sbin/mingetty --noclear console screen
c1:2345:respawn:/sbin/mingetty --noclear tty1 screen c1:2345:respawn:/sbin/mingetty --noclear tty1 screen
EOF EOF
# patch boot script, no longer needed in openSUSE 12.1 / SLE11-SP2 # set /dev/console as securetty
patch --quiet -d $rootfs/etc/init.d/ << EOF cat << EOF >> $rootfs/etc/securetty
--- boot.orig 2011-05-26 16:03:07.000000000 +0200 console
+++ 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
EOF EOF
cat <<EOF >> $rootfs/etc/sysconfig/boot cat <<EOF >> $rootfs/etc/sysconfig/boot
# disable root fsck # disable root fsck
ROOTFS_FSCK="0" ROOTFS_FSCK="0"
...@@ -136,7 +119,7 @@ EOF ...@@ -136,7 +119,7 @@ EOF
# remove pointless services in a container # 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 "Please change root-password !"
echo "root:root" | chroot $rootfs chpasswd echo "root:root" | chroot $rootfs chpasswd
...@@ -149,6 +132,12 @@ download_opensuse() ...@@ -149,6 +132,12 @@ download_opensuse()
cache=$1 cache=$1
arch=$2 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 # check the mini opensuse was not already downloaded
mkdir -p "$cache/partial-$arch" mkdir -p "$cache/partial-$arch"
...@@ -159,18 +148,50 @@ download_opensuse() ...@@ -159,18 +148,50 @@ download_opensuse()
# download a mini opensuse into a cache # download a mini opensuse into a cache
echo "Downloading opensuse minimal ..." 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" mkdir -p "$cache/partial-$arch/dev"
mknod -m 666 $cache/partial-$arch/dev/null c 1 3 mknod -m 666 $cache/partial-$arch/dev/null c 1 3
mknod -m 666 $cache/partial-$arch/dev/zero c 1 5 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 # create mtab symlink
zypper --quiet --root $cache/partial-$arch --non-interactive ar http://download.opensuse.org/update/$DISTRO/ update rm -f $cache/partial-$arch/etc/mtab
zypper --quiet --root $cache/partial-$arch --non-interactive --gpg-auto-import-keys in --auto-agree-with-licenses -t pattern base ln -sf /proc/self/mounts $cache/partial-$arch/etc/mtab
zypper --quiet --root $cache/partial-$arch --non-interactive --gpg-auto-import-keys in +lxc -kbd -patterns-openSUSE-base
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Failed to download the rootfs, aborting." echo "Failed to download the rootfs, aborting."
return 1 return 1
fi fi
rm -fr "$cache/partial-$arch-packages"
mv "$1/partial-$arch" "$1/rootfs-$arch" mv "$1/partial-$arch" "$1/rootfs-$arch"
echo "Download complete." echo "Download complete."
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment