diff options
Diffstat (limited to 'build-recipe-kiwi')
-rw-r--r-- | build-recipe-kiwi | 51 |
1 files changed, 38 insertions, 13 deletions
diff --git a/build-recipe-kiwi b/build-recipe-kiwi index 95afd3f..7c18460 100644 --- a/build-recipe-kiwi +++ b/build-recipe-kiwi @@ -1,8 +1,25 @@ # # KIWI specific functions. Handle with care. # -# (C) 2014 SUSE, Inc +################################################################ # +# Copyright (c) 1995-2014 SUSE Linux Products GmbH +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 or 3 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program (see the file COPYING); if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +# +################################################################ ############################################################ @@ -260,6 +277,10 @@ recipe_setup_kiwi() { cleanup_and_exit 1 fi fi + + # extract macros from configuration + # some post scripts might call rpm-build and rely on the macros + queryconfig rawmacros --dist "$BUILD_DIST" --archpath "$BUILD_ARCH" --configdir "$CONFIG_DIR" > $BUILD_ROOT/root/.rpmmacros } recipe_prepare_kiwi() { @@ -273,7 +294,7 @@ run_suse_isolinux() { i="${i##*/}" test "$i" = scripts && continue test "$i" != "${i%0}" && continue - chroot $BUILD_ROOT su -c "suse-isolinux $TOPDIR/KIWIROOT/main/$i $TOPDIR/KIWI/$i.iso" - $BUILD_USER + $CHROOT su -c "suse-isolinux $TOPDIR/KIWIROOT/main/$i $TOPDIR/KIWI/$i.iso" - $BUILD_USER done } @@ -302,7 +323,11 @@ build_kiwi_product() { test -e "$i" || continue f=${i##*/} case $f in - *.iso) mv $i $BUILD_ROOT/$TOPDIR/KIWI/. ;; + *.iso) if [ -x /usr/bin/sha256sum ]; then + /usr/bin/sha256sum "$i" > "$i.sha256" + mv "$i.sha256" $BUILD_ROOT/$TOPDIR/KIWI/. + fi + mv "$i" $BUILD_ROOT/$TOPDIR/KIWI/. ;; *.packages) mv $i $BUILD_ROOT/$TOPDIR/OTHER/. ;; *.report) mv $i $BUILD_ROOT/$TOPDIR/OTHER/. ;; scripts) ;; @@ -322,12 +347,12 @@ build_kiwi_appliance() { for imgtype in $imagetype ; do echo "running kiwi --prepare for $imgtype..." # Do not use $BUILD_USER here, since we always need root permissions - chroot $BUILD_ROOT su -c "cd $TOPDIR/SOURCES && kiwi --prepare $TOPDIR/SOURCES --logfile terminal --root $TOPDIR/KIWIROOT-$imgtype $KIWI_PARAMETERS" - root < /dev/null || cleanup_and_exit 1 + $CHROOT su -c "cd $TOPDIR/SOURCES && kiwi --prepare $TOPDIR/SOURCES --logfile terminal --root $TOPDIR/KIWIROOT-$imgtype $KIWI_PARAMETERS" - root < /dev/null || cleanup_and_exit 1 echo "running kiwi --create for $imgtype..." mkdir -p $BUILD_ROOT/$TOPDIR/KIWI-$imgtype - chroot $BUILD_ROOT su -c "cd $TOPDIR/SOURCES && kiwi --create $TOPDIR/KIWIROOT-$imgtype --logfile terminal --type $imgtype -d $TOPDIR/KIWI-$imgtype $KIWI_PARAMETERS" - root < /dev/null || cleanup_and_exit 1 + $CHROOT su -c "cd $TOPDIR/SOURCES && kiwi --create $TOPDIR/KIWIROOT-$imgtype --logfile terminal --type $imgtype -d $TOPDIR/KIWI-$imgtype $KIWI_PARAMETERS" - root < /dev/null || cleanup_and_exit 1 rm -rf "/$TOPDIR/KIWI.bundle" - if chroot $BUILD_ROOT su -c "kiwi --bundle-build $TOPDIR/KIWI-$imgtype -d /$TOPDIR/KIWI.bundle/ --bundle-id Build$RELEASE" - root < /dev/null; then + if $CHROOT su -c "kiwi --bundle-build $TOPDIR/KIWI-$imgtype -d /$TOPDIR/KIWI.bundle/ --bundle-id Build$RELEASE" - root < /dev/null; then mv "$BUILD_ROOT/$TOPDIR/KIWI.bundle/"* "$BUILD_ROOT/$TOPDIR/KIWI/" || cleanup_and_exit 1 rmdir "$BUILD_ROOT/$TOPDIR/KIWI.bundle" unset RUN_BUNDLE @@ -376,7 +401,7 @@ build_kiwi_appliance() { cp "$imageout.verified" "/$TOPDIR/OTHER/$imageout$buildnum-$imgtype.verified" fi EOF - chroot $BUILD_ROOT su -c "sh -e /kiwi_post.sh" || cleanup_and_exit 1 + $CHROOT su -c "sh -e /kiwi_post.sh" || cleanup_and_exit 1 rm -f $BUILD_ROOT/kiwi_post.sh done } @@ -405,10 +430,10 @@ recipe_build_kiwi() { fi if test "$imagetype" != product -a "$DO_INIT" != "false" ; then echo "creating repodata for $repo" - if chroot $BUILD_ROOT createrepo --no-database --simple-md-filenames --help >/dev/null 2>&1 ; then - chroot $BUILD_ROOT createrepo --no-database --simple-md-filenames "$repo" + if $CHROOT createrepo --no-database --simple-md-filenames --help >/dev/null 2>&1 ; then + $CHROOT createrepo --no-database --simple-md-filenames "$repo" else - chroot $BUILD_ROOT createrepo "$repo" + $CHROOT createrepo "$repo" fi fi done @@ -417,7 +442,7 @@ recipe_build_kiwi() { for t in $BUILD_ROOT/$TOPDIR/SOURCES/root.tar* ; do test -f $t || continue mkdir -p $BUILD_ROOT/$TOPDIR/SOURCES/root - chroot $BUILD_ROOT tar -C $TOPDIR/SOURCES/root -xf "$TOPDIR/SOURCES/${t##*/}" + $CHROOT tar -C $TOPDIR/SOURCES/root -xf "$TOPDIR/SOURCES/${t##*/}" done # fix script permissions @@ -433,7 +458,7 @@ recipe_build_kiwi() { for t in $r/root.tar* ; do test -f $t || continue mkdir -p $r/root - chroot $BUILD_ROOT tar -C $TOPDIR/SOURCES/images/$r/root -xf "$TOPDIR/SOURCES/images/$r/${t##*/}" + $CHROOT tar -C $TOPDIR/SOURCES/images/$r/root -xf "$TOPDIR/SOURCES/images/$r/${t##*/}" done # fix script permissions chmod a+x $BUILD_ROOT/$TOPDIR/SOURCES/images/$r/*.sh 2>/dev/null @@ -460,7 +485,7 @@ recipe_build_kiwi() { # Hook for running post kiwi build scripts like QA scripts if installed if test -x $BUILD_ROOT/usr/lib/build/kiwi_post_run ; then - chroot $BUILD_ROOT su -c /usr/lib/build/kiwi_post_run || cleanup_and_exit 1 + $CHROOT su -c /usr/lib/build/kiwi_post_run || cleanup_and_exit 1 fi } |