From 30309048d88ecb66ef2bb8a0ec194cd0843d000f Mon Sep 17 00:00:00 2001 From: Stefan Fiedler Date: Wed, 18 Nov 2009 10:45:16 +0000 Subject: [PATCH] Stefan Fiedler: scripts/Build-Pkg: revert parts of previous patch, setting up the root directory may be necessary even if not chrooting [2008101921233527519] (https://www.rocklinux.net/submaster) git-svn-id: http://www.rocklinux.org/svn/rock-linux/trunk@9480 c5f82cb5-29bc-0310-9cd0-bff59a50e3bc --- scripts/Build-Pkg | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/Build-Pkg b/scripts/Build-Pkg index 6b2e57cb1..40f2139f6 100755 --- a/scripts/Build-Pkg +++ b/scripts/Build-Pkg @@ -192,7 +192,8 @@ builddir="$base/src.$xpkg.$id" # Set permissions and ownership of $buildir; $base/build might have different ones. mkdir -p "$builddir"; chmod 700 "$builddir" ; chown 0:0 "$builddir" -if [ "$chroot" = 1 ] ; then +# Set up the $root/ROCK directory even if not chrooting, it is needed for e.g. dummydir. +if [ "$root" -a "$this_is_the_2nd_run" = 0 ] ; then pushd "$xroot/" >/dev/null || exit 1 realconf=$(cd $base/config; pwd -P) @@ -202,6 +203,8 @@ if [ "$chroot" = 1 ] ; then if [ ! -e ROCK/loop/scripts ]; then mkdir -p ROCK/{loop,config,download} mount --bind $realbase $PWD/ROCK/loop + # bind mount config and download too so they can be symlinks to + # directories outside of $base. mount --bind $realconf $PWD/ROCK/config mount --bind $realdown $PWD/ROCK/download fi @@ -221,7 +224,9 @@ if [ "$chroot" = 1 ] ; then ln -sf loop/src.$xpkg.$id ROCK/src.$xpkg.$id popd >/dev/null +fi +if [ "$chroot" = 1 ] ; then cd "$xroot" || exit 1 x_mknod() { @@ -549,7 +554,9 @@ rm -f $root/var/adm/logs/$stagelevel-$xpkg.{out,log,err} if [ -z "$root" ] ; then dummydir="$builddir/rootdummy" else - dummydir="${root}/ROCK/${builddir#$base/}/rootdummy" + # dummydir must be a subdirectory of $root so that the DESTDIR make + # option works without change. + dummydir="${root}/ROCK/src.$xpkg.$id/rootdummy" fi mkdir -p "$dummydir"