2 # debootstrap specific functions.
4 ################################################################
6 # Copyright (c) 1995-2014 SUSE Linux Products GmbH
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.
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.
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
22 ################################################################
24 recipe_setup_debootstrap() {
28 recipe_prepare_debootstrap() {
29 recipe_prepare_dsc "$@"
32 recipe_build_debootstrap() {
33 local arch=$(chroot $BUILD_ROOT su -c "dpkg-architecture -qDEB_BUILD_ARCH")
34 local dist=$(chroot $BUILD_ROOT su -c "lsb_release --codename --short")
35 local myroot=debootstraproot
36 test -d $BUILD_ROOT/.build.binaries || cleanup_and_exit 1
37 if test "$DO_INIT" = true -o ! -d "$BUILD_ROOT/.build.binaries/dists" ; then
38 echo "creating repository for debootstrap..."
39 createrepo_debian $BUILD_ROOT/.build.binaries ${arch} ${dist}
42 for PKG in $BUILD_ROOT/.build.binaries/*.deb ; do
44 FULL_PKG_LIST="$FULL_PKG_LIST,${PKG%.deb}"
46 FULL_PKG_LIST="${FULL_PKG_LIST#,}"
47 rm -rf "$BUILD_ROOT/$myroot"
48 if chroot $BUILD_ROOT dpkg --force-unsafe-io --version >/dev/null 2>&1 ; then
49 mkdir -p "$BUILD_ROOT/$myroot/etc/dpkg/dpkg.cfg.d"
50 echo force-unsafe-io > "$BUILD_ROOT/$myroot/etc/dpkg/dpkg.cfg.d/force-unsafe-io"
52 set -- chroot $BUILD_ROOT debootstrap --keep-debootstrap-dir --no-check-gpg --variant=buildd --arch="${arch}" --include="$FULL_PKG_LIST" "$dist" "$myroot" file:///.build.binaries
53 echo "running debootstrap..."
54 if ! "$@" || ! chroot $BUILD_ROOT dpkg --configure -a; then
55 cat $BUILD_ROOT/debootstrap/debootstrap.log
56 echo "Failed to setup debootstrap chroot"
61 if test $BUILD_USER = abuild ; then
62 echo "abuild:x:${ABUILD_UID}:${ABUILD_GID}:Autobuild:/home/abuild:/bin/bash" >>$BUILD_ROOT/$myroot/etc/passwd
63 echo 'abuild:*::' >>$BUILD_ROOT/$myroot/etc/gshadow
64 echo "abuild:x:${ABUILD_GID}:" >>$BUILD_ROOT/$myroot/etc/group
65 mkdir -p $BUILD_ROOT/$myroot/home/abuild
66 chown "$ABUILD_UID:$ABUILD_GID" $BUILD_ROOT/$myroot/home/abuild
70 mv "$BUILD_ROOT/$TOPDIR" "$BUILD_ROOT/$myroot/${TOPDIR%/*}"
73 dsc_build "$BUILD_ROOT/$myroot"
76 mv "$BUILD_ROOT/$myroot/$TOPDIR" "$BUILD_ROOT/${TOPDIR%/*}"
82 recipe_resultdirs_debootstrap() {