Make install.sh work if run outside its path

This commit is contained in:
T. Joseph Carter 2018-04-10 19:23:47 -07:00
parent 106555bc95
commit cb7b429927
1 changed files with 13 additions and 3 deletions

View File

@ -11,7 +11,17 @@
a2serverVersion="1.9.0"
a2sScriptURL="https://raw.githubusercontent.com/RasppleII/a2server/master"
# Run the legacy setup script for anything not yet ported
if [ -e setup/index.txt ]; then
source setup/index.txt "$@"
a2sDevel="$( dirname "${BASH_SOURCE[0]}" )"
if [[ -f "$a2sDevel/.a2server_source" ]]; then
pushd $a2sDevel >/dev/null
a2sDevel="$PWD"
popd >/dev/null
else
printf "a2server: Cannot find a2server source tree relative to ${BASH_SOURCE[0]}\n\n"
exit 1
fi
# Run the legacy setup script for anything not yet ported
if [[ -e "${a2sDevel}/setup/index.txt" ]]; then
source "${a2sDevel}/setup/index.txt" "$@"
fi