~ubuntu-branches/ubuntu/wily/obs-build/wily

« back to all changes in this revision

Viewing changes to build-recipe-kiwi

  • Committer: Package Import Robot
  • Author(s): Dimitri John Ledkov
  • Date: 2014-10-25 02:30:05 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20141025023005-mu4p5a7tr1razm1h
Tags: 20141024-1
* New upstream snapshot.
* Update copyright, explicit GPL 2 or 3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#
2
2
# KIWI specific functions. Handle with care.
3
3
#
4
 
# (C) 2014 SUSE, Inc
5
 
#
 
4
################################################################
 
5
#
 
6
# Copyright (c) 1995-2014 SUSE Linux Products GmbH
 
7
#
 
8
# This program is free software; you can redistribute it and/or modify
 
9
# it under the terms of the GNU General Public License version 2 or 3 as
 
10
# published by the Free Software Foundation.
 
11
#
 
12
# This program is distributed in the hope that it will be useful,
 
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
# GNU General Public License for more details.
 
16
#
 
17
# You should have received a copy of the GNU General Public License
 
18
# along with this program (see the file COPYING); if not, write to the
 
19
# Free Software Foundation, Inc.,
 
20
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
 
21
#
 
22
################################################################
6
23
 
7
24
 
8
25
############################################################
260
277
            cleanup_and_exit 1
261
278
        fi
262
279
    fi
 
280
 
 
281
    # extract macros from configuration
 
282
    # some post scripts might call rpm-build and rely on the macros
 
283
    queryconfig rawmacros --dist "$BUILD_DIST" --archpath "$BUILD_ARCH" --configdir "$CONFIG_DIR" > $BUILD_ROOT/root/.rpmmacros
263
284
}
264
285
 
265
286
recipe_prepare_kiwi() {
273
294
        i="${i##*/}"
274
295
        test "$i" = scripts && continue
275
296
        test "$i" != "${i%0}" && continue
276
 
        chroot $BUILD_ROOT su -c "suse-isolinux $TOPDIR/KIWIROOT/main/$i $TOPDIR/KIWI/$i.iso" - $BUILD_USER
 
297
        $CHROOT su -c "suse-isolinux $TOPDIR/KIWIROOT/main/$i $TOPDIR/KIWI/$i.iso" - $BUILD_USER
277
298
    done
278
299
}
279
300
 
302
323
        test -e "$i" || continue
303
324
        f=${i##*/}
304
325
        case $f in
305
 
            *.iso) mv $i $BUILD_ROOT/$TOPDIR/KIWI/. ;;
 
326
            *.iso) if [ -x /usr/bin/sha256sum ]; then
 
327
                       /usr/bin/sha256sum "$i" > "$i.sha256"
 
328
                       mv "$i.sha256" $BUILD_ROOT/$TOPDIR/KIWI/.
 
329
                   fi
 
330
                   mv "$i" $BUILD_ROOT/$TOPDIR/KIWI/. ;;
306
331
            *.packages) mv $i $BUILD_ROOT/$TOPDIR/OTHER/. ;;
307
332
            *.report) mv $i $BUILD_ROOT/$TOPDIR/OTHER/. ;;
308
333
            scripts) ;;
322
347
    for imgtype in $imagetype ; do
323
348
        echo "running kiwi --prepare for $imgtype..."
324
349
        # Do not use $BUILD_USER here, since we always need root permissions
325
 
        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
 
350
        $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
326
351
        echo "running kiwi --create for $imgtype..."
327
352
        mkdir -p $BUILD_ROOT/$TOPDIR/KIWI-$imgtype
328
 
        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
 
353
        $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
329
354
        rm -rf "/$TOPDIR/KIWI.bundle"
330
 
        if chroot $BUILD_ROOT su -c "kiwi --bundle-build $TOPDIR/KIWI-$imgtype -d /$TOPDIR/KIWI.bundle/ --bundle-id Build$RELEASE" - root < /dev/null; then
 
355
        if $CHROOT su -c "kiwi --bundle-build $TOPDIR/KIWI-$imgtype -d /$TOPDIR/KIWI.bundle/ --bundle-id Build$RELEASE" - root < /dev/null; then
331
356
            mv "$BUILD_ROOT/$TOPDIR/KIWI.bundle/"* "$BUILD_ROOT/$TOPDIR/KIWI/" || cleanup_and_exit 1
332
357
            rmdir "$BUILD_ROOT/$TOPDIR/KIWI.bundle"
333
358
            unset RUN_BUNDLE
376
401
                    cp "$imageout.verified" "/$TOPDIR/OTHER/$imageout$buildnum-$imgtype.verified"
377
402
                fi
378
403
                EOF
379
 
        chroot $BUILD_ROOT su -c "sh -e /kiwi_post.sh" || cleanup_and_exit 1
 
404
        $CHROOT su -c "sh -e /kiwi_post.sh" || cleanup_and_exit 1
380
405
        rm -f $BUILD_ROOT/kiwi_post.sh
381
406
    done
382
407
}
405
430
        fi
406
431
        if test "$imagetype" != product -a "$DO_INIT" != "false" ; then
407
432
            echo "creating repodata for $repo"
408
 
            if chroot $BUILD_ROOT createrepo --no-database --simple-md-filenames --help >/dev/null 2>&1 ; then
409
 
                chroot $BUILD_ROOT createrepo --no-database --simple-md-filenames "$repo"
 
433
            if $CHROOT createrepo --no-database --simple-md-filenames --help >/dev/null 2>&1 ; then
 
434
                $CHROOT createrepo --no-database --simple-md-filenames "$repo"
410
435
            else
411
 
                chroot $BUILD_ROOT createrepo "$repo"
 
436
                $CHROOT createrepo "$repo"
412
437
            fi
413
438
        fi
414
439
    done
417
442
    for t in $BUILD_ROOT/$TOPDIR/SOURCES/root.tar* ; do
418
443
        test -f $t || continue
419
444
        mkdir -p $BUILD_ROOT/$TOPDIR/SOURCES/root
420
 
        chroot $BUILD_ROOT tar -C $TOPDIR/SOURCES/root -xf "$TOPDIR/SOURCES/${t##*/}"
 
445
        $CHROOT tar -C $TOPDIR/SOURCES/root -xf "$TOPDIR/SOURCES/${t##*/}"
421
446
    done
422
447
 
423
448
    # fix script permissions
433
458
            for t in $r/root.tar* ; do
434
459
                test -f $t || continue
435
460
                mkdir -p $r/root
436
 
                chroot $BUILD_ROOT tar -C $TOPDIR/SOURCES/images/$r/root -xf "$TOPDIR/SOURCES/images/$r/${t##*/}"
 
461
                $CHROOT tar -C $TOPDIR/SOURCES/images/$r/root -xf "$TOPDIR/SOURCES/images/$r/${t##*/}"
437
462
            done
438
463
            # fix script permissions
439
464
            chmod a+x $BUILD_ROOT/$TOPDIR/SOURCES/images/$r/*.sh 2>/dev/null
460
485
 
461
486
    # Hook for running post kiwi build scripts like QA scripts if installed
462
487
    if test -x $BUILD_ROOT/usr/lib/build/kiwi_post_run ; then
463
 
        chroot $BUILD_ROOT su -c /usr/lib/build/kiwi_post_run || cleanup_and_exit 1
 
488
        $CHROOT su -c /usr/lib/build/kiwi_post_run || cleanup_and_exit 1
464
489
    fi
465
490
}
466
491