From a0d4243d1bcb028189e7254681675ba18895ca94 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Fri, 21 Mar 2008 05:12:40 +0000 Subject: [PATCH] in install.sh, replaced use of non-portable "readlink -f" with combination of cd/dirname/pwd that has the same effect. This is a partial fix for #1735710. Thanks to Ivan Vilata i Balaguer. --- releasetools/install.sh | 42 ++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/releasetools/install.sh b/releasetools/install.sh index d195ea32e..48652a322 100755 --- a/releasetools/install.sh +++ b/releasetools/install.sh @@ -41,10 +41,13 @@ # 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 @@ -791,21 +794,21 @@ EOF 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 } @@ -848,15 +851,6 @@ EOF } testCatalogs() { - readlinkResponse="$(readlink -f . 2>/dev/null)" - if [ -z "$readlinkResponse" ]; then - cat 1>&2 <&2 <