From aaea9245de2548199694db724f65c2645f529635 Mon Sep 17 00:00:00 2001 From: "T. Joseph Carter" Date: Wed, 11 Apr 2018 06:59:48 -0700 Subject: [PATCH] All scripts now run from source dir MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Legacy code in the remaining scripts to have them run from the website using a2sDevel detection has been purged. That doesn't mean everything now runs locally always—that's going to require a finer pick through the code I haven't done yet. This is a start though, and doing it found a couple of bugs I've managed to fix already. --- install.sh | 18 ++++++++--------- scripts/a2server-2-tools.txt | 35 ++++++++++++---------------------- scripts/a2server-5-netboot.txt | 34 ++++++++++----------------------- 3 files changed, 31 insertions(+), 56 deletions(-) diff --git a/install.sh b/install.sh index 96cd52e..b863964 100755 --- a/install.sh +++ b/install.sh @@ -11,17 +11,17 @@ a2serverVersion="1.9.0" a2sScriptURL="https://raw.githubusercontent.com/RasppleII/a2server/master" -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" +# Find the path of our source directory +a2sSource="$( dirname "${BASH_SOURCE[0]}" )/.." +pushd $a2sSource >/dev/null +a2sSource="$PWD" +popd >/dev/null +if [[ ! -f "$a2sSource/.a2server_source" ]]; then + printf "\na2server: cannot find a2server source directory in $a2sSource.\n\n" exit 1 fi # Run the legacy setup script for anything not yet ported -if [[ -e "${a2sDevel}/setup/ivan.sh" ]]; then - "${a2sDevel}/setup/ivan.sh" "$@" +if [[ -e "${a2sSource}/setup/ivan.sh" ]]; then + "${a2sSource}/setup/ivan.sh" "$@" fi diff --git a/scripts/a2server-2-tools.txt b/scripts/a2server-2-tools.txt index 407c5f4..1ee316d 100755 --- a/scripts/a2server-2-tools.txt +++ b/scripts/a2server-2-tools.txt @@ -7,13 +7,14 @@ a2sScriptURL="https://raw.githubusercontent.com/RasppleII/a2server/master" a2sBinaryURL="http://blocksfree.com/downloads" -a2sDevel="$( dirname "${BASH_SOURCE[0]}" )/.." -if [[ -f "$a2sDevel/.a2server_source" ]]; then - pushd $a2sDevel >/dev/null - a2sDevel="$PWD" - popd >/dev/null -else - a2sDevel= +# Find the path of our source directory +a2sSource="$( dirname "${BASH_SOURCE[0]}" )/.." +pushd $a2sSource >/dev/null +a2sSource="$PWD" +popd >/dev/null +if [[ ! -f "$a2sSource/.a2server_source" ]]; then + printf "\na2server: cannot find a2server source directory in $a2sSource.\n\n" + exit 1 fi useExternalURL=1 @@ -182,27 +183,15 @@ fi a2sTools="afpsync afptype mkatinit mkvolinfo cppo debupdate" a2sHelp="a2server-help.txt" a2sConfScripts="a2server-aliases a2serverrc" -if [[ -z "$a2sDevel" ]]; then - a2sToolDir="/tmp/a2server-install/tools" - mkdir -p "$a2sToolDir" - for _tool in $a2sTools $a2sHelp $a2sConfScripts; do - sudo wget -q -O "$a2sToolDir/$_tool" "${a2sScriptURL}scripts/tools/$_tool" - done -else - a2sToolDir="$a2sDevel/scripts/tools" -fi for _tool in $a2sTools; do - sudo install -m 755 "$a2sToolDir/$_tool" "/usr/local/bin/$_tool" + sudo install -m 755 "$a2sSource/scripts/tools/$_tool" "/usr/local/bin/$_tool" done -for _help in $a2sTools; do - sudo install -m 644 "$a2sToolDir/$_help" "/usr/local/etc/$_help" +for _help in $a2sHelp; do + sudo install -m 644 "$a2sSource/scripts/tools/$_help" "/usr/local/etc/$_help" done for _confscript in $a2sConfScripts; do - sudo install -m 755 "$a2sToolDir/$_confscript" "/usr/local/etc/$_tool" + sudo install -m 755 "$a2sSource/scripts/tools/$_confscript" "/usr/local/etc/$_tool" done -if [[ -z "$a2sDevel" ]]; then - rm -rf "$a2sToolDir" -fi # 1.3.0: a2serverrc is now called from /etc/bash.bashrc, # which in turn calls a2server-aliases diff --git a/scripts/a2server-5-netboot.txt b/scripts/a2server-5-netboot.txt index 126d3c4..c8bfcc7 100755 --- a/scripts/a2server-5-netboot.txt +++ b/scripts/a2server-5-netboot.txt @@ -10,13 +10,14 @@ a2sScriptURL="https://raw.githubusercontent.com/RasppleII/a2server/master" a2sBinaryURL="http://blocksfree.com/downloads" -a2sDevel="$( dirname "${BASH_SOURCE[0]}" )/.." -if [[ -f "$a2sDevel/.a2server_source" ]]; then - pushd $a2sDevel >/dev/null - a2sDevel="$PWD" - popd >/dev/null -else - a2sDevel= +# Find the path of our source directory +a2sSource="$( dirname "${BASH_SOURCE[0]}" )/.." +pushd $a2sSource >/dev/null +a2sSource="$PWD" +popd >/dev/null +if [[ ! -f "$a2sSource/.a2server_source" ]]; then + printf "\na2server: cannot find a2server source directory in $a2sSource.\n\n" + exit 1 fi useExternalURL=1 @@ -262,17 +263,7 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then || [[ ! -f /usr/local/bin/mkvolinfo ]] \ || [[ ! -f /usr/local/bin/afpsync ]] \ || [[ ! -f /usr/local/bin/cppo ]]; then - if [[ -z "$a2sDevel" ]]; then - a2sScriptDir="/tmp/a2server-install/scripts" - mkdir -p "$a2sScriptDir" - rm -f "$a2sScriptDir/a2server-2-tools.txt" &>/dev/null - wget -q -O "$a2sScriptDir/a2server-2-tools.txt" "${a2sScriptURL}/scripts/a2server-2-tools.txt" - chmod ugo+x "$a2sScriptDir/a2server-2-tools.txt" - fi - "$a2sScriptDir/a2server-2-tools.txt" - if [[ -z "$a2sDevel" ]]; then - rm -f /tmp/a2server-install/a2server-2-tools.txt - fi + "$a2sSource/scripts/a2server-2-tools.txt" fi # put BASIC.SYSTEM at root for ProDOS 8 startup @@ -531,12 +522,7 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then echo "A2SERVER: Updating ProDOS 8 Thunderclock driver year table..." mkdir -p /tmp/netboot rm -r /tmp/netboot/* 2> /dev/null - if [[ -z $a2sDevel ]]; then - p8ClockPatch="/tmp/netboot/clock.patch.py" - wget -qO "$p8ClockPatch" "${a2sScriptURL}/scripts/clock.patch.py" - else - p8ClockPatch="$a2sDevel/scripts/clock.patch.py" - fi + p8ClockPatch="$a2sSource/scripts/clock.patch.py" updateP8YearTables $(python $p8ClockPatch $(LANG=C date +"%a %m/%d/%y")) gsosInstalled=""