diff --git a/.a2server_source b/.a2server_source new file mode 100644 index 0000000..e69de29 diff --git a/setup/index.txt b/setup/index.txt index 85f3086..e933b85 100755 --- a/setup/index.txt +++ b/setup/index.txt @@ -11,10 +11,19 @@ a2serverVersion="1.5.1" +a2server_devel="$( dirname "${BASH_SOURCE[0]}" )/.." +if [[ -f "$a2server_devel/.a2server_source" ]]; then + pushd $a2server_devel >/dev/null + a2server_devel="$PWD" + popd >/dev/null +else + a2server_devel= +fi + # Ensure URL we'll use ends in a / case "$A2SERVER_SCRIPT_URL" in */) scriptURL="$A2SERVER_SCRIPT_URL" ;; - *) scriptURL="${A2SERVER_SCRIPT_URL:-https://raw.githubusercontent.com/RasppleII/a2server/current}/" ;; + *) scriptURL="${A2SERVER_SCRIPT_URL:-https://raw.githubusercontent.com/RasppleII/a2server/release}/" ;; esac case "$A2SERVER_BINARY_URL" in */) binaryURL="$A2SERVER_BINARY_URL" ;; @@ -200,6 +209,10 @@ if (( $doSetup )); then if (( $doSetup )); then + origDir="$PWD" + rm -rf /tmp/a2server-install &>/dev/null + mkdir -p /tmp/a2server-install + isApple2Pw= isRaspberryPw= userPw=$(sudo grep "^$USER" /etc/shadow | cut -f 2 -d ':') @@ -237,49 +250,46 @@ if (( $doSetup )); then echo echo "A2SERVER: Downloading scripts..." - wget -q -O /tmp/1.storage "${scriptURL}scripts/a2server-1-storage.txt" - chmod ugo+x /tmp/1.storage + read -d '' a2serverSubScripts <<-EOF + a2server-1-storage.txt + a2server-2-tools.txt + a2server-3-sharing.txt + a2server-5-netboot.txt + a2server-6-samba.txt + a2server-7-console.txt + EOF - wget -q -O /tmp/2.tools "${scriptURL}scripts/a2server-2-tools.txt" - chmod ugo+x /tmp/2.tools + if [[ -z "$a2server_devel" ]]; then + for _script in $a2serverSubScripts; do + wget -q -O "/tmp/a2server-install/$_script" "${scriptURL}scripts/$_script" + chmod ugo+x "/tmp/a2server-install/$_script" + done - wget -q -O /tmp/3.sharing "${scriptURL}scripts/a2server-3-sharing.txt" - chmod ugo+x /tmp/3.sharing + echo "A2SERVER: Scripts have been downloaded. Installing..." - wget -q -O /tmp/5.netboot "${scriptURL}scripts/a2server-5-netboot.txt" - chmod ugo+x /tmp/5.netboot + if [[ $installAll ]]; then + sudo rm -f /usr/local/etc/A2SERVER-version /usr/local/bin/nulib2 /usr/local/bin/unar /usr/local/sbin/macipgw /usr/local/bin/ciopfs /usr/local/etc/netatalk/afppasswd /usr/local/etc/netatalk/a2boot/p8 /usr/local/etc/netatalk/a2boot/ProDOS16\ Image + fi - wget -q -O /tmp/6.samba "${scriptURL}scripts/a2server-6-samba.txt" - chmod ugo+x /tmp/6.samba + for _script in $a2serverSubScripts; do + "/tmp/a2server-install/$_script" + done + for _script in $a2serverSubScripts; do + rm -f "/tmp/a2server-install/$_script" + done - wget -q -O /tmp/7.console "${scriptURL}scripts/a2server-7-console.txt" - chmod ugo+x /tmp/7.console + else + # Local development scripts just run them + if [[ $installAll ]]; then + sudo rm -f /usr/local/etc/A2SERVER-version /usr/local/bin/nulib2 /usr/local/bin/unar /usr/local/sbin/macipgw /usr/local/bin/ciopfs /usr/local/etc/netatalk/afppasswd /usr/local/etc/netatalk/a2boot/p8 /usr/local/etc/netatalk/a2boot/ProDOS16\ Image + fi - echo "A2SERVER: Scripts have been downloaded. Installing..." - - if [[ $installAll ]]; then - sudo rm /usr/local/etc/A2SERVER-version 2> /dev/null - sudo rm /usr/local/bin/nulib2 2> /dev/null - sudo rm /usr/local/bin/unar 2> /dev/null - sudo rm /usr/local/sbin/macipgw 2> /dev/null - sudo rm /usr/local/bin/ciopfs 2> /dev/null - sudo rm /usr/local/etc/netatalk/afppasswd 2> /dev/null - sudo rm /usr/local/etc/netatalk/a2boot/p8 /usr/local/etc/netatalk/a2boot/ProDOS16\ Image 2> /dev/null + for _script in $a2serverSubScripts; do + "$a2server_devel/scripts/$_script" + done fi - /tmp/1.storage - rm /tmp/1.storage - /tmp/2.tools - rm /tmp/2.tools - /tmp/3.sharing - rm /tmp/3.sharing - /tmp/5.netboot - rm /tmp/5.netboot - /tmp/6.samba - rm /tmp/6.samba - /tmp/7.console - rm /tmp/7.console - rm /tmp/a2server-packageReposUpdated &> /dev/null + rm -f /tmp/a2server-packageReposUpdated if [[ ! -f /usr/local/etc/A2SERVER-version ]] \ || (( $(head -c 3 /usr/local/etc/A2SERVER-version) < ${a2serverVersion:0:3} )); then @@ -384,5 +394,6 @@ fi unset a2server_update 2> /dev/null unset doSetup 2> /dev/null +rm -rf /tmp/a2server-install &>/dev/null rm -f /tmp/a2server-* 2> /dev/null rm -f setup &> /dev/null diff --git a/update/index.txt b/update/index.txt index a435880..794d0b5 100755 --- a/update/index.txt +++ b/update/index.txt @@ -1,6 +1,15 @@ #! /bin/bash # vim: set tabstop=4 shiftwidth=4 noexpandtab filetype=sh: +a2server_devel="$( dirname "${BASH_SOURCE[0]}" )/.." +if [[ -f "$a2server_devel/.a2server_source" ]]; then + pushd $a2server_devel >/dev/null + a2server_devel="$PWD" + popd >/dev/null +else + a2server_devel= +fi + # Ensure URL we'll use ends in a / case "$A2SERVER_SCRIPT_URL" in */) scriptURL="$A2SERVER_SCRIPT_URL" ;;