2015-10-09 12:29:32 +00:00
#! /bin/bash
# vim: set tabstop=4 shiftwidth=4 expandtab filetype=sh:
2015-10-03 12:25:44 +00:00
# this script downloads and installs the Apple boot blocks required
# for booting an Apple II client over the network, and places
# BASIC.SYSTEM on the shared drive and configures it to be the startup
# 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.
2015-10-04 08:23:53 +00:00
# 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
2015-12-24 04:02:17 +00:00
case "$A2SERVER_BINARY_URL" in
*/) binaryURL="$A2SERVER_BINARY_URL" ;;
*) binaryURL="${A2SERVER_BINARY_URL:-http://ivanx.com/a2server/files}/" ;;
esac
useExternalURL=1
[[ $A2SERVER_NO_EXTERNAL ]] && useExternalURL=
2015-10-04 08:23:53 +00:00
2015-12-10 01:39:09 +00:00
gsosDir="/srv/A2SERVER/A2FILES"
2015-12-08 04:52:00 +00:00
imagesDir=$gsosDir/GSOS.Installer/Images
imageToolsDir=$gsosDir/GSOS.Installer/Image.Tools
netInstallDir=$gsosDir/GSOS.Installer/Net.Install
2015-10-03 12:25:44 +00:00
2015-12-10 01:39:09 +00:00
p8Dir="/srv/A2SERVER/A2FILES"
2015-12-08 04:52:00 +00:00
diskToolsP8Dir=$p8Dir/Disk.Tools.P8
2015-10-03 12:25:44 +00:00
2015-12-10 01:39:09 +00:00
commDir="/srv/A2SERVER/A2FILES/Comm"
2015-12-08 04:52:00 +00:00
spectrumDir=$commDir/Spectrum
protermDir=$commDir/ProTERM
zlinkDir=$commDir/Z.Link
adtproDir=$commDir/ADTPro
2015-10-03 12:25:44 +00:00
2015-11-09 14:40:44 +00:00
gsosURL="http://download.info.apple.com/Apple_Support_Area/Apple_Software_Updates/English-North_American/Apple_II/Apple_IIGS_System_6.0.1/"
gsosBackupURL="http://archive.org/download/download.info.apple.com.2012.11/download.info.apple.com.2012.11.zip/download.info.apple.com%2FApple_Support_Area%2FApple_Software_Updates%2FEnglish-North_American%2FApple_II%2FApple_IIGS_System_6.0.1%2F"
2015-12-08 04:52:00 +00:00
updateP8YearTables () {
# Geoff Body and Andrew Roughan helped Joseph Carter with this one
# Update ProDOS 8 year table (and spalsh date because may as well)
# Effectively, we're turning p8 into the 6.0.3 version here.
wd=$PWD
cd /usr/local/etc/netatalk/a2boot
echo -n -e "\xb0\xb2\xad\xc1\xf5\xe7\xad\xb1\xb5" | sudo dd of="p8" bs=38 seek=1 conv=notrunc 2> /dev/null
echo -n -e "\x12\x11\x0b\x10\x0f\x0e\x0d" | sudo dd of="p8" bs=3958 seek=1 conv=notrunc 2> /dev/null
echo -n -e "\xb0\xb2\xad\xc1\xf5\xe7\xad\xb1\xb5" | sudo dd of="ProDOS16 Image" bs=3110 seek=1 conv=notrunc 2> /dev/null
echo -n -e "\x12\x11\x0b\x10\x0f\x0e\x0d" | sudo dd of="ProDOS16 Image" bs=7030 seek=1 conv=notrunc 2> /dev/null
echo -n -e "\xb0\xb2\xad\xc1\xf5\xe7\xad\xb1\xb5" | sudo dd of="Apple :2f:2fe Boot Blocks" bs=79 seek=1 conv=notrunc 2> /dev/null
echo -n -e "\x12\x11\x0b\x10\x0f\x0e\x0d" | sudo dd of="Apple :2f:2fe Boot Blocks" bs=7071 seek=1 conv=notrunc 2> /dev/null
cd "$wd"
}
2015-10-03 12:25:44 +00:00
# bail out on automated netboot setup unless -b is also specified
[[ -f /tmp/a2server-autoAnswerYes ]] && autoAnswerYes=1 || autoAnswerYes=
if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
2015-12-08 04:52:00 +00:00
2015-10-03 12:25:44 +00:00
if [[ ! $autoAnswerYes ]]; then
echo
echo "Do you want to set up A2SERVER to be able to boot Apple II"
echo -n "computers over the network? "
read
fi
2015-12-08 04:52:00 +00:00
2015-10-03 12:25:44 +00:00
if [[ $autoAnswerYes || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
2015-12-08 04:52:00 +00:00
2015-10-03 12:25:44 +00:00
nbmode=1
echo
2015-12-08 04:52:00 +00:00
2015-10-03 12:25:44 +00:00
sudo true
mkdir -p /tmp/netboot
cd /tmp/netboot
2015-12-08 04:52:00 +00:00
2015-10-03 12:25:44 +00:00
# this will get "Disk 7" (Apple II Setup) as a raw (block dump) image
if [[ ! -f /usr/local/etc/netatalk/a2boot/ProDOS16\ Boot\ Blocks ]] \
2015-12-08 04:52:00 +00:00
|| [[ ! -f /usr/local/etc/netatalk/a2boot/ProDOS16\ Image ]] \
|| [[ ! -f /usr/local/etc/netatalk/a2boot/Apple\ :2f:2fe\ Boot\ Blocks ]]; then
2015-10-03 12:25:44 +00:00
echo "A2SERVER: Downloading Apple II Boot Blocks..."
cd /tmp/netboot
2015-12-08 04:52:00 +00:00
2015-12-24 04:02:17 +00:00
if [[ $useExternalURL ]]; then
wget --max-redirect 0 -qO Disk_7_of_7-Apple_II_Setup.sea.bin ${gsosURL}Disk_7_of_7-Apple_II_Setup.sea.bin
unar -k skip Disk_7_of_7-Apple_II_Setup.sea.bin &> /dev/null
if (( $? != 0 )); then
wget -qO Disk_7_of_7-Apple_II_Setup.sea.bin ${gsosBackupURL}Disk_7_of_7-Apple_II_Setup.sea.bin
unar -k skip Disk_7_of_7-Apple_II_Setup.sea.bin &> /dev/null
fi
fi
if [[ ! -f 'Disk 7 of 7-Apple II Setup.sea' ]]; then
wget -qO Disk_7_of_7-Apple_II_Setup.sea.bin ${binaryURL}external/appleii/gsos601/Disk_7_of_7-Apple_II_Setup.sea.bin
unar -k skip Disk_7_of_7-Apple_II_Setup.sea.bin &> /dev/null
2015-11-10 04:29:08 +00:00
fi
2015-10-03 12:25:44 +00:00
truncate -s 819284 'Disk 7 of 7-Apple II Setup.sea'
dd if='Disk 7 of 7-Apple II Setup.sea' of=APPLE2SETUP.HDV bs=84 skip=1 2> /dev/null
2015-12-08 04:52:00 +00:00
2015-10-03 12:25:44 +00:00
# copy the Boot Blocks into the right place
mkdir -p a2setup
sudo mount -t hfs -o ro,loop APPLE2SETUP.HDV a2setup
sudo mkdir -p /usr/local/etc/netatalk/a2boot
sudo cp -p a2setup/System\ Folder/* /usr/local/etc/netatalk/a2boot
sudo umount a2setup
sudo mv /usr/local/etc/netatalk/a2boot/Apple* /usr/local/etc/netatalk/a2boot/'Apple :2f:2fe Boot Blocks'
2015-12-08 04:52:00 +00:00
cd /usr/local/etc/netatalk/a2boot
2015-10-03 12:25:44 +00:00
# thanks to Geoff Body for these Boot Blocks patches
# fix cleartext password login bug
echo -n -e "\xA8\xA2\x01\xBD\x80\x38\x99\xA0\x38\xC8\xE8\xE0\x09\x90\xF4" | \
2015-12-08 04:52:00 +00:00
sudo dd of='Apple :2f:2fe Boot Blocks' bs=19779 seek=1 conv=notrunc 2> /dev/null
2015-10-03 12:25:44 +00:00
echo -n -e "\xA8\xA2\x01\xBD\x80\x10\x99\xA0\x10\xC8\xE8\xE0\x09\x90\xF4" | \
2015-12-08 04:52:00 +00:00
sudo dd of='ProDOS16 Image' bs=22583 seek=1 conv=notrunc 2> /dev/null
2015-10-03 12:25:44 +00:00
# enable typing "8" during GS/OS netboot to force ProDOS 8 boot
echo -n -e "\x92" | sudo dd of='ProDOS16 Image' bs=256 seek=1 conv=notrunc 2> /dev/null
echo -n -e "\x20\x7d\x14" | sudo dd of='ProDOS16 Image' bs=864 seek=1 conv=notrunc 2> /dev/null
echo -n -e "\xad\x00\xc0\x29\xff\x00\xc9\xb8\x00\xd0\x06\xa9\x02\x00\x8d\x53\x14\xa9\x10\x0f\x60" | \
2015-12-08 04:52:00 +00:00
sudo dd of='ProDOS16 Image' bs=1661 seek=1 conv=notrunc 2> /dev/null
2015-10-03 12:25:44 +00:00
fi
echo "A2SERVER: Boot Blocks have been installed."
2015-12-08 04:52:00 +00:00
2015-10-03 12:25:44 +00:00
# get a2server-tools if necessary
if [[ ! -f /usr/local/bin/mkatinit ]] \
2015-12-08 04:52:00 +00:00
|| [[ ! -f /usr/local/bin/afptype ]] \
|| [[ ! -f /usr/local/bin/mkvolinfo ]] \
|| [[ ! -f /usr/local/bin/afpsync ]] \
|| [[ ! -f /usr/local/bin/cppo ]]; then
2015-10-03 12:25:44 +00:00
rm /tmp/2.tools &> /dev/null
2015-10-04 08:23:53 +00:00
wget -q -O /tmp/2.tools "${scriptURL}scripts/a2server-2-tools.txt"
2015-10-03 12:25:44 +00:00
chmod ugo+x /tmp/2.tools
/tmp/2.tools
rm /tmp/2.tools
fi
2015-12-08 04:52:00 +00:00
2015-10-03 12:25:44 +00:00
# put BASIC.SYSTEM at root for ProDOS 8 startup
2015-12-08 04:52:00 +00:00
cp -p /usr/local/etc/netatalk/a2boot/Basic.System $gsosDir/BASIC.System
2015-10-03 12:25:44 +00:00
afpsync -v $gsosDir > /dev/null
2015-12-08 04:52:00 +00:00
afptype -p SYS -q $gsosDir/BASIC.System
2015-10-03 12:25:44 +00:00
# create tools for setting GS/OS or ProDOS 8 boot in battery RAM and rebooting. Props yet again to Geoff Body.
if [[ ! -f $p8Dir/NETBOOT.P8 ]]; then
echo
echo "A2SERVER: Creating NETBOOT.P8..."
touch $p8Dir/NETBOOT.P8
echo -n -e "\x38\x20\x1f\xfe\x90\x01\x60\xfb\x08\xc2\x30\xf4\x02\x00\xf4\x62\x00\xa2\x03\x0b\x22\x00\x00\xe1\x78\xf4\x00\x00\xf4\x00\x00\xab\xab\x2b\x38\xfb\xce\xf4\x03\xa9\x0c\x8d\x68\xc0\x9c\x47\xc0\x9c\x41\xc0\xa9\x09\x8d\x39\xc0\xa9\xc0\x8d\x39\xc0\x5c\x62\xfa\x00" | \
2015-12-08 04:52:00 +00:00
sudo dd of="$p8Dir/NETBOOT.P8" 2> /dev/null
2015-10-03 12:25:44 +00:00
afpsync -v $p8Dir > /dev/null
afptype -p SYS -q $p8Dir/NETBOOT.P8
fi
if [[ ! -f $gsosDir/NETBOOT.GSOS ]]; then
echo
echo "A2SERVER: Creating NETBOOT.GSOS..."
# create tool for setting GSOS boot in battery RAM and rebooting. Props yet again to Geoff Body.
touch $gsosDir/NETBOOT.GSOS
echo -n -e "\x38\x20\x1f\xfe\x90\x01\x60\xfb\x08\xc2\x30\xf4\x01\x00\xf4\x62\x00\xa2\x03\x0b\x22\x00\x00\xe1\x78\xf4\x00\x00\xf4\x00\x00\xab\xab\x2b\x38\xfb\xce\xf4\x03\xa9\x0c\x8d\x68\xc0\x9c\x47\xc0\x9c\x41\xc0\xa9\x09\x8d\x39\xc0\xa9\xc0\x8d\x39\xc0\x5c\x62\xfa\x00" | \
2015-12-08 04:52:00 +00:00
sudo dd of="$p8Dir/NETBOOT.GSOS" 2> /dev/null
2015-10-03 12:25:44 +00:00
afpsync -v $gsosDir > /dev/null
afptype -p SYS -q $gsosDir/NETBOOT.GSOS
fi
2015-12-08 04:52:00 +00:00
2015-10-03 12:25:44 +00:00
mkatinit -gs -d -f # GS/OS registered user and Guest starts up with SYSTEM/FINDER
mkatinit -d -f guest # ProDOS 8 Guest starts up with BASIC.SYSTEM (no registered user)
2015-10-06 06:52:43 +00:00
2015-11-09 14:40:44 +00:00
gsosInstall=
gsosReinstall=1
if [[ -f "$gsosDir/SYSTEM/START.GS.OS" ]]; then
while true; do
gsosInstall=
gsosReinstall=
echo
echo "GS/OS is already installed on this volume."
2015-12-08 04:52:00 +00:00
echo "1: leave existing GS/OS system in place"
echo "2: delete installed GS/OS system, then install new GS/OS"
echo "3: install or upgrade GS/OS on top of existing GS/OS system"
2015-11-09 14:40:44 +00:00
echo
2015-12-08 04:52:00 +00:00
echo -n "Which would you like to do? "
2015-11-09 14:40:44 +00:00
read
2015-12-08 04:52:00 +00:00
if [[ $REPLY == "2" || $REPLY == "3" ]]; then
2015-11-09 14:40:44 +00:00
gsosReinstall=$REPLY
2015-12-08 04:52:00 +00:00
if (( $gsosReinstall == 2 )); then
2015-11-09 14:40:44 +00:00
echo
echo -n "Are you sure you want to delete your entire GS/OS System folder? "
read
if [[ ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
rm -r "$gsosDir/SYSTEM/* $gsosDir/System/.AppleDouble/*" 2> /dev/null
afpsync &> /dev/null
echo
break
fi
else
echo -n "Are you sure you want to reinstall GS/OS over your existing system? "
read
if [[ ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
rm -r "$gsosDir/SYSTEM/START.GS.OS $gsosDir/System/.AppleDouble/START.GS.OS" 2> /dev/null
afpsync &> /dev/null
echo
break
2015-12-08 04:52:00 +00:00
fi
2015-11-09 14:40:44 +00:00
fi
else
gsosInstall=1
break
fi
done
fi
if [[ $gsosReinstall ]]; then
2015-10-03 12:25:44 +00:00
if [[ ! $autoAnswerYes ]]; then
2015-11-09 14:40:44 +00:00
echo "You can set up GS/OS for network boot. This may take a while."
echo "0: don't install GS/OS"
echo "1: GS/OS 6.0.1 (official Apple release, May 1993)"
echo "2: GS/OS 6.0.2 (community release by Antoine Vignau, July 2015)"
echo "3: GS/OS 6.0.3 (community release by Tony Diaz, August 2015)"
echo
echo -n "Which flavor would you like? "
2015-10-03 12:25:44 +00:00
read
fi
2015-11-09 14:40:44 +00:00
[[ $autoAnswerYes ]] && gsosVersion=1
if [[ $REPLY == "1" || $REPLY == "2" || $REPLY == "3" ]]; then
gsosInstall=$REPLY
2015-12-08 04:52:00 +00:00
if [[ gsosInstall -gt 1 ]]; then
updateP8YearTables
fi
2015-10-06 06:52:43 +00:00
2015-12-08 04:52:00 +00:00
# get GS/OS disks and put them in IMAGES
2015-10-03 12:25:44 +00:00
# also dump contents into NET.INSTALL and modify scripts to work from there
# echo
echo
2015-11-09 14:40:44 +00:00
echo "A2SERVER: Downloading GS/OS 6.0.${gsosInstall} installer disk images..."
2015-10-03 12:25:44 +00:00
cd /tmp/netboot
mkdir -p $imagesDir
mkdir -p $netInstallDir
activeDisk=0
2015-12-08 04:52:00 +00:00
2015-11-09 14:40:44 +00:00
diskNames=( Install System.Disk SystemTools1 SystemTools2 Fonts synthLAB )
if (( $gsosInstall == 1 )); then
:
elif (( $gsosInstall == 2 )); then
gsosURL="http://mirrors.apple2.org.za/Apple%20II%20Documentation%20Project/Software/Operating%20Systems/Apple%20IIGS%20System/Disk%20Images/"
diskNames=( Install System.Disk SystemTools1 SystemTools2 SystemTools3 Fonts1 Fonts2 synthLAB )
diskWebNames=( Install System%20disk System%20tools%201 System%20tools%202 System%20tools%203 Fonts%201 Fonts%202 Synthlab )
elif (( $gsosInstall == 3 )); then
gsosURL="ftp://ftp.apple.asimov.net/pub/apple_II/images/gs/os/gsos/Apple_IIGS_System_6.0.3/"
fi
2015-12-08 04:52:00 +00:00
2015-11-09 14:40:44 +00:00
# delete previously downloaded installer
rm "$imagesDir/* $imagesDir/.AppleDouble/*" 2> /dev/null
rm "$netInstallDir/* $netInstallDir/.AppleDouble/*" 2> /dev/null
afpsync -v $gsosDir > /dev/null
2015-12-08 04:52:00 +00:00
2015-11-09 14:40:44 +00:00
for diskname in ${diskNames[@]}; do
2015-12-24 04:02:17 +00:00
outfile="$imagesDir/$diskname.po"
2015-11-09 14:40:44 +00:00
(( activeDisk++ ))
echo "A2SERVER: Disk ${activeDisk} of ${#diskNames[@]}: $diskname"
if (( $gsosInstall == 1 )); then
2015-12-24 04:02:17 +00:00
if [[ $useExternalURL ]]; then
wget --max-redirect 0 -qO "Disk_${activeDisk}_of_7-${diskname}.sea.bin" "${gsosURL}Disk_${activeDisk}_of_7-${diskname}.sea.bin"
unar -k skip "Disk_${activeDisk}_of_7-${diskname}.sea.bin" &> /dev/null
if [[ ! -f "Disk ${activeDisk} of 7-${diskname}.sea" ]]; then
wget -qO "Disk_${activeDisk}_of_7-${diskname}.sea.bin" "${gsosBackupURL}Disk_${activeDisk}_of_7-${diskname}.sea.bin"
unar -k skip "Disk_${activeDisk}_of_7-${diskname}.sea.bin" &> /dev/null
fi
fi
if [[ ! -f "Disk ${activeDisk} of 7-${diskname}.sea" ]]; then
wget -qO "Disk_${activeDisk}_of_7-${diskname}.sea.bin" "${binaryURL}external/appleii/gsos601/Disk_${activeDisk}_of_7-${diskname}.sea.bin"
unar -k skip "Disk_${activeDisk}_of_7-${diskname}.sea.bin" &> /dev/null
2015-11-09 14:40:44 +00:00
fi
2015-10-03 12:25:44 +00:00
truncate -s 819284 "Disk ${activeDisk} of 7-${diskname}.sea"
dd if="Disk ${activeDisk} of 7-${diskname}.sea" of=${outfile} bs=84 skip=1 &> /dev/null
2015-11-09 14:40:44 +00:00
elif (( $gsosInstall == 2 )); then
2015-12-24 04:02:17 +00:00
if [[ $useExternalURL ]]; then
wget -qO $outfile "$gsosURL/IIGS%20System%206.0.2%20-%20Disk%20${activeDisk}%20${diskWebNames[$activeDisk-1]}.po"
fi
if [[ $? -ne 0 || ! -f $outfile ]]; then
wget -qO $outfile "${binaryURL}external/appleii/gsos602/$diskname.po"
fi
2015-11-09 14:40:44 +00:00
elif (( $gsosInstall == 3 )); then
2015-12-24 04:02:17 +00:00
if [[ $useExternalURL ]]; then
wget -qO $outfile "$gsosURL/$diskname.po"
fi
if [[ $? -ne 0 || ! -f $outfile ]]; then
wget -qO $outfile "${binaryURL}external/appleii/gsos603/$diskname.po"
fi
2015-12-08 04:52:00 +00:00
fi
2016-01-03 10:13:15 +00:00
cppo -s -ad $outfile $netInstallDir &> /dev/null
2015-10-03 12:25:44 +00:00
done
rm *.sea* &> /dev/null
2015-12-08 04:52:00 +00:00
sed -i "s/\([^\\]\r:\)/\1A2FILES:GSOS.Installer:Net.Install:/g" $netInstallDir/Install/Scripts/*
2015-10-03 12:25:44 +00:00
afpsync -v $gsosDir > /dev/null
2015-12-08 04:52:00 +00:00
2015-10-03 12:25:44 +00:00
# install GS/OS
# spec for GS/OS installer scripts: GS/OS Tech Note #64
# http://www.1000bit.it/support/manuali/apple/technotes/iigs/tn.iigs.064.html
processScript () {
scriptEntries=$(cat $1 | tr '\r' '#' | tr '~' '\n' | sed 's/4#D/5/')
IFS=$'\n'
scriptEntries=($scriptEntries)
2015-12-08 04:52:00 +00:00
pathPrefix="/A2FILES/GSOS.Installer/Net.Install"$(tr ':' '/' <<< ${scriptEntries[0]##S*\\\\#})
2015-10-03 12:25:44 +00:00
entryCount=${#scriptEntries[@]}
(( entryCount -= 2 ))
2015-11-09 14:40:44 +00:00
# echo "entryCount: $entryCount"
entryIndex=2
while (( entryIndex <= entryCount )); do
2015-10-03 12:25:44 +00:00
IFS='#'
scriptEntry=(${scriptEntries[entryIndex]})
2015-11-09 14:40:44 +00:00
# echo $entryIndex $entryCount ${scriptEntry[@]}
2015-10-03 12:25:44 +00:00
action=${scriptEntry[1]:0:1}
sourcePathMixed=$(tr ':' '/' <<< ${scriptEntry[5]})
[[ ${sourcePathMixed:0:1} != '/' ]] && sourcePathMixed="${pathPrefix}/$sourcePathMixed"
2015-12-08 04:52:00 +00:00
sourcePath=$sourcePathMixed
targetPath=$gsosDir/$(tr ':' '/' <<< ${scriptEntry[6]})
2015-10-03 12:25:44 +00:00
# volumeName=$(cut -d/ -f 2 <<< $sourcePath)
targetParent=${targetPath%/*}
targetFile=${targetPath##*/}
sourceParent=${sourcePath%/*}
sourceFile=${sourcePath##*/}
2015-12-08 04:52:00 +00:00
2015-10-03 12:25:44 +00:00
if [[ $action == 1 || $action == 2 ]]; then
mkdir -p $targetParent
echo "copying: $sourcePathMixed"
echo " to: $targetPath"
echo
[[ ! -d $targetParent ]] && mkdir -p $targetParent
cp -p ${gsosDir%/*}$sourcePath $targetPath
[[ ! -d $targetParent/.AppleDouble ]] && mkdir -p $targetParent/.AppleDouble
cp -p ${gsosDir%/*}$sourceParent/.AppleDouble/$sourceFile $targetParent/.AppleDouble/$targetFile
elif [[ $action == 3 || $action == 4 ]]; then
if [[ -f "$targetPath" ]]; then
echo "deleting $targetPath"
rm "$targetPath"
[[ -f $targetParent/.AppleDouble/$targetFile ]] && rm "$targetParent/.AppleDouble/$targetFile"
fi
fi
(( entryIndex++ ))
done
unset IFS
}
2015-12-08 04:52:00 +00:00
2015-10-03 12:25:44 +00:00
mkdir -p /tmp/netboot
cd /tmp/netboot
2015-12-08 04:52:00 +00:00
echo "A2SERVER: Preparing GS/OS installer scripts..."
2015-10-03 12:25:44 +00:00
# work through installer scripts
2015-12-08 04:52:00 +00:00
echo "Script: Install.Sys.File"
processScript $netInstallDir/Install/Scripts/Instal.Sys.File
2015-11-09 14:40:44 +00:00
echo "Script: HFS.FST"
2015-12-08 04:52:00 +00:00
processScript $netInstallDir/Install/Scripts/HFS.FST
2015-11-23 08:18:27 +00:00
echo "Script: DOS33.FST"
processScript $netInstallDir/INSTALL/SCRIPTS/DOS3.3.FST
2015-12-08 04:52:00 +00:00
echo "Script: Teach"
processScript $netInstallDir/Install/Scripts/Teach
echo "Script: AppleShare"
processScript $netInstallDir/Install/Scripts/Appleshare
echo "Script: Server.Sys.File"
processScript $netInstallDir/Install/Scripts/Server.Sys.File
2015-10-03 12:25:44 +00:00
# sync netatalk database
afpsync -v $gsosDir > /dev/null
2015-11-09 14:40:44 +00:00
else
gsosInstall=
2015-10-03 12:25:44 +00:00
fi
fi
2015-12-08 04:52:00 +00:00
if [[ ! $autoAnswerYes && gsosInstall -lt 2 ]]; then
echo
echo -n "Do you want to update the ProDOS 8 year tables? "
read
fi
if [[ $autoAnswerYes || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
updateP8YearTables
fi
2015-10-06 06:52:43 +00:00
2015-10-03 12:25:44 +00:00
if [[ ! $autoAnswerYes ]]; then
echo
echo "Do you want to download and install utilities for working with"
echo -n "disk images and archive files in GS/OS? "
read
fi
if [[ $autoAnswerYes || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
2015-12-08 04:52:00 +00:00
2015-10-03 12:25:44 +00:00
# download image tools and put them in IMAGE.TOOLS
echo "A2SERVER: Downloading GS/OS disk image utilities..."
mkdir -p $imageToolsDir
2015-12-08 04:52:00 +00:00
2015-10-03 12:25:44 +00:00
# get Asimov2 (for GS/OS)
echo -n "Asimov 2.0"
2015-12-08 04:52:00 +00:00
if [[ -f $imageToolsDir/Asimov ]]; then
2015-10-03 12:25:44 +00:00
echo " is already installed."
else
echo
cd /tmp/netboot
2015-12-24 04:02:17 +00:00
if [[ $useExternalURL ]]; then
wget -qO Asimov.shk http://www.ninjaforce.com/downloads/Asimov.shk
nulib2 -x -s Asimov.shk &> /dev/null
fi
if [[ ! -d Asimov ]]; then
wget -qO Asimov.shk ${binaryURL}external/appleii/Asimov.shk
nulib2 -x -s Asimov.shk &> /dev/null
fi
2015-12-08 04:52:00 +00:00
cp -p Asimov/Asimov $imageToolsDir/Asimov
2015-10-03 12:25:44 +00:00
afpsync -v $gsosDir > /dev/null
2015-12-08 04:52:00 +00:00
cat Asimov/Asimov_rsrc_ >> $imageToolsDir/.AppleDouble/Asimov
afptype -p S16 -q $imageToolsDir/Asimov
2015-10-03 12:25:44 +00:00
fi
2015-12-08 04:52:00 +00:00
2015-10-03 12:25:44 +00:00
echo -n "GS-ShrinkIt 1.1"
# get GS-ShrinkIt
if [[ -f $imageToolsDir/GSHK ]]; then
echo " is already installed."
else
echo
2015-12-24 04:02:17 +00:00
mkdir -p /tmp/netboot/gshk
cd /tmp/netboot/gshk
if [[ $useExternalURL ]]; then
wget -qO gshk11.sea http://web.archive.org/web/20131031160750/http://nulib.com/library/gshk11.sea
#wget -qO gshk11.sea http://www.nulib.com/library/gshk11.sea
nulib2 -x -s gshk11.sea &> /dev/null
fi
if [[ ! -f GSHK ]]; then
wget -qO gshk11.sea ${binaryURL}external/appleii/gshk11.sea
nulib2 -x -s gshk11.sea &> /dev/null
fi
2015-10-03 12:25:44 +00:00
cp -p GSHK $imageToolsDir/GSHK
afpsync -v $gsosDir > /dev/null
cat GSHK_rsrc_ >> $imageToolsDir/.AppleDouble/GSHK
afptype -p S16 -a DB07 -q $imageToolsDir/GSHK
2015-12-24 04:02:17 +00:00
cd /tmp/netboot
2015-10-03 12:25:44 +00:00
fi
2015-12-08 04:52:00 +00:00
echo -n "MountIt 1.4"
2015-10-03 12:25:44 +00:00
# get MountIt (for GS/OS)
if [[ -f $imageToolsDir/MOUNTIT.SHK ]]; then
echo " is already installed."
else
echo
cd /tmp/netboot
2015-12-24 04:02:17 +00:00
if [[ $useExternalURL ]]; then
wget -q -O MOUNTIT.SHK http://www.brutaldeluxe.fr/products/apple2gs/MOUNTIT.SHK
fi
if [[ $? -ne 0 || ! -f MOUNTIT.SHK ]]; then
wget -qO MOUNTIT.SHK ${binaryURL}external/appleii/MOUNTIT.SHK
fi
2015-10-03 12:25:44 +00:00
cp -p MOUNTIT.SHK $imageToolsDir/MOUNTIT.SHK
afpsync -v $gsosDir > /dev/null
afptype -p SHK -q $imageToolsDir/MOUNTIT.SHK
fi
fi
if [[ ! $autoAnswerYes ]]; then
echo
echo "Do you want to download and install utilities for working with"
echo -n "disk images and archive files in ProDOS 8? "
read
fi
if [[ $autoAnswerYes || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
2015-12-08 04:52:00 +00:00
2015-10-03 12:25:44 +00:00
echo "A2SERVER: Downloading ProDOS 8 disk image utilities..."
mkdir -p $diskToolsP8Dir
2015-12-08 04:52:00 +00:00
2015-10-03 12:25:44 +00:00
echo -n "ShrinkIt 3.4"
# get ShrinkIt 3.4 (for ProDOS 8)
if [[ -f $diskToolsP8Dir/SHRINKIT ]]; then
echo " is already installed."
else
echo
cd /tmp/netboot
2015-12-24 04:02:17 +00:00
if [[ $useExternalURL ]]; then
wget -qO shrinkit.sdk http://web.archive.org/web/20131031160750/http://www.nulib.com/library/shrinkit.sdk
nulib2 -x -s shrinkit.sdk &> /dev/null
fi
if [[ ! -f SHRINKIT ]]; then
wget -qO shrinkit.sdk ${binaryURL}external/appleii/shrinkit.sdk
nulib2 -x -s shrinkit.sdk &> /dev/null
fi
2016-01-03 10:13:15 +00:00
cppo -s -ad SHRINKIT /SHRINKIT/SHRINKIT $diskToolsP8Dir &> /dev/null
2015-10-03 12:25:44 +00:00
afpsync -v $sharepath > /dev/null
fi
2015-12-08 04:52:00 +00:00
2015-10-03 12:25:44 +00:00
echo -n "DSK2FILE 5.8"
# get DSK2FILE (for ProDOS 8)
if [[ -f $diskToolsP8Dir/DSK2FILE ]]; then
echo " is already installed."
else
echo
cd /tmp/netboot
2015-12-24 04:02:17 +00:00
if [[ $useExternalURL ]]; then
wget -q -O dsk2file.shk http://www.dwheeler.com/6502/oneelkruns/dsk2file.zip
nulib2 -x -s dsk2file.shk &> /dev/null
fi
if [[ ! -f DSK2FILE58 ]]; then
wget -qO dsk2file.shk ${binaryURL}external/appleii/dsk2file.shk
nulib2 -x -s dsk2file.shk &> /dev/null
fi
2015-10-03 12:25:44 +00:00
cp -p DSK2FILE58 $diskToolsP8Dir/DSK2FILE
afpsync -v $sharepath > /dev/null
afptype -p SYS -q $diskToolsP8Dir/DSK2FILE
fi
2015-12-08 04:52:00 +00:00
2015-10-03 12:25:44 +00:00
echo -n "Apple System Utilities 3.1"
if [[ -f $diskToolsP8Dir/SYSUTIL ]]; then
echo " is already installed."
else
echo
cd /tmp/netboot
2015-12-24 04:02:17 +00:00
if [[ $useExternalURL ]]; then
wget --max-redirect 0 -qO Apple_II_System_Disk_3.2.sea.bin http://download.info.apple.com/Apple_Support_Area/Apple_Software_Updates/English-North_American/Apple_II/Apple_II_Supplemental/Apple_II_System_Disk_3.2.sea.bin
if (( $? != 0 )); then
wget -qO Apple_II_System_Disk_3.2.sea.bin http://archive.org/download/download.info.apple.com.2012.11/download.info.apple.com.2012.11.zip/download.info.apple.com%2FApple_Support_Area%2FApple_Software_Updates%2FEnglish-North_American%2FApple_II%2FApple_II_Supplemental%2FApple_II_System_Disk_3.2.sea.bin
unar -k skip Apple_II_System_Disk_3.2.sea.bin &> /dev/null
fi
fi
if [[ ! -f 'Apple II System Disk 3.2.sea' ]]; then
wget -qO Apple_II_System_Disk_3.2.sea.bin ${binaryURL}external/appleii/Apple_II_System_Disk_3.2.sea.bin
unar -k skip Apple_II_System_Disk_3.2.sea.bin &> /dev/null
2015-11-09 14:40:44 +00:00
fi
2015-10-03 12:25:44 +00:00
truncate -s 819284 'Apple II System Disk 3.2.sea'
dd if='Apple II System Disk 3.2.sea' of=A2SYSDISK32.HDV bs=84 skip=1 2> /dev/null
2016-01-03 10:13:15 +00:00
cppo -s -ad A2SYSDISK32.HDV /UTILITIES/SYSUTIL.SYSTEM $diskToolsP8Dir/SYSUTIL &> /dev/null
cppo -s -ad A2SYSDISK32.HDV /UTILITIES/UTIL.0 $diskToolsP8Dir &> /dev/null
cppo -s -ad A2SYSDISK32.HDV /UTILITIES/UTIL.1 $diskToolsP8Dir &> /dev/null
cppo -s -ad A2SYSDISK32.HDV /UTILITIES/UTIL.2 $diskToolsP8Dir &> /dev/null
2015-10-03 12:25:44 +00:00
afpsync -v $sharepath > /dev/null
fi
2015-12-08 04:52:00 +00:00
2015-10-03 12:25:44 +00:00
fi
if [[ ! $autoAnswerYes ]]; then
2015-12-08 04:52:00 +00:00
[[ -f "$gsosDir/SYSTEM/START.GS.OS" ]] && gsosInstalled="GS/OS and " || gsosInstalled=
2015-10-03 12:25:44 +00:00
echo
2015-12-08 04:52:00 +00:00
echo "Do you want to download communications software for"
echo -n "$gsosInstalled""ProDOS 8? "
2015-10-03 12:25:44 +00:00
read
fi
if [[ $autoAnswerYes || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
2015-12-08 04:52:00 +00:00
2015-10-03 12:25:44 +00:00
echo "A2SERVER: Downloading communications software..."
mkdir -p $commDir
2015-10-06 06:52:43 +00:00
2015-10-03 12:25:44 +00:00
echo -n "Spectrum"
# get Spectrum
2015-12-08 04:52:00 +00:00
if [[ -f $spectrumDir/SPECTRUM.HDV || -f $spectrumDir/Spectrum ]]; then
2015-10-03 12:25:44 +00:00
echo " is already installed."
else
mkdir -p $spectrumDir
echo
2015-12-24 04:02:17 +00:00
mkdir -p /tmp/netboot/spectrum
cd /tmp/netboot/spectrum
2015-11-23 08:18:27 +00:00
if [[ ! -f $gsosDir/SYSTEM/START.GS.OS ]]; then
2015-12-08 04:52:00 +00:00
#if true; then
2015-11-23 08:18:27 +00:00
# provide disk images for MountIt if no GS/OS present
2015-12-24 04:02:17 +00:00
for filename in spectrum.2mg spectrum_extras.2mg spectrum_sounds.2mg spectrum_manuals.2mg; do
if [[ $useExternalURL ]]; then
wget -qO $filename http://www.speccie.co.uk/speccie/software/$filename
fi
if [[ $? -ne 0 || ! -f $filename ]]; then
wget -qO $filename ${binaryURL}external/appleii/spectrum/$filename
fi
dd bs=64 skip=1 if=$filename of=$spectrumDir/${filename,,}.HDV 2> /dev/null
done
echo -n "The Spectrum installer disk image files can be converted to floppy disks with Asimov or DSK2FILE, or mounted directly with MountIt. If using MountIt, mount bouth SPECTRUM.HDV and EXTRAS.HDV before running the installer." > $spectrumDir/SPECTRUM.README
2015-11-23 08:18:27 +00:00
afpsync -v $gsosDir > /dev/null
afptype -p TXT -q $spectrumDir/SPECTRUM.README
else
# install Spectrum into GS/OS
2015-12-24 04:02:17 +00:00
if [[ $useExternalURL ]]; then
wget -qO spectrum_gold_2mg.zip http://www.speccie.co.uk/speccie/software/spectrum_gold_2mg.zip
unzip -p spectrum_gold_2mg.zip 2> /dev/null | dd bs=64 skip=1 of=Spectrum.Gold.HDV 2> /dev/null
fi
if [[ ! -f Spectrum.Gold.2mg ]]; then
wget -qO spectrum_gold_2mg.zip ${binaryURL}external/appleii/spectrum/spectrum_gold_2mg.zip
unzip -p spectrum_gold_2mg.zip 2> /dev/null | dd bs=64 skip=1 of=Spectrum.Gold.HDV 2> /dev/null
fi
2016-01-03 10:13:15 +00:00
cppo -s -ad Spectrum.Gold.HDV . &> /dev/null
2015-11-23 08:18:27 +00:00
userFolder=$(tr [:lower:] [:upper:] <<< $USER)
for thisFolder in \
2015-12-08 04:52:00 +00:00
Installer/Extras/CDEvs^System/CDevs \
Installer/Extras/Tools^System/Tools \
Installer/Extras/Fonts^System/Fonts \
Installer/Extras/System.Setup^System/System.Setup \
Installer/Help^System/Desk.Accs \
Installer/Spectrum.Sounds^System/Sounds \
Spectrum.2.5.4/Add.Ons^USERS/$userFolder/Add.Ons \
Spectrum.2.5.4/Spectrum.Script^USERS/$userFolder/Spectrum.Script \
Spectrum.2.5.4/Add.Ons^Comm/Spectrum/Add.Ons \
Spectrum.2.5.4/Spectrum.Script^Comm/Spectrum/Spectrum.Script \
Manuals^Comm/Spectrum/Manuals
2015-11-23 08:18:27 +00:00
do
mkdir -p $gsosDir/"${thisFolder##*^}"
2015-12-08 04:52:00 +00:00
cp -R Spectrum.Gold/${thisFolder%%^*}/* $gsosDir/"${thisFolder##*^}"
2015-11-23 08:18:27 +00:00
mkdir -p $gsosDir/"${thisFolder##*^}"/.AppleDouble
2015-12-08 04:52:00 +00:00
cp -R Spectrum.Gold/${thisFolder%%^*}/.AppleDouble/* $gsosDir/"${thisFolder##*^}"/.AppleDouble
2015-11-23 08:18:27 +00:00
done
2015-12-08 04:52:00 +00:00
mv Spectrum.Gold/Installer/SoundPatch Spectrum.Gold/Spectrum.2.5.4/Spectrum $spectrumDir
2015-11-23 08:18:27 +00:00
mkdir -p $spectrumDir/.AppleDouble
2015-12-08 04:52:00 +00:00
mv Spectrum.Gold/Installer/.AppleDouble/SoundPatch Spectrum.Gold/Spectrum.2.5.4/.AppleDouble/Spectrum $spectrumDir/.AppleDouble
2015-11-23 08:18:27 +00:00
afpsync -v $gsosDir > /dev/null
fi
2015-10-03 12:25:44 +00:00
fi
echo -n "ProTERM and Z-Link"
# get A2CLOUD disk and copy from there
2015-12-08 04:52:00 +00:00
if [[ -f $protermDir/PROTERM ]]; then
2015-10-03 12:25:44 +00:00
echo " are already installed."
else
mkdir -p $protermDir
mkdir -p $protermDir/.AppleDouble
mkdir -p $zlinkDir
mkdir -p $zlinkDir/.AppleDouble
echo
cd /tmp/netboot
2015-12-24 04:02:17 +00:00
wget -qO A2CLOUD.HDV "${binaryURL}A2CLOUD.HDV"
2016-01-03 10:13:15 +00:00
cppo -ad A2CLOUD.HDV . &> /dev/null
2015-10-03 12:25:44 +00:00
cd A2CLOUD
mv *PT3* *PROTERM* $protermDir
mv Z.LINK $zlinkDir
cd .AppleDouble
mv *PT3* *PROTERM* $protermDir/.AppleDouble
mv Z.LINK $zlinkDir/.AppleDouble
afpsync -v $gsosDir > /dev/null
2015-12-08 04:52:00 +00:00
fi
2015-10-03 12:25:44 +00:00
echo -n "ADTPro and VSDRIVE"
2015-12-08 04:52:00 +00:00
if [[ -f $adtproDir/ADTPRO ]]; then
2015-10-03 12:25:44 +00:00
echo " are already installed."
else
mkdir -p $adtproDir
mkdir -p $adtproDir/.AppleDouble
echo
cd /tmp/netboot/A2CLOUD
mv *ADTPRO* *VEDRIVE* *VSDRIVE* $adtproDir
cd .AppleDouble
mv *ADTPRO* *VEDRIVE* *VSDRIVE* $adtproDir/.AppleDouble
afpsync -v $gsosDir > /dev/null
2015-12-08 04:52:00 +00:00
fi
2015-10-03 12:25:44 +00:00
fi
2015-12-08 04:52:00 +00:00
2015-10-03 12:25:44 +00:00
# clean up
cd
2015-12-08 04:52:00 +00:00
2015-10-03 12:25:44 +00:00
# rock and roll!
echo
2015-12-08 04:52:00 +00:00
2015-10-03 12:25:44 +00:00
echo
2015-11-09 14:40:44 +00:00
if [[ $gsosInstall ]]; then
2015-10-03 12:25:44 +00:00
echo "GS/OS network boot (for registered user and Guest) and"
fi
echo "ProDOS 8 network boot (for Guest only) is now configured."
2015-12-24 04:02:17 +00:00
echo "See http://ivanx.com/a2server for info using it."
2015-12-08 04:52:00 +00:00
2015-10-03 12:25:44 +00:00
fi
if [[ ! $autoAnswerYes ]]; then
echo
echo "Do you want to download the patch required for using"
echo -n "a Farallon LocalTalk-to-Ethernet bridge with GS/OS? "
read
fi
if [[ $autoAnswerYes || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
2015-12-08 04:52:00 +00:00
# Farallon bridge patch for GS/OS courtesy of Geoff Body
2015-10-03 12:25:44 +00:00
echo "A2SERVER: Downloading Farallon bridge patch..."
2015-12-24 04:02:17 +00:00
wget -O /tmp/FARALLON.PO "${binaryURL}FARALLON.B1.PO" &> /dev/null
2015-10-03 12:25:44 +00:00
if [[ -d $gsosDir/SYSTEM/SYSTEM.SETUP ]]; then
cppo -s -ad /tmp/FARALLON.PO /ATALKPATCH/ATALKIRQ $gsosDir/SYSTEM/SYSTEM.SETUP &> /dev/null
echo
echo "A2SERVER: The Farallon bridge patch is installed."
else
cppo -s -ad /tmp/FARALLON.PO /ATALKPATCH/ATALKIRQ $gsosDir &> /dev/null
echo
echo "On your Apple IIgs, copy the file ATALKIRQ in /A2SHARED to the"
echo "SYSTEM.SETUP folder of the SYSTEM folder of your GSOS startup disk,"
echo "or, if you can't, download the patch from the A2SERVER web site."
fi
echo
echo "Note: Farallon bridges can only be used in GS/OS (with this patch)"
echo "and Apple IIe computers. Apple IIgs computers which network boot"
echo "directly into ProDOS 8 will freeze after a few minutes."
fi
2015-10-04 08:23:53 +00:00
fi