Fix chroot internal symlinks path

This patch makes sure ${ROOTDIR} is always an absolute path. This
is requested for the absolute symlink conversion step to work
properly.
This commit is contained in:
Gilles Filippini 2012-10-08 10:07:32 +02:00 committed by josch
parent edfb6e34e1
commit 83ba112abb

View file

@ -73,7 +73,7 @@ BOARD="$1"
# overwrite target options by commandline options # overwrite target options by commandline options
SUITE=${_SUITE:-$SUITE} SUITE=${_SUITE:-$SUITE}
ARCH=${_ARCH:-$ARCH} ARCH=${_ARCH:-$ARCH}
ROOTDIR=${_ROOTDIR:-$ROOTDIR} ROOTDIR=$(readlink -m ${_ROOTDIR:-$ROOTDIR})
MIRROR=${_MIRROR:-$MIRROR} MIRROR=${_MIRROR:-$MIRROR}
if [ "$_PACKAGES" = "" ] && [ -r "$BOARD/packages" ]; then if [ "$_PACKAGES" = "" ] && [ -r "$BOARD/packages" ]; then
@ -130,7 +130,7 @@ for link in `find $ROOTDIR -type l`; do
if [ "${target%%/*}" = "" ]; then # target begins with slash if [ "${target%%/*}" = "" ]; then # target begins with slash
echo "I: convert symlink: ${link#$ROOTDIR} -> $target" echo "I: convert symlink: ${link#$ROOTDIR} -> $target"
rm $link rm $link
ln -s $ROOTDIR/$target $link ln -s ${ROOTDIR}$target $link
fi fi
done done
@ -175,6 +175,7 @@ rm $ROOTDIR/usr/sbin/policy-rc.d
# need to generate tar inside fakechroot so that absolute symlinks are correct # need to generate tar inside fakechroot so that absolute symlinks are correct
# tar is clever enough to not try and put the archive inside itself # tar is clever enough to not try and put the archive inside itself
echo "I: create tarball $ROOTDIR.tar" TARBALL=$(basename $ROOTDIR).tar
fakechroot chroot $ROOTDIR tar -cf $ROOTDIR.tar -C / . echo "I: create tarball $TARBALL"
mv $ROOTDIR/$ROOTDIR.tar . fakechroot chroot $ROOTDIR tar -cf $TARBALL -C / .
mv $ROOTDIR/$TARBALL .