if [ ! "${*#--batch}" = "$*" ]; then
batchmode="Yes";
- echo "Using batch mode."
else
batchmode="No";
+ echo
+ if [ ! "$1" = "--test" ]; then
+ echo "NOTE: For non-interactive installs/uninstalls, use --batch"
+ if [ ! "$1" = "--uninstall" ]; then
+ echo
+ fi
+ fi
fi
osName=$(uname -o)
EOF
fi
fi
+ if [ "$batchmode" = "Yes" ]; then
+ echo
+ fi
# end of check for existing writable CatalogManager.properties
if [ -f $thisCatalogManager ]; then
REPLY=""
if [ ! "$batchmode" = "Yes" ]; then
echo
- read -s -n1 -p "Add $thisJavaXmlCatalog to $myCatalogManager file? [Yes] "
+ echo "Add $thisJavaXmlCatalog"
+ read -s -n1 -p "to $myCatalogManager file? [Yes] "
echo "$REPLY"
echo
fi
}
updateUserStartupFiles() {
+ if [ ! "$batchmode" = "Yes" ]; then
cat <<EOF
NOTE: To source your environment correctly for using the catalog
you can make the changes manually.
EOF
+ else
+ echo
+ fi
# if user is running csh or tcsh, target .cshrc and .tcshrc
# files for update; otherwise, target .bash_* and .profiles
cp $dotFileBackup $HOME/$file || exit 1
echo "$appendLine" >> $HOME/$file || exit 1
cat <<EOF
-
NOTE: $HOME/$file file successfully updated.
Backup written to $dotFileBackup
+
EOF
else
cat <<EOF
-
NOTE: $HOME/$file already contains information for this distribution.
$HOME/$file not updated.
fi
done
if [ -z "$dotFileBackup" ]; then
+ if [ ! "$batchmode" = "Yes" ]; then
+ echo
+ fi
cat <<EOF
-
NOTE: No shell startup files updated. You can source the
environment for this distribution manually, each time you
want to use it, by typing the following.
}
uninstall() {
+ if [ ! "$batchmode" = "Yes" ]; then
cat <<EOF
NOTE: To "uninstall" this distribution, the changes made to your
revert them. Or, if you prefer, you can revert them manually.
EOF
+ fi
if [ "$osName" = "Cygwin" ]; then
thisXmlCatalog=$thisJavaXmlCatalog
sed "s#^catalogs=\(.*\)$thisXmlCatalog\(.*\)\$#catalogs=\1\2#" $catalogBackup \
| sed 's/;\+/;/' | sed 's/;$//' | sed 's/=;/=/' > $myCatalogManager || exit 1
cat <<EOF
-
NOTE: $myCatalogManager file successfully reverted.
Backup written to $catalogBackup
+
EOF
;;
esac
cp $dotEmacsBackup $myEmacsFile || exit 1
sed -i "/$revertLine/d" $myEmacsFile || exit 1
cat <<EOF
-
NOTE: $myEmacsFile file successfully reverted.
Backup written to $dotEmacsBackup
cp $dotFileBackup $HOME/$file || exit 1
sed -i "/$revertLineEsc/d" $HOME/$file || exit 1
cat <<EOF
-
NOTE: $HOME/$file file successfully updated.
Backup written to $dotFileBackup
writeTestFile() {
testFile=$mydir/test.sh
echo "#!/bin/bash" > $testFile || exit 1
- echo "./install.sh --test" >> $testFile || exit 1
+ echo "mydir=\$(readlink -f \$(dirname \$0))" >> $testFile || exit 1
+ echo "\$mydir/install.sh --test" >> $testFile || exit 1
chmod 755 $testFile || exit 1
}
printExitMessage() {
cat <<EOF
-
Type the following to source your shell environment for the distribution
$appendLine
EOF
else
- echo
echo "Testing with xmlcatalog..."
while read pair; do
- path=$(readlink -f "${pair%* *}")
+ path=$(readlink -f "$mydir/${pair%* *}")
uri=${pair#* *}
echo
echo " Tested:" $uri
fi
fi
done
- done < .urilist
+ done < $mydir/.urilist
fi
fi
echo
echo "Testing with Apache XML Commons Resolver..."
while read pair; do
- path=$(readlink -f ${pair%* *})
+ path=$(readlink -f "$mydir/${pair%* *}")
uri=${pair#* *}
echo
echo " Tested:" $uri
echo " Result: FAILED"
fi
fi
- done < .urilist
+ done < $mydir/.urilist
fi
fi
}