From 982836dc7c2b0a5ec8df211ee7f766e9a8e4126b Mon Sep 17 00:00:00 2001 From: "T. Joseph Carter" Date: Sun, 4 Oct 2015 01:23:53 -0700 Subject: [PATCH] A2SERVER_SCRIPT_URL variable added Added shell variable A2SERVER_SCRIPT_URL which allows you to replace Ivan's server with another URL for development. If unset, scripts will default to "http://appleii.ivanx.com/a2server/" as usual. This will not allow you to use these scripts for development directly, and in fact may have been over-zealous in removing hardcoded ivanx links. Also, Ivan's webserver has a slightly different layout than this repository because I haven't tried to make this an apache directory structure full of mixed HTML, scripts, .htaccess files, etc. --- scripts/a2server-2-tools.txt | 28 +++++++++++++++++----------- scripts/a2server-3-sharing.txt | 14 ++++++++++---- scripts/a2server-5-netboot.txt | 16 +++++++++++----- setup.sh | 20 +++++++++++++------- update.sh | 10 ++++++++-- 5 files changed, 59 insertions(+), 29 deletions(-) diff --git a/scripts/a2server-2-tools.txt b/scripts/a2server-2-tools.txt index 638ecdf..f1e30e4 100755 --- a/scripts/a2server-2-tools.txt +++ b/scripts/a2server-2-tools.txt @@ -3,6 +3,12 @@ # download and install a2server tools: # mkatinit, mkvolinfo, afptype, afpsync, aliases, nulib2 +# Ensure URL we'll use ends in a / +case "$A2SERVER_SCRIPT_URL" in + */) scriptURL="$A2SERVER_SCRIPT_URL" ;; + *) scriptURL="${A2SERVER_SCRIPT_URL:-http://appleii.ivanx.com/a2server}/" ;; +esac + isRpi= [[ -f /usr/bin/raspi-config ]] && isRpi=1 @@ -17,9 +23,9 @@ if [[ ! -f /usr/local/bin/nulib2 ]]; then cd /tmp if [[ $isRpi ]]; then - wget -qO- ivanx.com/a2server/files/nulib2-rpi.tgz | sudo tar Pzx + wget -qO- "${scriptURL}files/nulib2-rpi.tgz" | sudo tar Pzx elif [[ $isDebian ]]; then - wget -qO- ivanx.com/a2server/files/nulib2-debian7_x86.tgz | sudo tar Pzx + wget -qO- "${scriptURL}files/nulib2-debian7_x86.tgz" | sudo tar Pzx fi if [[ ! -f /usr/local/bin/nulib2 ]]; then @@ -72,9 +78,9 @@ if [[ ! -f /usr/local/bin/unar ]]; then sudo apt-get -y install libgnustep-base1.22 sudo apt-get clean if [[ $isRpi ]]; then - wget -qO- ivanx.com/a2server/files/unar-rpi.tgz | sudo tar Pzx + wget -qO- "${scriptURL}files/unar-rpi.tgz" | sudo tar Pzx elif [[ $isDebian ]]; then - wget -qO- ivanx.com/a2server/files/unar-debian7_x86.tgz | sudo tar Pzx + wget -qO- "${scriptURL}files/unar-debian7_x86.tgz" | sudo tar Pzx fi fi if [[ ! -f /usr/local/bin/unar ]]; then @@ -100,18 +106,18 @@ else echo "A2SERVER: The Unarchiver has already been installed." fi -sudo wget -q -O /usr/local/bin/afpsync appleii.ivanx.com/a2server/scripts/tools/afpsync.txt +sudo wget -q -O /usr/local/bin/afpsync "${scriptURL}scripts/tools/afpsync.txt" sudo chmod ugo+x /usr/local/bin/afpsync -sudo wget -q -O /usr/local/bin/afptype appleii.ivanx.com/a2server/scripts/tools/afptype.txt +sudo wget -q -O /usr/local/bin/afptype "${scriptURL}scripts/tools/afptype.txt" sudo chmod ugo+x /usr/local/bin/afptype -sudo wget -q -O /usr/local/bin/mkatinit appleii.ivanx.com/a2server/scripts/tools/mkatinit.txt +sudo wget -q -O /usr/local/bin/mkatinit "${scriptURL}scripts/tools/mkatinit.txt" sudo chmod ugo+x /usr/local/bin/mkatinit -sudo wget -q -O /usr/local/bin/mkvolinfo appleii.ivanx.com/a2server/scripts/tools/mkvolinfo.txt +sudo wget -q -O /usr/local/bin/mkvolinfo "${scriptURL}scripts/tools/mkvolinfo.txt" sudo chmod ugo+x /usr/local/bin/mkvolinfo -sudo wget -q -O /usr/local/bin/cppo appleii.ivanx.com/a2server/scripts/tools/cppo.txt +sudo wget -q -O /usr/local/bin/cppo "${scriptURL}scripts/tools/cppo.txt" sudo chmod ugo+x /usr/local/bin/cppo -sudo wget -q -O /usr/local/etc/a2server-help.txt appleii.ivanx.com/a2server/scripts/tools/a2server-help.txt -sudo wget -q -O /usr/local/etc/a2server-aliases appleii.ivanx.com/a2server/scripts/tools/a2server-aliases.txt +sudo wget -q -O /usr/local/etc/a2server-help.txt "${scriptURL}scripts/tools/a2server-help.txt" +sudo wget -q -O /usr/local/etc/a2server-aliases "${scriptURL}scripts/tools/a2server-aliases.txt" grep a2server-aliases /etc/bash.bashrc > /dev/null || \ echo "source /usr/local/etc/a2server-aliases" | sudo tee -a /etc/bash.bashrc > /dev/null diff --git a/scripts/a2server-3-sharing.txt b/scripts/a2server-3-sharing.txt index 79f3a37..3e710a5 100755 --- a/scripts/a2server-3-sharing.txt +++ b/scripts/a2server-3-sharing.txt @@ -18,6 +18,12 @@ # --- Installing netatalk +# Ensure URL we'll use ends in a / +case "$A2SERVER_SCRIPT_URL" in + */) scriptURL="$A2SERVER_SCRIPT_URL" ;; + *) scriptURL="${A2SERVER_SCRIPT_URL:-http://appleii.ivanx.com/a2server}/" ;; +esac + isRpi= [[ -f /usr/bin/raspi-config ]] && isRpi=1 @@ -67,9 +73,9 @@ else # install Netatalk if [[ $isRpi ]]; then - { wget -qO- /tmp/netatalk.tgz ivanx.com/a2server/files/netatalk224-rpi.tgz | sudo tar Pzx; } 2> /dev/null + { wget -qO- /tmp/netatalk.tgz ${scriptURL}files/netatalk224-rpi.tgz | sudo tar Pzx; } 2> /dev/null elif [[ $isDebian ]]; then - { wget -qO- /tmp/netatalk.tgz ivanx.com/a2server/files/netatalk224-debian7_x86.tgz | sudo tar Pzx; } 2> /dev/null + { wget -qO- /tmp/netatalk.tgz ${scriptURL}files/netatalk224-debian7_x86.tgz | sudo tar Pzx; } 2> /dev/null fi sudo mandb &> /dev/null @@ -132,7 +138,7 @@ echo "A2SERVER: Configuring Netatalk..." # if missing Netatalk startup file, download a fresh one if [ ! -f /etc/init.d/netatalk ]; then echo "A2SERVER: Downloading new Netatalk startup script..." - sudo wget -qO /etc/init.d/netatalk ivanx.com/a2server/files/netatalk-init.d-clean.txt + sudo wget -qO /etc/init.d/netatalk ${scriptURL}files/netatalk-init.d-clean.txt fi # make the Netatalk startup script work correctly @@ -333,7 +339,7 @@ if [[ ( ! $(ps aux | grep [a]talkd) ) && ( $isRpi ) ]]; then # if no AppleTalk module, try to download it from a2server site if [[ ! -f /lib/modules/$kernelRelease/kernel/net/appletalk/appletalk.ko ]]; then # check for rpi kernel module echo "A2SERVER: Attempting to install AppleTalk kernel module for Raspbian..." - wget -qO /tmp/appletalk.ko.gz appleii.ivanx.com/a2server/files/appletalk-$kernelRelease.ko.gz + wget -qO /tmp/appletalk.ko.gz ${scriptURL}files/appletalk-$kernelRelease.ko.gz if [[ $? -eq 0 ]]; then # if we found a prebuilt one on a2server site, install it and load it gunzip -f /tmp/appletalk.ko.gz diff --git a/scripts/a2server-5-netboot.txt b/scripts/a2server-5-netboot.txt index 87b68b5..4ef464e 100755 --- a/scripts/a2server-5-netboot.txt +++ b/scripts/a2server-5-netboot.txt @@ -6,6 +6,12 @@ # program (for Apple IIe users, and IIgs users in ProDOS network mode). # It also can download and install GS/OS for a network boot configuration. +# Ensure URL we'll use ends in a / +case "$A2SERVER_SCRIPT_URL" in + */) scriptURL="$A2SERVER_SCRIPT_URL" ;; + *) scriptURL="${A2SERVER_SCRIPT_URL:-http://ivanx.com/a2server}/" ;; +esac + gsosDir="/media/A2SHARED/A2FILES" imagesDir=$gsosDir/GSOS.INSTALLER/IMAGES imageToolsDir=$gsosDir/GSOS.INSTALLER/IMAGE.TOOLS @@ -81,7 +87,7 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then || [[ ! -f /usr/local/bin/mkvolinfo ]] \ || [[ ! -f /usr/local/bin/afpsync ]]; then rm /tmp/2.tools &> /dev/null - wget -q -O /tmp/2.tools appleii.ivanx.com/a2server/scripts/a2server-2-tools.txt + wget -q -O /tmp/2.tools "${scriptURL}scripts/a2server-2-tools.txt" chmod ugo+x /tmp/2.tools /tmp/2.tools rm /tmp/2.tools @@ -294,7 +300,7 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then echo cd /tmp/netboot wget -qO shrinkit.sdk http://web.archive.org/web/20131031160750/http://www.nulib.com/library/shrinkit.sdk - [[ ! -f shrinkit.sdk ]] && wget -qO shrinkit.sdk appleii.ivanx.com/a2server/files/shrinkit.sdk + [[ ! -f shrinkit.sdk ]] && wget -qO shrinkit.sdk "${scriptURL}files/shrinkit.sdk" nulib2 -xs shrinkit.sdk > /dev/null cppo -s -ad SHRINKIT /SHRINKIT/SHRINKIT $diskToolsP8Dir 2> /dev/null afpsync -v $sharepath > /dev/null @@ -371,7 +377,7 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then mkdir -p $zlinkDir/.AppleDouble echo cd /tmp/netboot - wget -qO A2CLOUD.HDV http://ivanx.com/a2cloud/files/A2CLOUD.HDV + wget -qO A2CLOUD.HDV "${scriptURL}files/A2CLOUD.HDV" cppo -ad A2CLOUD.HDV . > /dev/null cd A2CLOUD mv *PT3* *PROTERM* $protermDir @@ -423,7 +429,7 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then fi if [[ $autoAnswerYes || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then echo "A2SERVER: Downloading Farallon bridge patch..." - wget -O /tmp/FARALLON.PO appleii.ivanx.com/a2server/files/FARALLON.B1.PO &> /dev/null + wget -O /tmp/FARALLON.PO "${scriptURL}files/FARALLON.B1.PO" &> /dev/null if [[ -d $gsosDir/SYSTEM/SYSTEM.SETUP ]]; then cppo -s -ad /tmp/FARALLON.PO /ATALKPATCH/ATALKIRQ $gsosDir/SYSTEM/SYSTEM.SETUP &> /dev/null echo @@ -441,4 +447,4 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then echo "directly into ProDOS 8 will freeze after a few minutes." fi -fi \ No newline at end of file +fi diff --git a/setup.sh b/setup.sh index cd89af3..9223c23 100755 --- a/setup.sh +++ b/setup.sh @@ -10,6 +10,12 @@ a2serverVersion="124" +# Ensure URL we'll use ends in a / +case "$A2SERVER_SCRIPT_URL" in + */) scriptURL="$A2SERVER_SCRIPT_URL" ;; + *) scriptURL="${A2SERVER_SCRIPT_URL:-http://appleii.ivanx.com/a2server}/" ;; +esac + isRpi= [[ -f /usr/bin/raspi-config ]] && isRpi=1 @@ -70,7 +76,7 @@ done if [[ $updateRasppleII ]]; then echo "A2SERVER: Updating Raspple II (takes up to an hour)..." - wget -qO /tmp/raspbian-update ivanx.com/a2server/files/raspbian-update.txt + wget -qO /tmp/raspbian-update "${scriptURL}files/raspbian-update.txt" source /tmp/raspbian-update a2cloud a2server $autoAnswerYes $skipRepoUpdate [[ $0 == "-bash" ]] && return 0 || exit 0 fi @@ -167,22 +173,22 @@ if (( $doSetup )); then echo echo "A2SERVER: Downloading scripts..." - wget -q -O /tmp/1.storage appleii.ivanx.com/a2server/scripts/a2server-1-storage.txt + wget -q -O /tmp/1.storage "${scriptURL}scripts/a2server-1-storage.txt" chmod ugo+x /tmp/1.storage - wget -q -O /tmp/2.tools appleii.ivanx.com/a2server/scripts/a2server-2-tools.txt + wget -q -O /tmp/2.tools "${scriptURL}scripts/a2server-2-tools.txt" chmod ugo+x /tmp/2.tools - wget -q -O /tmp/3.sharing appleii.ivanx.com/a2server/scripts/a2server-3-sharing.txt + wget -q -O /tmp/3.sharing "${scriptURL}scripts/a2server-3-sharing.txt" chmod ugo+x /tmp/3.sharing - wget -q -O /tmp/5.netboot appleii.ivanx.com/a2server/scripts/a2server-5-netboot.txt + wget -q -O /tmp/5.netboot "${scriptURL}scripts/a2server-5-netboot.txt" chmod ugo+x /tmp/5.netboot - wget -q -O /tmp/6.samba appleii.ivanx.com/a2server/scripts/a2server-6-samba.txt + wget -q -O /tmp/6.samba "${scriptURL}scripts/a2server-6-samba.txt" chmod ugo+x /tmp/6.samba - wget -q -O /tmp/7.console appleii.ivanx.com/a2server/scripts/a2server-7-console.txt + wget -q -O /tmp/7.console "${scriptURL}scripts/a2server-7-console.txt" chmod ugo+x /tmp/7.console echo "A2SERVER: Scripts have been downloaded. Installing..." diff --git a/update.sh b/update.sh index b8dd2d8..f2e2d3d 100755 --- a/update.sh +++ b/update.sh @@ -8,6 +8,12 @@ else installedVersion=100 fi +# Ensure URL we'll use ends in a / +case "$A2SERVER_SCRIPT_URL" in + */) scriptURL="$A2SERVER_SCRIPT_URL" ;; + *) scriptURL="${A2SERVER_SCRIPT_URL:-http://appleii.ivanx.com/a2server}/" ;; +esac + autoAnswerYes= for arg in $@; do if [[ $arg == "-y" ]]; then @@ -18,7 +24,7 @@ done echo echo "Update history:" -wget -qO- appleii.ivanx.com/a2server/update/versionhistory.txt +wget -qO- "${scriptURL}update/versionhistory.txt" echo echo "installed version: ${installedVersion:0:1}.${installedVersion:1:1}.${installedVersion:2:1}" echo "current version: ${currentVersion:0:1}.${currentVersion:1:1}.${currentVersion:2:1}" @@ -32,7 +38,7 @@ fi if [[ ${REPLY:0:1} == "y" || ${REPLY:0:1} == "Y" ]]; then sudo rm /usr/local/etc/A2SERVER-version &> /dev/null # sudo rm /usr/local/etc/netatalk/a2boot/* &> /dev/null - wget -q -O /tmp/setup appleii.ivanx.com/a2server/setup; source /tmp/setup "$@" + wget -q -O /tmp/setup "${scriptURL}setup"; source /tmp/setup "$@" fi unset currentVersion 2> /dev/null