506e274eaa
(possibly indirectly) a symbolic link to ${WRKDIRPREFIX}. . Use this script in preference to the direct symbolic link check previously used, as it handles indirections which cause the same problem. . /compat/linux -> ${LINUXBASE} in the message output if the check detects a link. PR: 43602
29 lines
627 B
Bash
29 lines
627 B
Bash
#!/bin/sh
|
|
# $FreeBSD$
|
|
|
|
WRKDIRPREFIX=$1
|
|
LINUXBASE=$2
|
|
|
|
if [ "x${WRKDIRPREFIX}" = "x" -o "x${LINUXBASE}" = "x" ]; then
|
|
exit 0
|
|
fi
|
|
|
|
LINUXWRKDIRPREFIX="${LINUXBASE}/${WRKDIRPREFIX}"
|
|
|
|
while [ "x${LINUXWRKDIRPREFIX}" != "x" ]; do
|
|
if [ -L "${LINUXWRKDIRPREFIX}" -a \
|
|
x`ls -ld "${LINUXWRKDIRPREFIX}" 2>/dev/null | \
|
|
awk '/->/{print $NF;exit 0}END{exit 1}'` = \
|
|
x"${WRKDIRPREFIX}" ]; then
|
|
echo "link"
|
|
exit 1
|
|
fi
|
|
if [ -L "${LINUXWRKDIRPREFIX}" ]; then
|
|
LINUXWRKDIRPREFIX=`ls -ld "${LINUXWRKDIRPREFIX}" 2>/dev/null | \
|
|
awk '/->/{print $NF;exit 0}END{exit 1}'`
|
|
else
|
|
break
|
|
fi
|
|
done
|
|
|
|
exit 0
|