# of the thisBinDir to a colon-separated list of the pathnames of
# the directories that contain those executables.
-mydir=$(readlink -f $(dirname $0))
+# mydir is the "canonical" absolute pathname for install.sh
+mydir=$(cd -P $(dirname $0) && pwd -P) || exit 1
+
thisLocatingRules=$mydir/locatingrules.xml
thisXmlCatalog=$mydir/catalog.xml
thisSgmlCatalog=$mydir/catalog
+
# .urilist file contains a list of pairs of local pathnames and
# URIs to test for catalog resolution
thisUriList=$mydir/.urilist
writeUninstallFile() {
uninstallFile=$mydir/uninstall.sh
- echo "#!/bin/bash" > $uninstallFile || exit 1
- echo "mydir=\$(readlink -f \$(dirname \$0))" >> $uninstallFile || exit 1
+ echo '#!/bin/bash' > $uninstallFile || exit 1
+ echo 'mydir=$(cd -P $(dirname $0) && pwd -P)' >> $uninstallFile || exit 1
echo "\$mydir/install.sh \\" >> $uninstallFile || exit 1
echo " --uninstall \\" >> $uninstallFile || exit 1
echo " --catalogManager=$myCatalogManager \\" >> $uninstallFile || exit 1
- echo " --dotEmacs=$myEmacsFile \\" >> $uninstallFile || exit 1
- echo " \$@" >> $uninstallFile || exit 1
+ echo " --dotEmacs='$myEmacsFile' \\" >> $uninstallFile || exit 1
+ echo ' $@' >> $uninstallFile || exit 1
chmod 755 $uninstallFile || exit 1
}
writeTestFile() {
testFile=$mydir/test.sh
echo "#!/bin/bash" > $testFile || exit 1
- echo "mydir=\$(readlink -f \$(dirname \$0))" >> $testFile || exit 1
- echo "\$mydir/install.sh --test" >> $testFile || exit 1
+ echo 'mydir=$(cd -P $(dirname $0) && pwd -P)' >> $testFile || exit 1
+ echo '$mydir/install.sh --test' >> $testFile || exit 1
chmod 755 $testFile || exit 1
}
}
testCatalogs() {
- readlinkResponse="$(readlink -f . 2>/dev/null)"
- if [ -z "$readlinkResponse" ]; then
- cat 1>&2 <<EOF
-
-FATAL: Cannot locate the "readlink" command. Stopping.
-EOF
- exit
- fi
-
if [ ! -f "$thisXmlCatalog" ]; then
cat 1>&2 <<EOF
EOF
else
emit_message "Testing with xmlcatalog..."
+ # read in pathname-uri pairs from .urilist file
while read pair; do
- path=$(readlink -f "$mydir/${pair%* *}")
+ if [ ! "${pair%* *}" = "." ]; then
+ path=$mydir/${pair%* *}
+ else
+ path=$mydir/
+ fi
uri=${pair#* *}
emit_message
emit_message " Tested: $uri"
for catalog in $XML_CATALOG_FILES; do
- response="$(readlink -f "$(xmlcatalog $catalog $uri| grep -v "No entry")")"
+ response="$(xmlcatalog $catalog $uri| grep -v "No entry")"
if [ -n "$response" ]; then
if [ "$response" = "$path" ]; then
emit_message " Result: $path"
else
emit_message
emit_message "Testing with Apache XML Commons Resolver..."
+ # read in pathname-uri pairs from .urilist file
while read pair; do
- path=$(readlink -f "$mydir/${pair%* *}")
+ if [ ! "${pair%* *}" = "." ]; then
+ path=$mydir/${pair%* *}
+ else
+ path=$mydir/
+ fi
uri=${pair#* *}
emit_message
emit_message " Tested: $uri"