From 486375ba0aedb185b369946fe565538c0f8e7949 Mon Sep 17 00:00:00 2001 From: Aaron Griffin Date: Mon, 9 Mar 2009 12:22:50 -0700 Subject: makechrootpkg: Don't mount-bind srcdest/pkgdest Do actual copying to and from PKGDEST and SRCDEST rather than mounting via --bind, as the chown and other operations can cause issues here Original-work-by: Phil Dillon-Thiselton Signed-off-by: Aaron Griffin --- makechrootpkg | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'makechrootpkg') diff --git a/makechrootpkg b/makechrootpkg index 475e398..0411983 100755 --- a/makechrootpkg +++ b/makechrootpkg @@ -164,18 +164,13 @@ fi source $uniondir/etc/makepkg.conf -# Magic trickery with PKGDEST and SRCDEST, so that the built -# files end up where they're expected in the _real_ filesystem -[ -d "$uniondir/srcdest" ] || mkdir "$uniondir/srcdest" [ -d "$uniondir/pkgdest" ] || mkdir "$uniondir/pkgdest" -[ ! -z "$PKGDEST" ] && mount --bind "$PKGDEST" "$uniondir/pkgdest" -[ ! -z "$SRCDEST" ] && mount --bind "$SRCDEST" "$uniondir/srcdest" - if ! grep "PKGDEST=/pkgdest" "$uniondir/etc/makepkg.conf" >/dev/null 2>&1; then echo "Setting PKGDEST in makepkg.conf" echo "PKGDEST=/pkgdest" >> "$uniondir/etc/makepkg.conf" fi +[ -d "$uniondir/srcdest" ] || mkdir "$uniondir/srcdest" if ! grep "SRCDEST=/srcdest" "$uniondir/etc/makepkg.conf" >/dev/null 2>&1; then echo "Setting SRCDEST in makepkg.conf" echo "SRCDEST=/srcdest" >> "$uniondir/etc/makepkg.conf" @@ -192,6 +187,8 @@ for f in ${source[@]}; do basef=$(echo $f | sed 's|::.*||' | sed 's|^.*://.*/||g') if [ -f "$basef" ]; then cp "$basef" "$uniondir/srcdest/" + elif [ -f "$SRCDEST/$basef" ]; then + cp "$SRCDEST/$basef" "$uniondir/srcdest/" fi done if [ "$install" != "" -a -f "$install" ]; then @@ -236,15 +233,25 @@ if mkarchroot -r "/chrootbuild" "$uniondir"; then local pkgfile=${chrootdir}/union/pkgdest/${pkgname}-${pkgver}-${pkgrel}-*.pkg.tar.gz if [ -z "$(mount | grep ${chrootdir}/union/pkgdest)" ]; then if [ -e "$pkgfile" ]; then - echo "Moving completed package file to ${WORKDIR}" - mv "$pkgfile" "${WORKDIR}" + if [ -n "$PKGDEST" ]; then + echo "Moving completed package file to ${PKGDEST}" + mv "$pkgfile" "${PKGDEST}" + else + echo "Moving completed package file to ${WORKDIR}" + mv "$pkgfile" "${WORKDIR}" + fi fi fi if [ -z "$(mount | grep ${chrootdir}/union/srcdest)" ]; then for f in ${chrootdir}/union/srcdest/*; do [ -e "$f" ] || continue - echo "Moving downloaded source file ($(basename $f) to ${WORKDIR}" - mv "$f" "${WORKDIR}" + if [ -n "$SRCDEST" ]; then + echo "Moving downloaded source file ($(basename $f) to ${SRCDEST}" + mv "$f" "${SRCDEST}" + else + echo "Moving downloaded source file ($(basename $f) to ${WORKDIR}" + mv "$f" "${WORKDIR}" + fi done fi else -- cgit v1.2.3-24-g4f1b