#note: DISTRO_BINARY_COMPAT and DISTRO_FILE_PREFIX are visible here, exported in 2createpackages.
#140117 xARCHDIR, ARCHDIR and DISTRO_ARCHDIR_SYMLINKS exported in 2createpackages. 
#140117 note, 2createpackages may move /lib, /usr/lib, /usr/bin in template to ARCHDIR subdir.
#140202 generic fix to find libcap

#slack pup, cdrecord needs this...
#er no, slackware is a nuisance, libcap.so.2 does not exist until
#post-install script runs, which is after this script!!!!
#ln -s libcap.so.2 lib/libcap.so.1 2>/dev/null

LIBCAPFND="$(find lib usr/lib -maxdepth 2 -type f -name 'libcap.so.*' | head -n 1)"
if [ "$LIBCAPFND" ];then
 LIBCAPDIR="$(dirname $LIBCAPFND)"
 LIBCAPNAME="$(basename $LIBCAPFND)"
 [ ! -e ${LIBCAPDIR}/libcap.so.1 ] && ln -s ${LIBCAPNAME} ${LIBCAPDIR}/libcap.so.1
fi

##t2 build has them in usr/lib
#if [ "$xARCHDIR" ];then #140117
# [ -e usr/lib/${ARCHDIR}/libcap.so.2 ] && ln -s libcap.so.2 usr/lib/${ARCHDIR}/libcap.so.1
#fi
#[ -e usr/lib/libcap.so.2 ] && ln -s libcap.so.2 usr/lib/libcap.so.1
