Add the rest of the setup scripts

This commit is contained in:
T. Joseph Carter 2015-10-23 05:09:22 -07:00
parent 8baf146f87
commit f248c68ab9
6 changed files with 1204 additions and 0 deletions

View File

@ -0,0 +1,19 @@
#!/bin/bash
# --- Setting up the share volume
# skip if we're already set up
if [[ -d /media/A2SHARED ]]; then
echo "A2SERVER: Shared disk is already prepared for use."
else
echo "A2SERVER: Preparing the shared files disk..."
sudo mkdir /media/A2SHARED
sudo chown $USER:$USER /media/A2SHARED
fi

View File

@ -0,0 +1,126 @@
#!/bin/bash
# download and install a2server tools:
# mkatinit, mkvolinfo, afptype, afpsync, aliases, nulib2
isRpi=
[[ -f /usr/bin/raspi-config ]] && isRpi=1
isDebian=
[[ ( -f /etc/debian_version ) && ( $(cut -c 1-2 < /etc/debian_version) == "7." ) && ( $(uname -m) == "i686" ) ]] && isDebian=1
echo "A2SERVER: Installing A2SERVER tools..."
if [[ ! -f /usr/local/bin/nulib2 ]]; then
echo "A2SERVER: Installing nulib2..."
cd /tmp
if [[ $isRpi ]]; then
wget -qO- ivanx.com/a2server/files/nulib2-rpi.tgz | sudo tar Pzx
elif [[ $isDebian ]]; then
wget -qO- ivanx.com/a2server/files/nulib2-debian7_x86.tgz | sudo tar Pzx
fi
if [[ ! -f /usr/local/bin/nulib2 ]]; then
if [[ ! -f /tmp/a2server-packageReposUpdated ]]; then
# prepare for installing packages
sudo apt-get -y update
touch /tmp/a2server-packageReposUpdated
fi
sudo apt-get -y install build-essential
sudo apt-get -y install zlib1g-dev
sudo apt-get -y clean
cd /tmp
rm -rf /tmp/nulib &> /dev/null
mkdir /tmp/nulib
cd /tmp/nulib
wget -q -O nulib.tgz http://web.archive.org/web/20131031160750/http://www.nulib.com/downloads/nulibdist.tar.gz
tar zxf nulib.tgz
cd nufxlib*
./configure
make
sudo make install
cd ../nulib2*
./configure
make
sudo make install
cd
rm -rf /tmp/nulib
fi
else
echo "A2SERVER: Nulib2 has already been installed."
fi
# download and install The Unarchiver, for expanding Apple disk images
# http://wakaba.c3.cx/s/apps/unarchiver.html
if [[ ! -f /usr/local/bin/unar ]]; then
echo "A2SERVER: Installing The Unarchiver..."
if [[ ! -f /tmp/a2server-packageReposUpdated ]]; then
# prepare for installing packages
sudo apt-get -y update
touch /tmp/a2server-packageReposUpdated
fi
if [[ $isRpi || $isDebian ]]; 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
elif [[ $isDebian ]]; then
wget -qO- ivanx.com/a2server/files/unar-debian7_x86.tgz | sudo tar Pzx
fi
fi
if [[ ! -f /usr/local/bin/unar ]]; then
sudo apt-get -y install build-essential
sudo apt-get -y install libgnustep-base-dev libz-dev libbz2-dev
sudo apt-get -y install libssl-dev libicu-dev unzip
sudo apt-get clean
rm -rf /tmp/unar &> /dev/null
mkdir /tmp/unar
cd /tmp/unar
wget -qO unar1.7_src.zip http://theunarchiver.googlecode.com/files/unar1.7_src.zip
unzip -o unar1.7_src.zip
cd The\ Unarchiver/XADMaster
make -f Makefile.linux
sudo mv lsar unar /usr/local/bin
cd ../Extra
sudo mv lsar.1 unar.1 /usr/local/man/man1
cd
rm -rf /tmp/unar
fi
sudo mandb &> /dev/null
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 chmod ugo+x /usr/local/bin/afpsync
sudo wget -q -O /usr/local/bin/afptype appleii.ivanx.com/a2server/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 chmod ugo+x /usr/local/bin/mkatinit
sudo wget -q -O /usr/local/bin/mkvolinfo appleii.ivanx.com/a2server/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 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
grep a2server-aliases /etc/bash.bashrc > /dev/null || \
echo "source /usr/local/etc/a2server-aliases" | sudo tee -a /etc/bash.bashrc > /dev/null
[[ $(lsb_release -d 2> /dev/null | grep Ubuntu) ]] && motd="/etc/issue" || motd="/etc/motd"
if [[ ! $(grep A2SERVER $motd) ]]; then
echo | sudo tee -a $motd > /dev/null
echo "Type 'system-shutdown' to turn off A2SERVER." | sudo tee -a $motd > /dev/null
echo "Type 'a2server-setup' to configure network boot." | sudo tee -a $motd > /dev/null
echo "Type 'a2server-help' for a list of other commands." | sudo tee -a $motd > /dev/null
echo | sudo tee -a $motd > /dev/null
fi

View File

@ -0,0 +1,415 @@
#!/bin/bash
# A2SERVER -- a virtual machine for sharing files to Apple II clients
# by Ivan X, ivan@ivanx.com
# Installs Netatalk 2.2.4 for debian/raspbian (Wheezy) or Ubuntu (12.04)
# last update: 3-Mar-15
# The lastest version of this document, and the ready-to-use premade
# virtual machine, will be at http://appleii.ivanx.com .
# Please send corrections and comments to ivan@ivanx.com
# Thanks to Steven Hirsch, Geoff Body, Peter Wong, Tony Diaz, and others
# at comp.sys.apple2 for the work they've done and insight they've
# offered which made it possible to put this together.
# --- Installing netatalk
isRpi=
[[ -f /usr/bin/raspi-config ]] && isRpi=1
isDebian=
[[ ( -f /etc/debian_version ) && ( $(cut -c 1-2 < /etc/debian_version) == "7." ) && ( $(uname -m) == "i686" ) ]] && isDebian=1
# skip this if already done
if [[ -f /usr/local/etc/A2SERVER-version ]] && (( $(cat /usr/local/etc/A2SERVER-version) >= 101 )); then
echo "A2SERVER: Netatalk is already installed."
else
echo "A2SERVER: Installing Netatalk (this will take a while)..."
# stop Netatalk if running (during upgrade)
[[ $(ps --no-headers -C afpd) ]] && sudo /etc/init.d/netatalk stop
if [[ ! -f /tmp/a2server-packageReposUpdated ]]; then
# prepare for installing packages
sudo apt-get -y update
touch /tmp/a2server-packageReposUpdated
fi
compileFromSource=1
while [[ $isRpi || $isDebian ]]; do
# Install runtime libraries needed by Netatalk
if [[ $(apt-cache search '^libdb4.8$') ]]; then
sudo apt-get -y install libdb4.8
elif [[ $(apt-cache search '^libdb5.1$') ]]; then
sudo apt-get -y install libdb5.1
else
break
fi
if [[ $(apt-cache search '^libssl1.0.0$') ]]; then
sudo apt-get -y install libssl1.0.0
elif [[ $(apt-cache search '^libssl0.9.8$') ]]; then
sudo apt-get -y install libssl0.9.8
else
break
fi
if [[ $(apt-cache search '^libgcrypt11$') ]]; then
sudo apt-get -y install libgcrypt11
else
break
fi
# install Netatalk
if [[ $isRpi ]]; then
{ wget -qO- /tmp/netatalk.tgz ivanx.com/a2server/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
fi
sudo mandb &> /dev/null
[[ -f /usr/local/sbin/atalkd ]] && compileFromSource=
break
done
if [[ $compileFromSource ]]; then
# Install development libraries needed by Netatalk
sudo apt-get -y install build-essential
if [[ $(apt-cache search '^libdb4.8-dev$') ]]; then
sudo apt-get -y install libdb4.8-dev
elif [[ $(apt-cache search '^libdb5.1-dev$') ]]; then
sudo apt-get -y install libdb5.1-dev
else
echo "A2SERVER: WARNING: unknown version of libdb-dev is being installed"
sudo apt-get -y install libdb-dev
fi
sudo apt-get -y install libssl-dev
sudo apt-get -y install libgcrypt11-dev
sudo apt-get clean
# get Netatalk
rm -rf /tmp/netatalk &> /dev/null
mkdir /tmp/netatalk
cd /tmp/netatalk
wget -q "http://downloads.sourceforge.net/project/netatalk/netatalk/2.2.4/netatalk-2.2.4.tar.gz"
tar zxf netatalk-2.2.4.tar.gz
cd netatalk-2.2.4
# Patch the source so file dates are preserved during a GS/OS folder copy,
# and the AsanteTalk bridge consistently starts up in AppleTalk Phase 2
# and the Dayna bridge doesn't crash GS/OS
# props to Steven Hirsch for these
sed -i ':a;N;$!ba;s/case FILPBIT_ATTR :\n *change_mdate = 1;\n/case FILPBIT_ATTR :\n/g' etc/afpd/file.c
sed -i 's/rtmp->rt_iface == iface/rtmp->rt_iface != iface/g' etc/atalkd/main.c
# prepare to build Netatalk
./configure --enable-debian --enable-ddp --enable-a2boot
# uninstall Netatalk if already installed
[[ -f /usr/local/sbin/afpd ]] && sudo make uninstall
# compile and install Netatalk
make
sudo make install
# to remove the Netatalk source code (optional), type:
cd
rm -rf /tmp/netatalk
fi
fi
# --- Configuring Netatalk
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
fi
# make the Netatalk startup script work correctly
sudo sed -i 's/bin\/sh/bin\/bash/' /etc/init.d/netatalk
# enable AppleTalk networking support in Netatalk, and run in background
sudo sed -i 's/#ATALKD_RUN=no/ATALKD_RUN=yes/' /etc/default/netatalk
sudo sed -i 's/#ATALK_BGROUND=no/ATALK_BGROUND=yes/' /etc/default/netatalk
if [[ ! $(grep 'kernelRelease' /etc/init.d/netatalk) ]]; then
sudo sed -i 's@\(\tif \[ x\"$ATALKD_RUN\)@\n\t# check for valid AppleTalk kernel module\n\t[[ $ATALKD_RUN == "yes" ]] \&\& { kernelRelease=$(uname -r); kernelMajorRelease=$(cut -d "." -f 1 <<< $kernelRelease); kernelMinorRelease=$(cut -d "." -f 2 <<< $kernelRelease | sed '"'"'s/\\(^[0-9]*\\)[^0-9].*$/\\1/'"'"'); kernelPatchRelease=$(cut -d "." -f 3- <<< $kernelRelease | sed '"'"'s/\\(^[0-9]*\\)[^0-9].*$/\\1/'"'"'); [[ ( $kernelMajorRelease -eq 3 \&\& $kernelMinorRelease -ge 12 \&\& $kernelMinorRelease -le 15 ) \&\& ( ! ( -f /usr/bin/raspi-config \&\& $kernelMinorRelease -eq 12 \&\& $kernelPatchRelease -ge 25 ) ) \&\& ( ( ! -f /lib/modules/$kernelRelease/kernel/net/appletalk/appletalk.ko ) || $(sha1sum /lib/modules/$kernelRelease/kernel/net/appletalk/appletalk.ko | cut -f 1 -d " ") != "ecb239fc084c36de93f6926e7749b80f6024f269" ) ]] \&\& { ATALKD_RUN=no; echo "[AppleTalk networking is not available.]" 1>\&2; } }\n\n\1@' /etc/init.d/netatalk
fi
# enable network boot support in netatalk
sudo sed -i 's/timelord/a2boot/g' /etc/init.d/netatalk
sudo sed -i 's/TIMELORD/A2BOOT/g' /etc/init.d/netatalk
sudo sed -i 's/#A2BOOT_RUN=no/A2BOOT_RUN=yes/' /etc/default/netatalk
# allow Guest users to be able to network boot
sudo sed -i "s/#AFPD_GUEST=nobody/AFPD_GUEST=$USER/" /etc/default/netatalk
# (For a Guest user with different permissions than the compile-time user, create a
# Linux user, and then specify that user for AFPD_GUEST instead.)
# create a symbolic link to the startup configuration file in netatalk configuration folder
[[ -L /usr/local/etc/netatalk/netatalk.conf ]] \
|| sudo ln -s /etc/default/netatalk /usr/local/etc/netatalk/netatalk.conf
# create a symbolic link to the netatalk configuration folder in /etc
[[ -L /etc/netatalk ]] || sudo ln -s /usr/local/etc/netatalk /etc/netatalk
if [[ ! $(grep '^- -ddp.*uams_randnum.so' /usr/local/etc/netatalk/afpd.conf) ]]; then
# set up to allow Guest, Cleartext, RandNum, DHX, and DHX2 login
# disable DHX (DHCAST128) on Raspberry Pi, which refuses uams if the config string is too long
[[ -f /usr/bin/raspi-config ]] && dhx="" || dhx="uams_dhx.so,"
echo -n -e \
"- -ddp -tcp -uamlist uams_guest.so,uams_clrtxt.so,uams_randnum.so" \
| sudo tee -a /usr/local/etc/netatalk/afpd.conf > /dev/null
echo -e ",${dhx}uams_dhx2.so" \
| sudo tee -a /usr/local/etc/netatalk/afpd.conf > /dev/null
fi
# replace home folder share and end of file mark with share placeholders
sudo sed -i 's/^~/#share1\n\n#share2/' \
/usr/local/etc/netatalk/AppleVolumes.default
# disable default volume options for Mac OS X clients
sudo sed -i 's/^:DEFAULT/#:DEFAULT/' \
/usr/local/etc/netatalk/AppleVolumes.default
if [[ ! $(grep ^eth0 /usr/local/etc/netatalk/atalkd.conf) && ! $(grep ^wlan0 /usr/local/etc/netatalk/atalkd.conf) ]]; then
# enable netatalk on the default network interface
# needs -router and -zone to prevent GS/OS AppleShare CDEV crash when used
# with Dayna or Asante bridges
echo -e 'eth0 -router -phase 2 -net 1 -zone "A2SERVER"' \
| sudo tee -a /usr/local/etc/netatalk/atalkd.conf > /dev/null
fi
# Raspberry Pi
if [[ $isRpi ]]; then
# blink LED upon netatalk startup so you know when to attach power to an AsanteTalk bridge
if [[ ! $(grep 'led0' /etc/init.d/netatalk) ]]; then
sudo sed -i ':a;N;$!ba;s/fi\n}/fi\n\n # blink LED on Raspberry Pi\n ([[ -e \/sys\/class\/leds\/ACT ]] \&\& led=ACT || led=led0; echo none > \/sys\/class\/leds\/$led\/trigger; for i in {1..20}; do echo 1 > \/sys\/class\/leds\/$led\/brightness; sleep 0.25; echo 0 > \/sys\/class\/leds\/$led\/brightness; sleep 0.25; done; echo mmc0 > \/sys\/class\/leds\/$led\/trigger) \&\n}/' /etc/init.d/netatalk
fi
# set console port login to 4800 bps for usage with Apple II (using RPi console cable)
sudo sed -i 's/ttyAMA0 115200/ttyAMA0 4800/' /etc/inittab
# enable serial console login with USB-serial adapter
# 10-4-13: creates unwanted console messages if no adapter present,
# and physical port isn't predictable with more than one adapter present, so
# has been superseded by scanttyUSB supplied by A2CLOUD install
#if [[ ! $(grep 'ttyUSB0 19200' /etc/inittab) ]]; then
# echo -e "\n\n#for USB-to-serial adapter with Prolific PL2303 chipset\nT1:23:respawn:/sbin/getty -L ttyUSB0 19200 vt100" | sudo tee -a /etc/inittab > /dev/null
#fi
fi
# set up GSFILES share (for GS data files, not GSOS system)
# classic Mac OS file names are allowed (31 chars, mixed case, everything but colons)
sudo sed -i \
's/^#share1/\/media\/A2SHARED\/GSFILES\ GSFILES ea:ad/' \
/usr/local/etc/netatalk/AppleVolumes.default
[[ -d /media/A2SHARED/GSFILES ]] || mkdir -p /media/A2SHARED/GSFILES
# set up A2FILES share (for ProDOS 8 files, and GS/OS system)
# file names must be ProDOS 8 compliant (all caps, 15 chars, letters/numbers/periods only)
# lowercase filenames will be converted to upper automatically
# need for GS/OS system because it may refer to files by either upper or lower
sudo sed -i \
's/^#share2/\/media\/A2SHARED\/A2FILES\ A2FILES options:prodos\ casefold:toupper ea:ad/' \
/usr/local/etc/netatalk/AppleVolumes.default
[[ -d /media/A2SHARED/A2FILES ]] || mkdir -p /media/A2SHARED/A2FILES
if [[ ! -d /media/A2SHARED/A2FILES/.AppleDesktop ]]; then
cd /media/A2SHARED/A2FILES
mkdir .AppleDesktop
ln -s .AppleDesktop .APPLEDESKTOP
fi
# set up ADTDISKS share (ADTPro disk image folder, if A2CLOUD is installed)
# classic Mac OS file names are allowed (31 chars, mixed case, everything but colons)
if [[ -d /usr/local/adtpro/disks ]]; then # A2CLOUD/ADTPro installed
if [[ ! -d /media/A2SHARED/ADTDISKS ]]; then
ln -s /usr/local/adtpro/disks /media/A2SHARED/ADTDISKS
fi
if [[ ! $(grep ADTDISKS /usr/local/etc/netatalk/AppleVolumes.default) ]]; then
sudo sed -i 's@^# End of File@/media/A2SHARED/ADTDISKS ADTDISKS ea:ad\n\n# End of File@' /usr/local/etc/netatalk/AppleVolumes.default
fi
fi
# to make Netatalk start up when the server boots:
sudo update-rc.d netatalk defaults &> /dev/null
# --- Setting up users
# At this point, the server is usable for Guest access.
# skip if we've already done this
if [[ -f /usr/local/etc/netatalk/afppasswd ]]; then
echo "A2SERVER: Netatalk user logins have already been set up."
else
echo
echo "A2SERVER: Setting up AFP password 'apple2' for Apple II and Mac clients."
# echo "A2SERVER: Enter 'apple2' or another password of up to eight characters."
echo
# set registered user login using RandNum authentication
sudo afppasswd -c
sudo sed -i 's/^pi.*$/pi:6170706C65320000:****************:********/' /usr/local/etc/netatalk/afppasswd
# while [[ ! $(sudo afppasswd -a $USER) ]]; do
# true
# done
# (The afppasswd -c only needs to ever be done once. You can repeat
# the afppasswd -a to make Netatalk logins for other Linux users.)
fi
# Check AppleTalk kernel module for existence and validity
# get Kernel release (e.g. 3.6.11+) and version (e.g. #557)
kernelRelease=$(uname -r)
kernelMajorRelease=$(cut -d '.' -f 1 <<< $kernelRelease)
kernelMinorRelease=$(cut -d '.' -f 2 <<< $kernelRelease | sed 's/\(^[0-9]*\)[^0-9].*$/\1/')
kernelPatchRelease=$(cut -d '.' -f 3- <<< $kernelRelease | sed 's/\(^[0-9]*\)[^0-9].*$/\1/')
# if on kernel 3.12 through 3.15, check if we need to delete AppleTalk module to prevent kernel panics
if [[ $kernelMajorRelease -eq 3 && $kernelMinorRelease -ge 12 && $kernelMinorRelease -le 15 ]]; then
# if not RPi, or RPi without ivanx-fixed AppleTalk module, delete the module
if [[ ! ( $isRpi && $kernelMinorRelease -eq 12 && $kernelPatchRelease -ge 25 ) ]]; then
if [[ -f /lib/modules/$kernelRelease/kernel/net/appletalk/appletalk.ko ]]; then
if [[ $(sha1sum /lib/modules/$kernelRelease/kernel/net/appletalk/appletalk.ko | cut -f 1 -d ' ') != "ecb239fc084c36de93f6926e7749b80f6024f269" ]]; then
# stop Netatalk
sudo /etc/init.d/netatalk stop &> /dev/null
echo "A2SERVER: Deleting defective AppleTalk kernel module."
sudo rmmod appletalk 2> /dev/null
sudo rm -r /lib/modules/$kernelRelease/kernel/net/appletalk
# disable single-user mode on Pi (other Linux can use Recovery boot)
if [[ $isRpi && $(grep ' single' /boot/cmdline.txt 2> /dev/null) ]]; then
echo "A2SERVER: Disabling single-user mode for next boot."
sudo sed -i 's/ single//' /boot/cmdline.txt
touch /tmp/singleUser # so note to restart can display following install
fi
fi
fi
fi
fi
# --- Start Netatalk (if not running)
bground=
if [[ $(grep 'ATALK_BGROUND=yes' /etc/default/netatalk) ]]; then
bground=1
sudo sed -i 's/ATALK_BGROUND=yes/ATALK_BGROUND=no/' /etc/default/netatalk
fi
[[ $(ps --no-headers -C afpd) ]] || sudo /etc/init.d/netatalk start 2> /dev/null
echo
echo "A2SERVER: Netatalk is installed, configured, and running."
echo
# if atalkd isn't running (no AppleTalk), and this is a Rasbperry Pi:
if [[ ( ! $(ps aux | grep [a]talkd) ) && ( $isRpi ) ]]; then
# if AppleTalk module exists, try to load it
if [[ -f /lib/modules/$kernelRelease/kernel/net/appletalk/appletalk.ko ]]; then # module present, but not loaded?
sudo depmod
sudo modprobe appletalk
if [[ $(lsmod | grep appletalk) ]]; then
# if it loaded, restart netatalk
sudo sed -i "s/ATALKD_RUN=no/ATALKD_RUN=yes/" /etc/default/netatalk; sudo /etc/init.d/netatalk restart
else
# if we didn't load it successfully, delete it
sudo rm -r /lib/modules/$kernelRelease/kernel/net/appletalk
fi
fi
# 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
if [[ $? -eq 0 ]]; then
# if we found a prebuilt one on a2server site, install it and load it
gunzip -f /tmp/appletalk.ko.gz
sudo mkdir -p /lib/modules/$kernelRelease/kernel/net/appletalk
sudo mv /tmp/appletalk.ko /lib/modules/$kernelRelease/kernel/net/appletalk
sudo depmod
sudo modprobe appletalk
if [[ $(lsmod | grep appletalk) ]]; then
# if it loaded, restart netatalk
sudo sed -i "s/ATALKD_RUN=no/ATALKD_RUN=yes/" /etc/default/netatalk; sudo /etc/init.d/netatalk restart
else
# if we didn't load it successfully, remove it
sudo rm -r /lib/modules/$kernelRelease/kernel/net/appletalk 2> /dev/null
fi
fi
# if we still don't have AppleTalk, try to use rpi-update
rm /tmp/rpiUpdate 2> /dev/null
if [[ ! $(ps aux | grep [a]talkd) ]]; then
# use specific rpi-update commit (at https://github.com/Hexxeh/rpi-firmware/)
# from when AppleTalk was added/fixed, so we have a consistent firmware that
# we're loading until the next proper release of Raspbian that includes it
#
# 10-26-13: when AppleTalk was added to Raspbian:
# sudo rpi-update 9530adbe31fe6b8e05b3bd5cfadfc90f067f5362
# sudo modprobe appletalk 2> /dev/null
# if [[ $(lsmod | grep appletalk) ]]; then
# if it loaded, restart netatalk
# sudo sed -i "s/ATALKD_RUN=no/ATALKD_RUN=yes/" /etc/default/netatalk; sudo /etc/init.d/netatalk restart
# fi
#
# 07-23-14: when AppleTalk was fixed after kernel panics in Raspbian 2014-06-20 (kernel 3.12.22+)
sudo rm /boot/.firmware_revision
sudo rpi-update cfd9a203590737f9536de70a1e01db25a3e8e069
touch /tmp/rpiUpdate # so note to restart can display following install
fi
if [[ ! $(ps aux | grep [a]talkd) ]]; then
if [[ -f /tmp/rpiUpdate ]]; then
echo
echo "AppleTalk networking is installed but not yet active."
echo "When installation is complete, please restart your Raspberry Pi"
echo "when asked or by typing 'system-restart' at the Linux prompt"
echo "to allow Apple II computers to connect."
echo
else
echo
echo "AppleTalk networking could not be activated"
echo "for your Raspbian kernel version ($kernelRelease)."
echo "Please try restarting with 'system-restart'. If that doesn't work,"
echo "you're not going to be able to connect from an Apple II."
echo "See http://appleii.ivanx.com/a2server for help."
echo
fi
fi
fi
fi
if [[ $bground ]]; then
sudo sed -i 's/ATALK_BGROUND=no/ATALK_BGROUND=yes/' /etc/default/netatalk
fi
# --- Set up Avahi-Daemon (Bonjour/mDNS)
# thanks to: http://missingreadme.wordpress.com/2010/05/08/how-to-set-up-afp-filesharing-on-ubuntu
if [[ ! $(dpkg -l avahi-daemon 2> /dev/null | grep ^ii) || ! $(dpkg -l libnss-mdns 2> /dev/null | grep ^ii) ]]; then
echo "A2SERVER: Installing Avahi-Daemon (Bonjour/mDNS)..."
if [[ ! -f /tmp/a2server-packageReposUpdated ]]; then
# prepare for installing packages
sudo apt-get -y update
touch /tmp/a2server-packageReposUpdated
fi
sudo apt-get -y install avahi-daemon libnss-mdns &> /dev/null
fi
sudo sed -i 's/^\(hosts.*\)$/\1 mdns/' /etc/nsswitch.conf
if [[ ! -f /etc/avahi/services/afpd.service && ! -f /etc/avahi/services/afpd.service_disabled ]]; then
echo -e '<?xml version="1.0" standalone="no"?><!--*-nxml-*-->\n<!DOCTYPE service-group SYSTEM "avahi-service.dtd">\n<service-group>\n <name replace-wildcards="yes">%h</name>\n <service>\n <type>_afpovertcp._tcp</type>\n <port>548</port>\n </service>\n <service>\n <type>_device-info._tcp</type>\n <port>0</port>\n <txt-record>model=MacPro</txt-record>\n </service>\n</service-group>' | sudo tee /etc/avahi/services/afpd.service > /dev/null
fi
sudo /etc/init.d/avahi-daemon restart &> /dev/null

View File

@ -0,0 +1,444 @@
#!/bin/bash
# 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.
gsosDir="/media/A2SHARED/A2FILES"
imagesDir=$gsosDir/GSOS.INSTALLER/IMAGES
imageToolsDir=$gsosDir/GSOS.INSTALLER/IMAGE.TOOLS
netInstallDir=$gsosDir/GSOS.INSTALLER/NET.INSTALL
p8Dir="/media/A2SHARED/A2FILES"
diskToolsP8Dir=$p8Dir/DISK.TOOLS.P8
commDir="/media/A2SHARED/A2FILES/COMM"
spectrumDir=$commDir/SPECTRUM
protermDir=$commDir/PROTERM
zlinkDir=$commDir/Z.LINK
adtproDir=$commDir/ADTPRO
# 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
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
if [[ $autoAnswerYes || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
nbmode=1
echo
sudo true
mkdir -p /tmp/netboot
cd /tmp/netboot
# this will get "Disk 7" (Apple II Setup) as a raw (block dump) image
if [[ ! -f /usr/local/etc/netatalk/a2boot/ProDOS16\ Boot\ Blocks ]] \
|| [[ ! -f /usr/local/etc/netatalk/a2boot/ProDOS16\ Image ]] \
|| [[ ! -f /usr/local/etc/netatalk/a2boot/Apple\ :2f:2fe\ Boot\ Blocks ]]; then
echo "A2SERVER: Downloading Apple II Boot Blocks..."
cd /tmp/netboot
wget -qO Disk_7_of_7-Apple_II_Setup.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_IIGS_System_6.0.1%2FDisk_7_of_7-Apple_II_Setup.sea.bin
unar -k skip Disk_7_of_7-Apple_II_Setup.sea.bin &> /dev/null
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
# 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'
cd /usr/local/etc/netatalk/a2boot
# 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" | \
sudo dd of='Apple :2f:2fe Boot Blocks' bs=19779 seek=1 conv=notrunc 2> /dev/null
echo -n -e "\xA8\xA2\x01\xBD\x80\x10\x99\xA0\x10\xC8\xE8\xE0\x09\x90\xF4" | \
sudo dd of='ProDOS16 Image' bs=22583 seek=1 conv=notrunc 2> /dev/null
# 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" | \
sudo dd of='ProDOS16 Image' bs=1661 seek=1 conv=notrunc 2> /dev/null
fi
echo "A2SERVER: Boot Blocks have been installed."
# get a2server-tools if necessary
if [[ ! -f /usr/local/bin/mkatinit ]] \
|| [[ ! -f /usr/local/bin/afptype ]] \
|| [[ ! -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
chmod ugo+x /tmp/2.tools
/tmp/2.tools
rm /tmp/2.tools
fi
# put BASIC.SYSTEM at root for ProDOS 8 startup
cp -p /usr/local/etc/netatalk/a2boot/Basic.System $gsosDir/BASIC.SYSTEM
afpsync -v $gsosDir > /dev/null
afptype -p SYS -q $gsosDir/BASIC.SYSTEM
# 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" | \
sudo dd of="$p8Dir/NETBOOT.P8" 2> /dev/null
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" | \
sudo dd of="$p8Dir/NETBOOT.GSOS" 2> /dev/null
afpsync -v $gsosDir > /dev/null
afptype -p SYS -q $gsosDir/NETBOOT.GSOS
fi
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)
if [[ -f "/media/A2SHARED/A2FILES/SYSTEM/START.GS.OS" ]]; then
echo "A2SERVER: GS/OS has already been downloaded and installed."
gsosInstall=1
else
if [[ ! $autoAnswerYes ]]; then
echo "You can set up GS/OS 6.0.1 on your network drive, for network boot."
echo -n "This may take a while. Download and install it now? "
read
fi
if [[ $autoAnswerYes || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
gsosInstall=1
# get GS/OS disks from Internet Archive and put them in IMAGES
# also dump contents into NET.INSTALL and modify scripts to work from there
# echo
# echo "Come back in a while. This takes a long time."
echo
echo "A2SERVER: Downloading GS/OS 6.0.1 installer disk images..."
cd /tmp/netboot
mkdir -p $imagesDir
mkdir -p $netInstallDir
activeDisk=0
for diskname in Install System.Disk SystemTools1 SystemTools2 Fonts synthLAB; do
outfile="$imagesDir/$(tr [:lower:] [:upper:] <<< $diskname)"
if [ ! -f $outfile ]; then
(( activeDisk++ ))
echo "A2SERVER: Disk ${activeDisk} of 6: $diskname"
wget -qO "Disk_${activeDisk}_of_7-$diskname.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_IIGS_System_6.0.1%2FDisk_${activeDisk}_of_7-$diskname.sea.bin"
unar -k skip "Disk_${activeDisk}_of_7-$diskname.sea.bin" &> /dev/null
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
cppo -s -ad $outfile $netInstallDir 2> /dev/null
fi
done
rm *.sea* &> /dev/null
sed -i "s/\([^\\]\r:\)/\1A2FILES:GSOS.INSTALLER:NET.INSTALL:/g" $netInstallDir/INSTALL/SCRIPTS/*
afpsync -v $gsosDir > /dev/null
# 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)
pathPrefix="/A2FILES/GSOS.INSTALLER/NET.INSTALL"$(tr ':' '/' <<< ${scriptEntries[0]##S*\\\\#})
entryCount=${#scriptEntries[@]}
(( entryCount -= 2 ))
entryIndex=3
while (( entryIndex < entryCount )); do
IFS='#'
scriptEntry=(${scriptEntries[entryIndex]})
# echo $entryIndex $entryCount ${scriptEntry[1]}
action=${scriptEntry[1]:0:1}
sourcePathMixed=$(tr ':' '/' <<< ${scriptEntry[5]})
[[ ${sourcePathMixed:0:1} != '/' ]] && sourcePathMixed="${pathPrefix}/$sourcePathMixed"
sourcePath=$(tr [:lower:] [:upper:] <<< $sourcePathMixed)
targetPath=$gsosDir/$(tr ':' '/' <<< ${scriptEntry[6]} | tr [:lower:] [:upper:])
# volumeName=$(cut -d/ -f 2 <<< $sourcePath)
targetParent=${targetPath%/*}
targetFile=${targetPath##*/}
sourceParent=${sourcePath%/*}
sourceFile=${sourcePath##*/}
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
}
mkdir -p /tmp/netboot
cd /tmp/netboot
echo "A2SERVER: Preparing GS/OS installer scripts..."
# work through installer scripts
processScript $netInstallDir/INSTALL/SCRIPTS/INSTAL.SYS.FILE
processScript $netInstallDir/INSTALL/SCRIPTS/APPLESHARE
processScript $netInstallDir/INSTALL/SCRIPTS/SERVER.SYS.FILE
# sync netatalk database
afpsync -v $gsosDir > /dev/null
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 GS/OS? "
read
fi
if [[ $autoAnswerYes || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
# download image tools and put them in IMAGE.TOOLS
echo "A2SERVER: Downloading GS/OS disk image utilities..."
mkdir -p $imageToolsDir
# get Asimov2 (for GS/OS)
echo -n "Asimov 2.0"
if [[ -f $imageToolsDir/ASIMOV ]]; then
echo " is already installed."
else
echo
cd /tmp/netboot
wget -q -nc http://www.ninjaforce.com/downloads/Asimov.shk
nulib2 -x -s Asimov.shk > /dev/null
cp -p Asimov/Asimov $imageToolsDir/ASIMOV
afpsync -v $gsosDir > /dev/null
cat Asimov/Asimov_rsrc_ >> $imageToolsDir/.AppleDouble/ASIMOV
afptype -p S16 -q $imageToolsDir/ASIMOV
fi
echo -n "GS-ShrinkIt 1.1"
# get GS-ShrinkIt
if [[ -f $imageToolsDir/GSHK ]]; then
echo " is already installed."
else
echo
cd /tmp/netboot
wget -qO gshk.sea http://web.archive.org/web/20131031160750/http://nulib.com/library/gshk11.sea
#wget -qO gshk.sea http://www.nulib.com/library/gshk11.sea
nulib2 -x -s gshk.sea > /dev/null
cp -p GSHK $imageToolsDir/GSHK
afpsync -v $gsosDir > /dev/null
cat GSHK_rsrc_ >> $imageToolsDir/.AppleDouble/GSHK
afptype -p S16 -a DB07 -q $imageToolsDir/GSHK
fi
echo -n "MountIt 1.4"
# get MountIt (for GS/OS)
if [[ -f $imageToolsDir/MOUNTIT.SHK ]]; then
echo " is already installed."
else
echo
cd /tmp/netboot
wget -q -nc http://www.brutaldeluxe.fr/products/apple2gs/MOUNTIT.SHK
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
echo "A2SERVER: Downloading ProDOS 8 disk image utilities..."
mkdir -p $diskToolsP8Dir
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
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
nulib2 -xs shrinkit.sdk > /dev/null
cppo -s -ad SHRINKIT /SHRINKIT/SHRINKIT $diskToolsP8Dir 2> /dev/null
afpsync -v $sharepath > /dev/null
fi
echo -n "DSK2FILE 5.8"
# get DSK2FILE (for ProDOS 8)
if [[ -f $diskToolsP8Dir/DSK2FILE ]]; then
echo " is already installed."
else
echo
cd /tmp/netboot
wget -q -O dsk2file.shk http://www.dwheeler.com/6502/oneelkruns/dsk2file.zip
nulib2 -x -s dsk2file.shk > /dev/null
cp -p DSK2FILE58 $diskToolsP8Dir/DSK2FILE
afpsync -v $sharepath > /dev/null
afptype -p SYS -q $diskToolsP8Dir/DSK2FILE
fi
echo -n "Apple System Utilities 3.1"
if [[ -f $diskToolsP8Dir/SYSUTIL ]]; then
echo " is already installed."
else
echo
cd /tmp/netboot
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
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
cppo -s -ad A2SYSDISK32.HDV /UTILITIES/SYSUTIL.SYSTEM $diskToolsP8Dir/SYSUTIL 2> /dev/null
cppo -s -ad A2SYSDISK32.HDV /UTILITIES/UTIL.0 $diskToolsP8Dir 2> /dev/null
cppo -s -ad A2SYSDISK32.HDV /UTILITIES/UTIL.1 $diskToolsP8Dir 2> /dev/null
cppo -s -ad A2SYSDISK32.HDV /UTILITIES/UTIL.2 $diskToolsP8Dir 2> /dev/null
afpsync -v $sharepath > /dev/null
fi
fi
if [[ ! $autoAnswerYes ]]; then
echo
echo "Do you want to download serial communications software for"
echo -n "GS/OS and ProDOS 8? "
read
fi
if [[ $autoAnswerYes || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
echo "A2SERVER: Downloading communications software..."
mkdir -p $commDir
echo -n "Spectrum"
# get Spectrum
if [[ -f $commDir/SPECTRUM/SPECTRUM.HDV ]]; then
echo " is already installed."
else
mkdir -p $spectrumDir
echo
cd /tmp/netboot
wget -qO- http://www.speccie.co.uk/speccie/software/spectrum.2mg | dd bs=64 skip=1 of=$spectrumDir/SPECTRUM.HDV 2> /dev/null
wget -qO- http://www.speccie.co.uk/speccie/software/spectrum_extras.2mg | dd bs=64 skip=1 of=$spectrumDir/EXTRAS.HDV 2> /dev/null
wget -qO- http://www.speccie.co.uk/speccie/software/spectrum_sounds.2mg | dd bs=64 skip=1 of=$spectrumDir/SOUNDS.HDV 2> /dev/null
wget -qO- http://www.speccie.co.uk/speccie/software/spectrum_manuals.2mg | dd bs=64 skip=1 of=$spectrumDir/MANUALS.HDV 2> /dev/null
afpsync -v $gsosDir > /dev/null
fi
echo -n "ProTERM and Z-Link"
# get A2CLOUD disk and copy from there
if [[ -f $commDir/PROTERM/PROTERM ]]; then
echo " are already installed."
else
mkdir -p $protermDir
mkdir -p $protermDir/.AppleDouble
mkdir -p $zlinkDir
mkdir -p $zlinkDir/.AppleDouble
echo
cd /tmp/netboot
wget -qO A2CLOUD.HDV http://ivanx.com/a2cloud/files/A2CLOUD.HDV
cppo -ad A2CLOUD.HDV . > /dev/null
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
fi
echo -n "ADTPro and VSDRIVE"
if [[ -f $commDir/ADTPRO/ADTPRO ]]; then
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
fi
fi
# clean up
cd
[[ -d /tmp/netboot ]] && rm -rf /tmp/netboot
[[ -d ~/GNUstep ]] && rm -rf ~/GNUstep
# rock and roll!
echo
echo
if (( $gsosInstall )); then
echo "GS/OS network boot (for registered user and Guest) and"
fi
echo "ProDOS 8 network boot (for Guest only) is now configured."
echo "See http://appleii.ivanx.com/a2server for info using it."
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
echo "A2SERVER: Downloading Farallon bridge patch..."
wget -O /tmp/FARALLON.PO appleii.ivanx.com/a2server/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
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
fi

View File

@ -0,0 +1,95 @@
#!/bin/bash
# Set up A2SERVER to support Samba (Windows File Sharing)
# this script can also be used if new shares are introduced
[[ -f /tmp/a2server-autoAnswerYes ]] && autoAnswerYes=1 || autoAnswerYes=
if [[ ! $autoAnswerYes || -f /tmp/a2server-setupWindowsSharing ]]; then
if [[ ! $autoAnswerYes ]]; then
echo
echo -n "Should Windows computers be able to connect to A2SERVER? "
read
fi
if [[ $autoAnswerYes || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
echo "A2SERVER: Setting up Windows file sharing..."
sudo true
if [[ $(lsb_release -d 2> /dev/null | grep Ubuntu) ]]; then
[[ -f /etc/init/smbd.conf.off ]] && sudo mv /etc/init/smbd.conf.off /etc/init/smbd.conf
[[ -f /etc/init/nmbd.conf.off ]] && sudo mv /etc/init/nmbd.conf.off /etc/init/nmbd.conf
[[ ! -f /etc/init/smbd.conf || ! -f /etc/init/nmbd.conf ]] && installSamba=1
else
sudo update-rc.d samba defaults &> /dev/null
[[ ! -f /etc/init.d/samba ]] && installSamba=1
fi
if (( $installSamba )); then
if [[ ! -f /tmp/a2server-packageReposUpdated ]]; then
# prepare for installing packages
sudo apt-get -y update
touch /tmp/a2server-packageReposUpdated
fi
sudo apt-get -y install samba
[[ -f /usr/bin/smbpasswd ]] || sudo apt-get -y install samba-common-bin
sudo apt-get clean
fi
if [[ $(lsb_release -d 2> /dev/null | grep Ubuntu) ]]; then
sudo initctl start smbd &> /dev/null
sudo initctl start nmbd &> /dev/null
else
sudo /etc/init.d/samba start &> /dev/null
fi
workgroup=$(grep -o "^ workgroup = .*$" /etc/samba/smb.conf 2> /dev/null | cut -c 16-)
[[ $workgroup ]] || workgroup="WORKGROUP"
if [[ ! $autoAnswerYes ]]; then
echo
echo "Enter workgroup name (or press return for '${workgroup}'): "
read
[[ $REPLY ]] && workgroup=$REPLY
fi
sudo sed -i 's/^ workgroup = .*$/ workgroup = '$workgroup'/' /etc/samba/smb.conf 2> /dev/null
sudo sed -i 's/^# security = user/ security = user/' /etc/samba/smb.conf 2> /dev/null
grep ^/media /usr/local/etc/netatalk/AppleVolumes.default | cut -d" " -f2 \
| while read sharename; do
if [[ $(grep $sharename /etc/samba/smb.conf) ]]; then
echo "A2SERVER: $sharename is already set up for Windows file sharing."
else
echo "[$sharename]" | sudo tee -a /etc/samba/smb.conf > /dev/null
echo " path = /media/A2SHARED/$sharename" | sudo tee -a /etc/samba/smb.conf > /dev/null
echo " browsable = yes" | sudo tee -a /etc/samba/smb.conf > /dev/null
echo " guest ok = yes" | sudo tee -a /etc/samba/smb.conf > /dev/null
echo " read only = no" | sudo tee -a /etc/samba/smb.conf > /dev/null
echo " create mask = 0666" | sudo tee -a /etc/samba/smb.conf > /dev/null
echo " force user = $USER" | sudo tee -a /etc/samba/smb.conf > /dev/null
echo "A2SERVER: $sharename has been set up for Windows file sharing."
fi
done
echo
echo "A2SERVER: Setting Windows file sharing password to 'apple2'."
echo -e 'apple2\napple2' | sudo smbpasswd -s -a $USER
echo
echo "A2SERVER: Windows file sharing is now running."
else
if [[ $(lsb_release -d 2> /dev/null | grep Ubuntu) ]]; then
sudo initctl stop smbd &> /dev/null
sudo initctl stop nmbd &> /dev/null
[[ -f /etc/init/smbd.conf ]] && sudo mv /etc/init/smbd.conf /etc/init/smbd.conf.off
[[ -f /etc/init/nmbd.conf ]] && sudo mv /etc/init/nmbd.conf /etc/init/nmbd.conf.off
else
sudo /etc/init.d/samba stop &> /dev/null
sudo update-rc.d -f samba remove &> /dev/null
fi
echo "A2SERVER: Windows file sharing has been turned off."
fi
echo
fi

View File

@ -0,0 +1,105 @@
#!/bin/bash
# --- Ubuntu Server console optimizaton (optional)
# This script helps when running on the Linux console within the VM.
echo
userPw=$(sudo grep "^$USER" /etc/shadow | cut -f 2 -d ':')
[[ $userPw == "$(echo 'apple2' | perl -e '$_ = <STDIN>; chomp; print crypt($_, $ARGV[0])' "${userPw%"${userPw#\$*\$*\$}"}")" ]] && isApple2Pw=1 || isApple2Pw=
[[ $userPw == "$(echo 'raspberry' | perl -e '$_ = <STDIN>; chomp; print crypt($_, $ARGV[0])' "${userPw%"${userPw#\$*\$*\$}"}")" ]] && isRaspberryPw=1 || isRaspberryPw=
password="your password"
[[ $isApple2Pw ]] && password="'apple2'"
[[ $isRaspberryPw ]] && password="'raspberry'"
isDebian=
[[ ( -f /etc/debian_version ) && ( $(cut -c 1-2 < /etc/debian_version) == "7." ) && ( $(uname -m) == "i686" ) ]] && isDebian=1
if [[ $isDebian ]]; then
if { lspci 2> /dev/null | grep -q VirtualBox; }; then
echo "A2SERVER: Disabling VirtualBox console screen blanking..."
sudo sed -i 's/^BLANK_DPMS=off/BLANK_DPMS=on/' /etc/kbd/config
sudo sed -i 's/^BLANK_TIME=[^0].$/BLANK_TIME=0/' /etc/kbd/config
sudo /etc/init.d/kbd restart &> /dev/null
sudo /etc/init.d/console-setup restart &> /dev/null
fi
fi
# check that we're on Ubuntu
if [[ $(lsb_release -d 2> /dev/null | grep Ubuntu) ]]; then
# don't do any of this if we're logged in via SSH
if [[ $SSH_CLIENT || $REMOTEHOST ]]; then
echo "A2SERVER: Logged in via SSH,not performing console optimization."
echo "Run setup from the console if you want to optimize the console."
else
# if we've already done this stuff, don't do it again
if [[ ! -x /etc/update-motd.d/10-help-text ]]; then
echo "A2SERVER: Ubuntu console has already been optimized."
else
echo "Ubuntu console optimization for use in a virtual machine will:"
echo "- show the default username/password on the login screen"
echo "- remove the documentation URL and system statistics shown after login"
echo "- ensure the screen clears before showing the login prompt"
echo "- prevent the screen from dimming after 10 minutes (once logged in)"
echo "- eliminate a harmless but annoying startup error about piix_smbus"
echo "- fix an Ubuntu 10.04 issue with slow scrolling"
echo
if [[ ! $autoAnswerYes ]]; then
echo -n "Do you want to optimize the Ubuntu console? "
read
fi
if [[ $autoAnswerYes || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
echo "A2SERVER: Optimizing console..."
# remind the user how to log in (we're going for functionality here, not security)
if [[ ! $(grep $USER\/$password /etc/issue) ]]; then
sudo sed -i '/^Log in with.*$/d' /etc/issue
echo "Log in with '$USER' / '$password'." | sudo tee -a /etc/issue > /dev/null
echo | sudo tee -a /etc/issue > /dev/null
fi
# If after logging in, you don't like the documentation URL and
# system info (or an error about it) being displayed, type:
sudo chmod -x /etc/update-motd.d/10-help-text
sudo chmod -x /etc/update-motd.d/50-landscape-sysinfo
# If the screen doesn't clear for login after the boot messages, and
# you'd like it to, type:
sudo sed -i 's/X_DEFAULT=""/X_DEFAULT="quiet"/g' /etc/default/grub
sudo update-grub
# If you see a piix4_smbus error on startup, it is harmless, but if you
# want to eliminate it, type:
echo -e '\nblacklist i2c_piix4' \
| sudo tee -a /etc/modprobe.d/blacklist.conf > /dev/null
sudo update-initramfs -u -k all
# If you want to prevent the Ubuntu screen from going blank after ten
# minutes of inactivity (once you are logged in), type:
echo -e \
'\n[[ $SSH_CLIENT || $REMOTEHOST ]] || setterm -blank 0 -powersave off -powerdown 0' \
| sudo tee -a /etc/profile > /dev/null
setterm -blank 0 -powersave off -powerdown 0
# (note: These next lines addresses an issue only for Ubuntu 10.04.)
# Type "ps aux" and press return. If you see slow text scrolling, type:
if [[ "$(lsb_release -rs 2> /dev/null)" == "10.04" ]]; then
echo -e '\nblacklist vga16fb' \
| sudo tee -a /etc/modprobe.d/blacklist-framebuffer.conf > /dev/null
if [[ ! $SSH_CLIENT ]]; then
echo "Restarting now is recommended. To resume setup, log back"
echo -n "in, press up-arrow, and press return. Restart now? "
read; R=${REPLY:0:1}
[[ $R != "y" ]] && [[ $R != "Y" ]] || sudo shutdown -r now
fi
fi
fi
fi
fi
fi