mirror of
https://github.com/RasppleII/a2server.git
synced 2024-12-22 17:29:34 +00:00
Reflowed shell scripts—breaks outstanding PRs
Reflowed the scripts (mostly) according to vim's autoindent engine. Also added vim modelines so that people who are familiar with them can configure their environment for A2SERVER's conventions. Also removed trailing whitespace from lines and files while I was at it to make git happier about various things.
This commit is contained in:
parent
554baff892
commit
13ad54c876
@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
#! /bin/bash
|
||||
# vim: set tabstop=4 shiftwidth=4 expandtab filetype=sh:
|
||||
|
||||
# --- Setting up the share volume
|
||||
|
||||
@ -7,13 +8,13 @@
|
||||
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
|
||||
fi
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
#! /bin/bash
|
||||
# vim: set tabstop=4 shiftwidth=4 expandtab filetype=sh:
|
||||
|
||||
# download and install a2server tools:
|
||||
# mkatinit, mkvolinfo, afptype, afpsync, aliases, nulib2
|
||||
@ -67,7 +68,7 @@ if [[ ! -f /usr/local/bin/unar ]]; then
|
||||
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
|
||||
@ -118,9 +119,9 @@ echo "source /usr/local/etc/a2server-aliases" | sudo tee -a /etc/bash.bashrc > /
|
||||
|
||||
[[ $(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
|
||||
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
|
||||
|
@ -1,4 +1,6 @@
|
||||
#!/bin/bash
|
||||
#! /bin/bash
|
||||
# vim: set tabstop=4 shiftwidth=4 expandtab filetype=sh:
|
||||
|
||||
# A2SERVER -- a virtual machine for sharing files to Apple II clients
|
||||
# by Ivan X, ivan@ivanx.com
|
||||
|
||||
@ -28,14 +30,14 @@ isDebian=
|
||||
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
|
||||
@ -64,7 +66,7 @@ else
|
||||
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
|
||||
@ -72,7 +74,7 @@ else
|
||||
{ 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
|
||||
@ -92,39 +94,39 @@ else
|
||||
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
|
||||
fi
|
||||
|
||||
|
||||
# --- Configuring Netatalk
|
||||
|
||||
echo "A2SERVER: Configuring Netatalk..."
|
||||
@ -167,10 +169,10 @@ if [[ ! $(grep '^- -ddp.*uams_randnum.so' /usr/local/etc/netatalk/afpd.conf) ]];
|
||||
# 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
|
||||
"- -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
|
||||
| sudo tee -a /usr/local/etc/netatalk/afpd.conf > /dev/null
|
||||
fi
|
||||
|
||||
# replace home folder share and end of file mark with share placeholders
|
||||
@ -186,7 +188,7 @@ if [[ ! $(grep ^eth0 /usr/local/etc/netatalk/atalkd.conf) && ! $(grep ^wlan0 /us
|
||||
# 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
|
||||
| sudo tee -a /usr/local/etc/netatalk/atalkd.conf > /dev/null
|
||||
fi
|
||||
|
||||
# Raspberry Pi
|
||||
@ -207,12 +209,12 @@ if [[ $isRpi ]]; 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
|
||||
'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)
|
||||
@ -220,8 +222,8 @@ sudo sed -i \
|
||||
# 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
|
||||
'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
|
||||
@ -229,7 +231,7 @@ if [[ ! -d /media/A2SHARED/A2FILES/.AppleDesktop ]]; then
|
||||
ln -s .AppleDesktop .APPLEDESKTOP
|
||||
fi
|
||||
|
||||
# set up ADTDISKS share (ADTPro disk image folder, if A2CLOUD is installed)
|
||||
# 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
|
||||
@ -258,7 +260,7 @@ 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
|
||||
echo
|
||||
# set registered user login using RandNum authentication
|
||||
sudo afppasswd -c
|
||||
sudo sed -i 's/^pi.*$/pi:6170706C65320000:****************:********/' /usr/local/etc/netatalk/afppasswd
|
||||
@ -315,8 +317,8 @@ 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 [[ ( ! $(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
|
||||
@ -357,11 +359,11 @@ if [[ ( ! $(ps aux | grep [a]talkd) ) && ( $isRpi ) ]]; then
|
||||
# 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
|
||||
# # 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
|
||||
# # 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
|
||||
#
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
#! /bin/bash
|
||||
# vim: set tabstop=4 shiftwidth=4 expandtab filetype=sh:
|
||||
|
||||
# this script downloads and installs the Apple boot blocks required
|
||||
# for booting an Apple II client over the network, and places
|
||||
@ -23,35 +24,35 @@ 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
|
||||
|| [[ ! -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
|
||||
@ -59,46 +60,46 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
|
||||
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
|
||||
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
|| [[ ! -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
|
||||
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
|
||||
sudo dd of="$p8Dir/NETBOOT.P8" 2> /dev/null
|
||||
afpsync -v $p8Dir > /dev/null
|
||||
afptype -p SYS -q $p8Dir/NETBOOT.P8
|
||||
fi
|
||||
@ -108,14 +109,14 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
|
||||
# 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
|
||||
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
|
||||
@ -127,7 +128,7 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
|
||||
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
|
||||
@ -152,9 +153,9 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
|
||||
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
|
||||
@ -180,7 +181,7 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
|
||||
targetFile=${targetPath##*/}
|
||||
sourceParent=${sourcePath%/*}
|
||||
sourceFile=${sourcePath##*/}
|
||||
|
||||
|
||||
if [[ $action == 1 || $action == 2 ]]; then
|
||||
mkdir -p $targetParent
|
||||
echo "copying: $sourcePathMixed"
|
||||
@ -201,22 +202,22 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
|
||||
done
|
||||
unset IFS
|
||||
}
|
||||
|
||||
|
||||
mkdir -p /tmp/netboot
|
||||
cd /tmp/netboot
|
||||
|
||||
echo "A2SERVER: Preparing GS/OS installer scripts..."
|
||||
|
||||
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"
|
||||
@ -224,11 +225,11 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
|
||||
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
|
||||
@ -243,7 +244,7 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
|
||||
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
|
||||
@ -259,8 +260,8 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
|
||||
cat GSHK_rsrc_ >> $imageToolsDir/.AppleDouble/GSHK
|
||||
afptype -p S16 -a DB07 -q $imageToolsDir/GSHK
|
||||
fi
|
||||
|
||||
echo -n "MountIt 1.4"
|
||||
|
||||
echo -n "MountIt 1.4"
|
||||
# get MountIt (for GS/OS)
|
||||
if [[ -f $imageToolsDir/MOUNTIT.SHK ]]; then
|
||||
echo " is already installed."
|
||||
@ -281,11 +282,11 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
|
||||
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
|
||||
@ -299,7 +300,7 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
|
||||
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
|
||||
@ -313,7 +314,7 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
|
||||
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."
|
||||
@ -330,7 +331,7 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
|
||||
cppo -s -ad A2SYSDISK32.HDV /UTILITIES/UTIL.2 $diskToolsP8Dir 2> /dev/null
|
||||
afpsync -v $sharepath > /dev/null
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
|
||||
if [[ ! $autoAnswerYes ]]; then
|
||||
@ -340,11 +341,11 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
|
||||
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
|
||||
@ -380,7 +381,7 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
|
||||
mv *PT3* *PROTERM* $protermDir/.AppleDouble
|
||||
mv Z.LINK $zlinkDir/.AppleDouble
|
||||
afpsync -v $gsosDir > /dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
echo -n "ADTPro and VSDRIVE"
|
||||
if [[ -f $commDir/ADTPRO/ADTPRO ]]; then
|
||||
@ -394,25 +395,25 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
|
||||
cd .AppleDouble
|
||||
mv *ADTPRO* *VEDRIVE* *VSDRIVE* $adtproDir/.AppleDouble
|
||||
afpsync -v $gsosDir > /dev/null
|
||||
fi
|
||||
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."
|
||||
|
||||
echo "See http://appleii.ivanx.com/a2server for info using it."
|
||||
|
||||
fi
|
||||
|
||||
if [[ ! $autoAnswerYes ]]; then
|
||||
@ -441,4 +442,4 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
|
||||
echo "directly into ProDOS 8 will freeze after a few minutes."
|
||||
fi
|
||||
|
||||
fi
|
||||
fi
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
#! /bin/bash
|
||||
# vim: set tabstop=4 shiftwidth=4 expandtab filetype=sh:
|
||||
|
||||
# Set up A2SERVER to support Samba (Windows File Sharing)
|
||||
# this script can also be used if new shares are introduced
|
||||
@ -13,10 +14,10 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupWindowsSharing ]]; then
|
||||
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
|
||||
@ -25,26 +26,26 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupWindowsSharing ]]; then
|
||||
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
|
||||
@ -55,9 +56,9 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupWindowsSharing ]]; then
|
||||
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
|
||||
| while read sharename; do
|
||||
if [[ $(grep $sharename /etc/samba/smb.conf) ]]; then
|
||||
echo "A2SERVER: $sharename is already set up for Windows file sharing."
|
||||
else
|
||||
@ -71,7 +72,7 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupWindowsSharing ]]; then
|
||||
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
|
||||
@ -90,6 +91,6 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupWindowsSharing ]]; then
|
||||
fi
|
||||
echo "A2SERVER: Windows file sharing has been turned off."
|
||||
fi
|
||||
|
||||
|
||||
echo
|
||||
fi
|
||||
fi
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
#! /bin/bash
|
||||
# vim: set tabstop=4 shiftwidth=4 expandtab filetype=sh:
|
||||
|
||||
# --- Ubuntu Server console optimizaton (optional)
|
||||
|
||||
@ -35,10 +36,10 @@ if [[ $(lsb_release -d 2> /dev/null | grep Ubuntu) ]]; 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:"
|
||||
@ -54,44 +55,44 @@ if [[ $(lsb_release -d 2> /dev/null | grep Ubuntu) ]]; then
|
||||
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 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
|
||||
'\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
|
||||
| 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? "
|
||||
@ -102,4 +103,4 @@ if [[ $(lsb_release -d 2> /dev/null | grep Ubuntu) ]]; then
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
@ -75,12 +75,3 @@ alias a2files-share="sudo sed -i 's/^\/media\/A2SHARED\/A2FILES\ A2FILES options
|
||||
alias a2files-unshare="sudo sed -i 's/^#share2/\/media\/A2SHARED\/A2FILES\ A2FILES options:prodos\ casefold:toupper/' /usr/local/etc/netatalk/AppleVolumes.default; [[ -d /media/A2SHARED/A2FILES ]] || mkdir /media/A2SHARED/A2FILES"
|
||||
|
||||
alias showalias="alias | cut -d= -f 1 | cut -d' ' -f2 | more"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -21,7 +21,7 @@ showip: show the current ethernet IP address of the server
|
||||
showmac: show the MAC (Ethernet hardware) address of the server
|
||||
showip-wifi: show the current wifi IP address of the server
|
||||
showmac-wifi: show the MAC (wifi hardware) address of the server
|
||||
ifreset: reset all network interfaces (requires restart)
|
||||
ifreset: reset all network interfaces (requires restart)
|
||||
|
||||
netatalk-stop: stop the netatalk service until reboot
|
||||
netatalk-start: start the netatalk service
|
||||
@ -57,7 +57,7 @@ netboot-p8-guest: set guests to netboot into ProDOS 8 (default)
|
||||
note: when a IIgs is set to network boot into GS/OS, using the Network
|
||||
control panel or the NETBOOT.GSOS utility, guests will behave like
|
||||
registered users, and ignore the netboot setting of the guest user
|
||||
|
||||
|
||||
guest-off: disallow guest access to A2SERVER
|
||||
guest-on: allow guest access to A2SERVER (default)
|
||||
note: by default, Guest access is the only way to network boot into
|
||||
@ -83,4 +83,3 @@ afpsync: register files introduced outside of AFP with netatalk
|
||||
mkatinit: set up network boot configuration files
|
||||
cppo: catalog and copy files from ProDOS image file (slow, but works)
|
||||
(add -h to show help for the above four commands, e.g. "afptype -h")
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
#! /bin/bash
|
||||
# vim: set tabstop=4 shiftwidth=4 expandtab filetype=sh:
|
||||
|
||||
# afpsync: updates .AppleDouble components of files on shared volumes
|
||||
|
||||
@ -45,12 +46,12 @@ processPath () {
|
||||
[[ ! $renameLower ]] && echo "Ensure filenames are all caps on volume $sharepath."
|
||||
if [[ $showerrors ]]; then
|
||||
echo $result \
|
||||
| while read LINE; do
|
||||
| while read LINE; do
|
||||
[[ ! $(echo $LINE | grep APPLEDESKTOP) ]] && echo $LINE
|
||||
done
|
||||
elif [[ $renameLower ]]; then
|
||||
echo $result \
|
||||
| while read LINE; do
|
||||
| while read LINE; do
|
||||
if [[ ! $(echo $LINE | grep APPLEDESKTOP) ]]; then
|
||||
filepath=$(echo $LINE | sed "s/^Bad\ encoding\ for\ '//" | sed s/\'//)
|
||||
filename=${filepath##*/}
|
||||
@ -76,7 +77,7 @@ while [[ $1 == "-r" || $1 == "-e" || $1 = "-v" ]]; do
|
||||
force=1
|
||||
shift
|
||||
fi
|
||||
|
||||
|
||||
if [[ $1 == "-e" ]]; then
|
||||
showerrors=1
|
||||
shift
|
||||
@ -103,12 +104,12 @@ else
|
||||
if [[ $1 ]]; then
|
||||
sharepath=$(readlink -m $1)
|
||||
processPath
|
||||
else
|
||||
else
|
||||
grep ^/media /usr/local/etc/netatalk/AppleVolumes.default | \
|
||||
while read line; do
|
||||
while read line; do
|
||||
[[ $(echo $line | grep toupper) ]]; nocasefold=$?
|
||||
sharepath=$(echo $line | cut -d" " -f1)
|
||||
processPath nocasefold
|
||||
done
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
#! /bin/bash
|
||||
# vim: set tabstop=4 shiftwidth=4 expandtab filetype=sh:
|
||||
|
||||
# 2-25-11: tested on 10.6.5 and Ubuntu 10.10. Final.
|
||||
|
||||
@ -58,7 +59,7 @@ decToHex () {
|
||||
[[ $1 ]] || return 11
|
||||
[[ $2 ]] && return 8
|
||||
[[ ( $(printf %d "$1" 2> /dev/null) == $1 ) \
|
||||
&& ( $1 -ge 0 ) && ( $1 -le 255 ) ]] || return 21
|
||||
&& ( $1 -ge 0 ) && ( $1 -le 255 ) ]] || return 21
|
||||
# args are valid
|
||||
printf %02X "$1"
|
||||
}
|
||||
@ -72,7 +73,7 @@ hexToDec () {
|
||||
[[ $2 ]] && return 8
|
||||
[[ ${#1} -eq 2 ]] || return 21
|
||||
[[ $(printf %02X "0x$1" 2> /dev/null) == \
|
||||
$(echo -n "$1" | tr [a-z] [A-Z]) ]] || return 21
|
||||
$(echo -n "$1" | tr [a-z] [A-Z]) ]] || return 21
|
||||
# args are valid
|
||||
printf %d "0x$1"
|
||||
}
|
||||
@ -92,7 +93,7 @@ charToDec () {
|
||||
# above line verifies that arg/stdin is valid
|
||||
[[ ${#charX} -ne 2 ]] && { echo -n 0; return 0; }
|
||||
echo -n "${charX:0:1}" | od -t u1 | \
|
||||
head -1 | sed 's/[0\ ]*//' | tr -d ' \n'
|
||||
head -1 | sed 's/[0\ ]*//' | tr -d ' \n'
|
||||
}
|
||||
|
||||
charToHex () {
|
||||
@ -110,7 +111,7 @@ charToHex () {
|
||||
# above line verifies that stdin/arg is valid
|
||||
[[ ${#charX} -ne 2 ]] && { echo -n "00"; return 0; }
|
||||
printf %02X $(echo -n "${charX:0:1}" | od -t u1 | \
|
||||
head -1 | sed 's/[0\ ]*//' | tr -d ' \n')
|
||||
head -1 | sed 's/[0\ ]*//' | tr -d ' \n')
|
||||
}
|
||||
|
||||
decToChar () {
|
||||
@ -121,7 +122,7 @@ decToChar () {
|
||||
[[ $1 ]] || return 11
|
||||
[[ $2 ]] && return 8
|
||||
[[ ( $(printf %d "$1" 2> /dev/null ) == $1 ) \
|
||||
&& ( $1 -ge 0 ) && ( $1 -le 255 ) ]] || return 21
|
||||
&& ( $1 -ge 0 ) && ( $1 -le 255 ) ]] || return 21
|
||||
# args are valid
|
||||
echo -n -e "\x$(printf %02X "$1")"
|
||||
}
|
||||
@ -135,7 +136,7 @@ hexToChar () {
|
||||
[[ $2 ]] && return 8
|
||||
[[ ${#1} -eq 2 ]] || return 21
|
||||
[[ $(printf %02X "0x$1" 2> /dev/null) == \
|
||||
$(echo -n "$1" | tr [a-z] [A-Z]) ]] || return 21
|
||||
$(echo -n "$1" | tr [a-z] [A-Z]) ]] || return 21
|
||||
# args are valid
|
||||
echo -n -e "\x$1"
|
||||
}
|
||||
@ -152,12 +153,12 @@ readchars () {
|
||||
[[ $4 ]] && return 8
|
||||
[[ -f $1 ]] || return 21
|
||||
[[ $2 ]] && { [[ ( $(printf %d "$2" 2> /dev/null) == $2 ) \
|
||||
&& ( $2 -ge 0 ) ]] || return 22; }
|
||||
&& ( $2 -ge 0 ) ]] || return 22; }
|
||||
[[ $3 ]] && { [[ ( $(printf %d "$3" 2> /dev/null) == $3 ) \
|
||||
&& ( $3 -ge 0 ) ]] || return 23; }
|
||||
&& ( $3 -ge 0 ) ]] || return 23; }
|
||||
# args are valid
|
||||
dd if="$1" bs=1 skip=$(($2)) $([[ $3 ]] && echo -n "count=$3") \
|
||||
2> /dev/null
|
||||
2> /dev/null
|
||||
}
|
||||
|
||||
readcharDec () {
|
||||
@ -171,13 +172,13 @@ readcharDec () {
|
||||
[[ $3 ]] && return 8
|
||||
[[ -f $1 ]] || return 21
|
||||
[[ $2 ]] && { [[ ( $(printf %d "$2" 2> /dev/null) == $2 ) \
|
||||
&& ( $2 -ge 0 ) ]] || return 22; }
|
||||
&& ( $2 -ge 0 ) ]] || return 22; }
|
||||
# args are valid
|
||||
charX="$(dd if="$1" bs=1 skip=$(($2)) \
|
||||
count=1 2> /dev/null; echo -n X)"
|
||||
count=1 2> /dev/null; echo -n X)"
|
||||
[[ ${#charX} -gt 1 ]] || { echo -n 0; return 0; }
|
||||
echo -n "${charX:0:1}" | od -t u1 | \
|
||||
head -1 | sed 's/[0\ ]*//' | tr -d ' \n'
|
||||
head -1 | sed 's/[0\ ]*//' | tr -d ' \n'
|
||||
}
|
||||
|
||||
readcharHex () {
|
||||
@ -191,13 +192,13 @@ readcharHex () {
|
||||
[[ $3 ]] && return 8
|
||||
[[ -f $1 ]] || return 21
|
||||
[[ $2 ]] && { [[ ( $(printf %d "$2" 2> /dev/null) == $2 ) \
|
||||
&& ( $2 -ge 0 ) ]] || return 22; }
|
||||
&& ( $2 -ge 0 ) ]] || return 22; }
|
||||
# args are valid
|
||||
charX="$(dd if="$1" bs=1 skip=$(($2)) \
|
||||
count=1 2> /dev/null; echo -n X)"
|
||||
count=1 2> /dev/null; echo -n X)"
|
||||
[[ ${#charX} -gt 1 ]] || { echo -n "00"; return 0; }
|
||||
printf %02X $(echo -n "${charX:0:1}" | od -t u1 | \
|
||||
head -1 | sed 's/[0\ ]*//' | tr -d ' \n')
|
||||
head -1 | sed 's/[0\ ]*//' | tr -d ' \n')
|
||||
}
|
||||
|
||||
### 2-15-11 above tested on OS X and Linux
|
||||
@ -213,13 +214,13 @@ writechars () {
|
||||
# 13=missing stdin/arg3, 22=invalid arg2
|
||||
[[ $1 ]] || { [[ -t 0 ]] || cat > /dev/null; return 11; }
|
||||
[[ $2 ]] && { [[ ( $(printf %d "$2" 2> /dev/null) == $2 ) && \
|
||||
( $2 -ge 0 ) ]] || { [[ -t 0 ]] || cat > /dev/null; return 22; } }
|
||||
( $2 -ge 0 ) ]] || { [[ -t 0 ]] || cat > /dev/null; return 22; } }
|
||||
[[ ( ! -t 0 ) && $3 ]] && { cat > /dev/null; return 8; }
|
||||
[[ ( -t 0 ) ]] && { [[ $4 ]] && return 8; [[ $3 ]] || return 13; }
|
||||
# args are valid
|
||||
if [[ -t 0 ]]; then
|
||||
echo -n "$3" | \
|
||||
dd of="$1" bs=1 seek=$(($2)) conv=notrunc 2> /dev/null
|
||||
dd of="$1" bs=1 seek=$(($2)) conv=notrunc 2> /dev/null
|
||||
else
|
||||
dd of="$1" bs=1 seek=$(($2)) conv=notrunc 2> /dev/null
|
||||
fi
|
||||
@ -236,12 +237,12 @@ writecharDec () {
|
||||
[[ $1 ]] || return 11; [[ $2 ]] || return 12; [[ $3 ]] || return 13
|
||||
[[ $4 ]] && return 8
|
||||
[[ ( $(printf %d "$2" 2> /dev/null) == $2 ) \
|
||||
&& ( $2 -ge 0 ) ]] || return 22
|
||||
&& ( $2 -ge 0 ) ]] || return 22
|
||||
[[ ( $(printf %d "$3" 2> /dev/null) == $3 ) \
|
||||
&& ( $3 -ge 0 ) && ( $3 -lt 255 ) ]] || return 23
|
||||
&& ( $3 -ge 0 ) && ( $3 -lt 255 ) ]] || return 23
|
||||
# args are valid
|
||||
echo -n -e "\x$(printf %02X "$3")" | \
|
||||
dd of="$1" bs=1 seek=$(($2)) conv=notrunc 2> /dev/null
|
||||
dd of="$1" bs=1 seek=$(($2)) conv=notrunc 2> /dev/null
|
||||
}
|
||||
|
||||
writecharHex () {
|
||||
@ -255,12 +256,12 @@ writecharHex () {
|
||||
[[ $1 ]] || return 11; [[ $2 ]] || return 12; [[ $3 ]] || return 13
|
||||
[[ $4 ]] && return 8
|
||||
[[ ( $(printf %d "$2" 2> /dev/null) == $2 ) \
|
||||
&& ( $2 -ge 0 ) ]] || return 22
|
||||
&& ( $2 -ge 0 ) ]] || return 22
|
||||
[[ $(printf %02X "0x$3" 2> /dev/null) == \
|
||||
$(echo -n "$3" | tr [a-z] [A-Z]) ]] || return 23
|
||||
$(echo -n "$3" | tr [a-z] [A-Z]) ]] || return 23
|
||||
# args are valid
|
||||
echo -n -e "\x$3" | \
|
||||
dd of="$1" bs=1 seek=$2 conv=notrunc 2> /dev/null
|
||||
dd of="$1" bs=1 seek=$2 conv=notrunc 2> /dev/null
|
||||
}
|
||||
|
||||
|
||||
@ -268,7 +269,7 @@ writecharHex () {
|
||||
|
||||
isHexByte () {
|
||||
[[ $(printf %02X "0x$1" 2> /dev/null) == \
|
||||
$(echo -n "$1" | tr [a-z] [A-Z]) ]] || return 1
|
||||
$(echo -n "$1" | tr [a-z] [A-Z]) ]] || return 1
|
||||
}
|
||||
|
||||
# support 00 and 0A as filetype chars?
|
||||
@ -295,7 +296,7 @@ exit_usage () {
|
||||
echo " two hex digits for untypeables (note: use '\xZZ' for 00)."
|
||||
echo "ProDOS type should be two hex digits, and auxtype should be four;"
|
||||
echo " type can alternatively be BAS, BIN, INT, P16, S16, SHK, SYS, TXT."
|
||||
echo "-q skips recheck of file (show types) after setting"
|
||||
echo "-q skips recheck of file (show types) after setting"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
@ -310,8 +311,7 @@ lookupPdosType () {
|
||||
[[ ${#1} -eq 3 ]] || return 1
|
||||
arg=$(echo -n "$1" | tr [a-z] [A-Z])
|
||||
for ptype in $ptypes; do
|
||||
if [[ ${ptype:3:3} == $arg ]]
|
||||
then
|
||||
if [[ ${ptype:3:3} == $arg ]]; then
|
||||
echo -n "${ptype:0:2}"
|
||||
return 0
|
||||
fi
|
||||
@ -359,7 +359,7 @@ while [[ $1 && ( "${1:0:1}" == '-' ) ]]; do
|
||||
continue
|
||||
else
|
||||
exit_usage
|
||||
break
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
@ -383,17 +383,17 @@ for filename in $@; do
|
||||
[[ -f $adname ]] && filename=$adname
|
||||
ADversion=$(readcharDec "$filename" 5)
|
||||
if [[ ( ( $ADversion -ne 1 ) && ( $ADversion -ne 2 ) ) \
|
||||
|| ( "$(readchars "$filename" 1 3)" != "$(echo -e -n "\x05\x16\x07")" ) \
|
||||
|| ( $(readcharDec "$filename" 0) -ne 0 ) \
|
||||
|| ( $(readcharDec "$filename" 4) -ne 0 ) \
|
||||
|| ( $(readcharDec "$filename" 6) -ne 0 ) \
|
||||
|| ( $(readcharDec "$filename" 7) -ne 0 ) ]]; then
|
||||
|| ( "$(readchars "$filename" 1 3)" != "$(echo -e -n "\x05\x16\x07")" ) \
|
||||
|| ( $(readcharDec "$filename" 0) -ne 0 ) \
|
||||
|| ( $(readcharDec "$filename" 4) -ne 0 ) \
|
||||
|| ( $(readcharDec "$filename" 6) -ne 0 ) \
|
||||
|| ( $(readcharDec "$filename" 7) -ne 0 ) ]]; then
|
||||
echo "${linestart}Not an AppleDouble file."
|
||||
continue
|
||||
fi
|
||||
|
||||
entrycount=`readcharDec "$filename" 25`
|
||||
|
||||
|
||||
entry=1
|
||||
offset=29
|
||||
|
||||
@ -406,7 +406,7 @@ for filename in $@; do
|
||||
(( offset = (entry * 12 + 29) - 12 ))
|
||||
done
|
||||
(( entry > entrycount )) && continue
|
||||
|
||||
|
||||
(( offset = offset + 3 ))
|
||||
(( tposHi = $(readcharDec "$filename" $offset) * 256 ))
|
||||
(( offset = offset + 1 ))
|
||||
@ -414,7 +414,7 @@ for filename in $@; do
|
||||
(( cpos = tpos + 4 ))
|
||||
(( ppos = tpos + 1 ))
|
||||
(( apos = tpos + 2 ))
|
||||
|
||||
|
||||
if [[ $p || $a || $t || $c ]]; then # set
|
||||
if [[ $p || $a ]]; then
|
||||
if [[ $p ]]; then
|
||||
@ -447,11 +447,11 @@ for filename in $@; do
|
||||
|
||||
type="$(readchars "$filename" $tpos 4)"
|
||||
creator="$(readchars "$filename" $cpos 4)"
|
||||
|
||||
|
||||
echo -n "$linestart"
|
||||
|
||||
|
||||
if [[ $creator != "pdos" || ( ( $type != "TEXT" ) \
|
||||
&& ( $type != "PSYS" ) && ( ${type:0:1} != "p" ) ) ]]; then
|
||||
&& ( $type != "PSYS" ) && ( ${type:0:1} != "p" ) ) ]]; then
|
||||
if [[ $creator || $type ]]; then
|
||||
echo "Mac file. Type:$type Creator:$creator"
|
||||
else
|
||||
@ -459,7 +459,7 @@ for filename in $@; do
|
||||
fi
|
||||
continue
|
||||
fi
|
||||
|
||||
|
||||
if [[ $type == "TEXT" ]]; then
|
||||
pdosType="\$04 [TXT]"
|
||||
pdosAuxType='$0000'
|
||||
@ -475,14 +475,14 @@ for filename in $@; do
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
(( tpos=tpos+1 ))
|
||||
auxTypeHi=$(readcharHex "$filename" $tpos)
|
||||
(( tpos=tpos+1 ))
|
||||
auxTypeLo=$(readcharHex "$filename" $tpos)
|
||||
pdosAuxType=$auxTypeHi$auxTypeLo
|
||||
fi
|
||||
|
||||
|
||||
echo "ProDOS file. Type:\$$pdosType AuxType:\$$pdosAuxType"
|
||||
fi
|
||||
|
||||
@ -495,4 +495,4 @@ done
|
||||
# test on lunix
|
||||
# test inside and outside of AD directory, and from other dirs (both cases)
|
||||
# finish conversion writebyte/readchar library
|
||||
# consider return 2 for missing parameters for subroutines
|
||||
# consider return 2 for missing parameters for subroutines
|
||||
|
@ -132,7 +132,7 @@ def getFileName(arg1, arg2):
|
||||
def getFileType(arg1, arg2):
|
||||
start = getStartPos(arg1, arg2)
|
||||
return readcharHex(g.imageData, start+16)
|
||||
|
||||
|
||||
def getKeyPointer(arg1, arg2):
|
||||
start = getStartPos(arg1, arg2)
|
||||
return (readcharDec(g.imageData, start+17) +
|
||||
@ -364,7 +364,7 @@ def processEntry(arg1, arg2):
|
||||
if g.PDOSPATH_SEGMENT:
|
||||
syncExit()
|
||||
g.targetName = None
|
||||
|
||||
|
||||
#else:
|
||||
#print(g.activeFileName + " doesn't match " + g.PDOSPATH_SEGMENT)
|
||||
|
||||
@ -505,7 +505,7 @@ def binToDec(arg1):
|
||||
# arg: binary string up to 8 bits
|
||||
# out: decimal value
|
||||
return to_dec([arg1])
|
||||
|
||||
|
||||
def binToHex(arg1):
|
||||
# converts single-byte binary string (8 bits) value to hex
|
||||
# warning: no error checking
|
||||
@ -699,10 +699,10 @@ def to_bytes(val):
|
||||
else:
|
||||
raise Exception(
|
||||
"to_bytes() requires hex-ustr, int/long, or [bin-ustr]")
|
||||
|
||||
|
||||
def shift(items):
|
||||
"""Shift list items to left, losing the first item.
|
||||
|
||||
|
||||
in : list
|
||||
out: list
|
||||
"""
|
||||
@ -710,7 +710,7 @@ def shift(items):
|
||||
items[i] = items[i+1]
|
||||
del items[-1]
|
||||
return items
|
||||
|
||||
|
||||
def s(string):
|
||||
"""Perform local variable substution, e.g. 'total: {num} items'"""
|
||||
# http://stackoverflow.com/questions/2960772/
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
#! /bin/bash
|
||||
# vim: set tabstop=4 shiftwidth=4 expandtab filetype=sh:
|
||||
|
||||
# mkatinit by Ivan Drucker, http://appleii.ivanx.com
|
||||
# not licensed; please modify and redistribute as you like
|
||||
@ -29,7 +30,7 @@ decToChar () {
|
||||
[[ $1 ]] || return 11
|
||||
[[ $2 ]] && return 8
|
||||
[[ ( $(printf %d "$1" 2> /dev/null ) == $1 ) \
|
||||
&& ( $1 -ge 0 ) && ( $1 -le 255 ) ]] || return 21
|
||||
&& ( $1 -ge 0 ) && ( $1 -le 255 ) ]] || return 21
|
||||
# args are valid
|
||||
echo -n -e "\x$(printf %02X "$1")"
|
||||
}
|
||||
@ -45,13 +46,13 @@ writechars () {
|
||||
# 13=missing stdin/arg3, 22=invalid arg2
|
||||
[[ $1 ]] || { [[ -t 0 ]] || cat > /dev/null; return 11; }
|
||||
[[ $2 ]] && { [[ ( $(printf %d "$2" 2> /dev/null) == $2 ) && \
|
||||
( $2 -ge 0 ) ]] || { [[ -t 0 ]] || cat > /dev/null; return 22; } }
|
||||
( $2 -ge 0 ) ]] || { [[ -t 0 ]] || cat > /dev/null; return 22; } }
|
||||
[[ ( ! -t 0 ) && $3 ]] && { cat > /dev/null; return 8; }
|
||||
[[ ( -t 0 ) ]] && { [[ $4 ]] && return 8; [[ $3 ]] || return 13; }
|
||||
# args are valid
|
||||
if [[ -t 0 ]]; then
|
||||
echo -n "$3" | \
|
||||
dd of="$1" bs=1 seek=$(($2)) conv=notrunc 2> /dev/null
|
||||
dd of="$1" bs=1 seek=$(($2)) conv=notrunc 2> /dev/null
|
||||
else
|
||||
dd of="$1" bs=1 seek=$(($2)) conv=notrunc 2> /dev/null
|
||||
fi
|
||||
@ -73,49 +74,49 @@ echo
|
||||
|
||||
usersfolder=1
|
||||
while [ -n "$1" ] && [ "${1:0:1}" = '-' ]; do
|
||||
flag="$1"
|
||||
if [ $flag = "-gs" ]; then
|
||||
gs=1
|
||||
shift
|
||||
continue
|
||||
elif [ $flag = "-d" ]; then
|
||||
noprompt=1
|
||||
shift
|
||||
continue
|
||||
elif [ $flag = "-f" ]; then
|
||||
overwrite=1
|
||||
shift
|
||||
continue
|
||||
elif [ $flag = "-g" ]; then
|
||||
alsoguest=1
|
||||
shift
|
||||
continue
|
||||
elif [ $flag = "-c" ]; then
|
||||
usersfolder=0
|
||||
shift
|
||||
continue
|
||||
else
|
||||
badflag=1
|
||||
break
|
||||
fi
|
||||
flag="$1"
|
||||
if [ $flag = "-gs" ]; then
|
||||
gs=1
|
||||
shift
|
||||
continue
|
||||
elif [ $flag = "-d" ]; then
|
||||
noprompt=1
|
||||
shift
|
||||
continue
|
||||
elif [ $flag = "-f" ]; then
|
||||
overwrite=1
|
||||
shift
|
||||
continue
|
||||
elif [ $flag = "-g" ]; then
|
||||
alsoguest=1
|
||||
shift
|
||||
continue
|
||||
elif [ $flag = "-c" ]; then
|
||||
usersfolder=0
|
||||
shift
|
||||
continue
|
||||
else
|
||||
badflag=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $usersfolder -eq 0 ] && [ -n "$alsoguest" ]; then
|
||||
badflag=1
|
||||
badflag=1
|
||||
fi
|
||||
|
||||
if [ $badflag ]; then
|
||||
echo "usage: mkatinit [-gs] [-d] [-f] [-g | -c] [<username>|guest]"
|
||||
echo
|
||||
echo "<username> should be the name of a netatalk user, or 'guest'"
|
||||
echo "-gs sets the default ProDOS netboot system startup program and"
|
||||
echo " prefix for GS/OS (if omitted, ProDOS 8 defaults are used)"
|
||||
echo "-d use the default start program and prefix, without prompting"
|
||||
echo "-f overwrite existing ATINIT file if present, without warning"
|
||||
echo "-g create an ATINIT file for Guest as well as the specified user"
|
||||
echo "-c write ATNIT to current directory instead of USERS hierarchy"
|
||||
echo
|
||||
exit
|
||||
echo "usage: mkatinit [-gs] [-d] [-f] [-g | -c] [<username>|guest]"
|
||||
echo
|
||||
echo "<username> should be the name of a netatalk user, or 'guest'"
|
||||
echo "-gs sets the default ProDOS netboot system startup program and"
|
||||
echo " prefix for GS/OS (if omitted, ProDOS 8 defaults are used)"
|
||||
echo "-d use the default start program and prefix, without prompting"
|
||||
echo "-f overwrite existing ATINIT file if present, without warning"
|
||||
echo "-g create an ATINIT file for Guest as well as the specified user"
|
||||
echo "-c write ATNIT to current directory instead of USERS hierarchy"
|
||||
echo
|
||||
exit
|
||||
fi
|
||||
|
||||
arg="$1"
|
||||
@ -124,163 +125,162 @@ arg="$1"
|
||||
|
||||
while : ; do
|
||||
|
||||
if [ ${#arg} -gt 32 ]; then
|
||||
echo "User name is too long. Exiting with no action."
|
||||
exit
|
||||
elif [ -n "$arg" ]; then
|
||||
if [ `echo $arg | tr '[:upper:]' '[:lower:]'` = "guest" ]; then
|
||||
username='<Any User>'
|
||||
alsoguest=
|
||||
if [[ ! $(grep -F -s $(ls -1 /home) /etc/default/netatalk) ]]; then
|
||||
echo 'Warning: The AFPD_GUEST setting in /etc/default/netatalk is not assigned to a'
|
||||
echo 'user with a folder in /home. Guest users may be able to boot over the network'
|
||||
echo 'into ProDOS 8 for read-only access, but will not be able to boot into GS/OS.'
|
||||
if [ $gs ]; then
|
||||
echo ' Using ProDOS 8 defaults.'
|
||||
gs=
|
||||
else
|
||||
echo
|
||||
fi
|
||||
echo
|
||||
fi
|
||||
else
|
||||
username="$arg"
|
||||
if [[ ! $(ls -1 /home | grep -F -s $username) ]]; then
|
||||
echo "Warning: This username ($username) does not have a folder in /home. This user may"
|
||||
echo "not be able to boot over the network into ProDOS 8 or GS/OS."
|
||||
echo
|
||||
fi
|
||||
fi
|
||||
if [ $gs ]; then
|
||||
startprog="$gsstartprog"
|
||||
prefix="$gsprefix"
|
||||
fi
|
||||
fi
|
||||
|
||||
# make username all caps
|
||||
username=`echo $username | tr '[:lower:]' '[:upper:]'`
|
||||
|
||||
# prompt for folders
|
||||
if [ ! $doalsoguest ] && [ ! $noprompt ]; then
|
||||
while : ; do
|
||||
echo "Enter the ProDOS path to the startup system program."
|
||||
echo "default (CR to accept): $startprog"
|
||||
read
|
||||
if [ ${#REPLY} -gt 64 ]; then
|
||||
continue
|
||||
elif [ -n "$REPLY" ]; then
|
||||
startprog="`echo $REPLY | tr '[:lower:]' '[:upper:]'`"
|
||||
echo
|
||||
fi
|
||||
break
|
||||
done
|
||||
|
||||
while : ; do
|
||||
echo "Enter the initial ProDOS prefix:"
|
||||
echo "default (CR to accept): $prefix"
|
||||
read
|
||||
if [ ${#REPLY} -gt 64 ]; then
|
||||
continue
|
||||
elif [ -n "$REPLY" ]; then
|
||||
prefix="`echo $REPLY | tr '[:lower:]' '[:upper:]'`"
|
||||
echo
|
||||
fi
|
||||
break
|
||||
done
|
||||
fi
|
||||
|
||||
# create folders if needed
|
||||
filepath="$PWD/$filename"
|
||||
|
||||
while [ $usersfolder -eq 1 ]; do
|
||||
# create folders for ATINIT
|
||||
while [ ! -d "$sharepath" ]; do
|
||||
echo "Shared volume '$sharepath' not found. Edit mkatinit to change the default."
|
||||
echo "Enter the local path to the netatalk shared volume used for netboot:"
|
||||
read sharepath
|
||||
done
|
||||
|
||||
if [ ! -d "$sharepath/USERS" ]; then
|
||||
mkdir "$sharepath/USERS"
|
||||
if [ $? -ne 0 ]; then
|
||||
break
|
||||
fi
|
||||
fi
|
||||
if [ ! -d "$sharepath/USERS/$username" ]; then
|
||||
mkdir "$sharepath/USERS/$username"
|
||||
if [ $? -ne 0 ]; then
|
||||
break
|
||||
fi
|
||||
fi
|
||||
if [ ! -d "$sharepath/USERS/$username/SETUP" ]; then
|
||||
mkdir "$sharepath/USERS/$username/SETUP"
|
||||
if [ $? -ne 0 ]; then
|
||||
break
|
||||
fi
|
||||
else
|
||||
if [ ! -w "$sharepath/USERS/$username/SETUP" ]; then
|
||||
break
|
||||
fi
|
||||
fi
|
||||
|
||||
# we have a valid USERS folder target for ATINIT
|
||||
filepath="$sharepath/USERS/$username/SETUP/$filename"
|
||||
usersfolder=2
|
||||
done
|
||||
|
||||
if [ $usersfolder -eq 1 ]; then
|
||||
echo "Could not write to shared volume. Creating ATINIT in current directory."
|
||||
if [ -n "$alsoguest" ]; then
|
||||
echo "ATINIT for Guest user will not be created."
|
||||
fi
|
||||
echo
|
||||
alsoguest=
|
||||
fi
|
||||
if [ ${#arg} -gt 32 ]; then
|
||||
echo "User name is too long. Exiting with no action."
|
||||
exit
|
||||
elif [ -n "$arg" ]; then
|
||||
if [ `echo $arg | tr '[:upper:]' '[:lower:]'` = "guest" ]; then
|
||||
username='<Any User>'
|
||||
alsoguest=
|
||||
if [[ ! $(grep -F -s $(ls -1 /home) /etc/default/netatalk) ]]; then
|
||||
echo 'Warning: The AFPD_GUEST setting in /etc/default/netatalk is not assigned to a'
|
||||
echo 'user with a folder in /home. Guest users may be able to boot over the network'
|
||||
echo 'into ProDOS 8 for read-only access, but will not be able to boot into GS/OS.'
|
||||
if [ $gs ]; then
|
||||
echo ' Using ProDOS 8 defaults.'
|
||||
gs=
|
||||
else
|
||||
echo
|
||||
fi
|
||||
echo
|
||||
fi
|
||||
else
|
||||
username="$arg"
|
||||
if [[ ! $(ls -1 /home | grep -F -s $username) ]]; then
|
||||
echo "Warning: This username ($username) does not have a folder in /home. This user may"
|
||||
echo "not be able to boot over the network into ProDOS 8 or GS/OS."
|
||||
echo
|
||||
fi
|
||||
fi
|
||||
if [ $gs ]; then
|
||||
startprog="$gsstartprog"
|
||||
prefix="$gsprefix"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! $doalsoguest ]; then
|
||||
echo "netboot start program: $startprog"
|
||||
echo "netboot start prefix : $prefix"
|
||||
echo
|
||||
fi
|
||||
|
||||
#remove ATINIT if present
|
||||
if [ ! $overwrite ] && [ -f "$filepath" ]; then
|
||||
echo -n "$filepath already exists. Overwrite? "
|
||||
while read -s -n 1 > /dev/null 2>&1; do
|
||||
if [ -z "$REPLY" ]; then
|
||||
continue
|
||||
elif [ "$REPLY" = "Y" ] || [ "$REPLY" = "y" ]; then
|
||||
echo
|
||||
break
|
||||
elif [ "$REPLY" = "N" ] || [ "$REPLY" = "n" ]; then
|
||||
echo
|
||||
echo "Exiting with no action."
|
||||
exit
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
#write the file. start with zeroes
|
||||
dd if=/dev/zero of="$filepath" bs=1 count=276 2> /dev/null
|
||||
#put in startprog, prefix, username (first byte of each field is length)
|
||||
# ( echo -n "${#startprog}" | awk '{printf("%c",$0);}'; echo -n "$startprog"; ) | dd of="$filepath" bs=1 seek=7 conv=notrunc 2> /dev/null
|
||||
# ( echo -n "${#prefix}" | awk '{printf("%c",$0);}'; echo -n "$prefix"; ) | dd of="$filepath" bs=1 seek=78 conv=notrunc 2> /dev/null
|
||||
# ( echo -n "${#username}" | awk '{printf("%c",$0);}'; echo -n "$username"; ) | dd of="$filepath" bs=1 seek=143 conv=notrunc 2> /dev/null
|
||||
( decToChar "${#startprog}"; echo -n "$startprog"; ) | writechars "$filepath" 7
|
||||
( decToChar "${#prefix}"; echo -n "$prefix"; ) | writechars "$filepath" 78
|
||||
( decToChar "${#username}"; echo -n "$username"; ) | writechars "$filepath" 143
|
||||
|
||||
echo "Created $filepath"
|
||||
if [ ! $alsoguest ]; then
|
||||
break
|
||||
fi
|
||||
# make username all caps
|
||||
username=`echo $username | tr '[:lower:]' '[:upper:]'`
|
||||
|
||||
if [ $usersfolder -eq 2 ]; then
|
||||
usersfolder=1
|
||||
fi
|
||||
doalsoguest=1
|
||||
arg='guest'
|
||||
# prompt for folders
|
||||
if [ ! $doalsoguest ] && [ ! $noprompt ]; then
|
||||
while : ; do
|
||||
echo "Enter the ProDOS path to the startup system program."
|
||||
echo "default (CR to accept): $startprog"
|
||||
read
|
||||
if [ ${#REPLY} -gt 64 ]; then
|
||||
continue
|
||||
elif [ -n "$REPLY" ]; then
|
||||
startprog="`echo $REPLY | tr '[:lower:]' '[:upper:]'`"
|
||||
echo
|
||||
fi
|
||||
break
|
||||
done
|
||||
|
||||
while : ; do
|
||||
echo "Enter the initial ProDOS prefix:"
|
||||
echo "default (CR to accept): $prefix"
|
||||
read
|
||||
if [ ${#REPLY} -gt 64 ]; then
|
||||
continue
|
||||
elif [ -n "$REPLY" ]; then
|
||||
prefix="`echo $REPLY | tr '[:lower:]' '[:upper:]'`"
|
||||
echo
|
||||
fi
|
||||
break
|
||||
done
|
||||
fi
|
||||
|
||||
# create folders if needed
|
||||
filepath="$PWD/$filename"
|
||||
|
||||
while [ $usersfolder -eq 1 ]; do
|
||||
# create folders for ATINIT
|
||||
while [ ! -d "$sharepath" ]; do
|
||||
echo "Shared volume '$sharepath' not found. Edit mkatinit to change the default."
|
||||
echo "Enter the local path to the netatalk shared volume used for netboot:"
|
||||
read sharepath
|
||||
done
|
||||
|
||||
if [ ! -d "$sharepath/USERS" ]; then
|
||||
mkdir "$sharepath/USERS"
|
||||
if [ $? -ne 0 ]; then
|
||||
break
|
||||
fi
|
||||
fi
|
||||
if [ ! -d "$sharepath/USERS/$username" ]; then
|
||||
mkdir "$sharepath/USERS/$username"
|
||||
if [ $? -ne 0 ]; then
|
||||
break
|
||||
fi
|
||||
fi
|
||||
if [ ! -d "$sharepath/USERS/$username/SETUP" ]; then
|
||||
mkdir "$sharepath/USERS/$username/SETUP"
|
||||
if [ $? -ne 0 ]; then
|
||||
break
|
||||
fi
|
||||
else
|
||||
if [ ! -w "$sharepath/USERS/$username/SETUP" ]; then
|
||||
break
|
||||
fi
|
||||
fi
|
||||
|
||||
# we have a valid USERS folder target for ATINIT
|
||||
filepath="$sharepath/USERS/$username/SETUP/$filename"
|
||||
usersfolder=2
|
||||
done
|
||||
|
||||
if [ $usersfolder -eq 1 ]; then
|
||||
echo "Could not write to shared volume. Creating ATINIT in current directory."
|
||||
if [ -n "$alsoguest" ]; then
|
||||
echo "ATINIT for Guest user will not be created."
|
||||
fi
|
||||
echo
|
||||
alsoguest=
|
||||
fi
|
||||
|
||||
if [ ! $doalsoguest ]; then
|
||||
echo "netboot start program: $startprog"
|
||||
echo "netboot start prefix : $prefix"
|
||||
echo
|
||||
fi
|
||||
|
||||
#remove ATINIT if present
|
||||
if [ ! $overwrite ] && [ -f "$filepath" ]; then
|
||||
echo -n "$filepath already exists. Overwrite? "
|
||||
while read -s -n 1 > /dev/null 2>&1; do
|
||||
if [ -z "$REPLY" ]; then
|
||||
continue
|
||||
elif [ "$REPLY" = "Y" ] || [ "$REPLY" = "y" ]; then
|
||||
echo
|
||||
break
|
||||
elif [ "$REPLY" = "N" ] || [ "$REPLY" = "n" ]; then
|
||||
echo
|
||||
echo "Exiting with no action."
|
||||
exit
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
#write the file. start with zeroes
|
||||
dd if=/dev/zero of="$filepath" bs=1 count=276 2> /dev/null
|
||||
#put in startprog, prefix, username (first byte of each field is length)
|
||||
# ( echo -n "${#startprog}" | awk '{printf("%c",$0);}'; echo -n "$startprog"; ) | dd of="$filepath" bs=1 seek=7 conv=notrunc 2> /dev/null
|
||||
# ( echo -n "${#prefix}" | awk '{printf("%c",$0);}'; echo -n "$prefix"; ) | dd of="$filepath" bs=1 seek=78 conv=notrunc 2> /dev/null
|
||||
# ( echo -n "${#username}" | awk '{printf("%c",$0);}'; echo -n "$username"; ) | dd of="$filepath" bs=1 seek=143 conv=notrunc 2> /dev/null
|
||||
( decToChar "${#startprog}"; echo -n "$startprog"; ) | writechars "$filepath" 7
|
||||
( decToChar "${#prefix}"; echo -n "$prefix"; ) | writechars "$filepath" 78
|
||||
( decToChar "${#username}"; echo -n "$username"; ) | writechars "$filepath" 143
|
||||
|
||||
echo "Created $filepath"
|
||||
if [ ! $alsoguest ]; then
|
||||
break
|
||||
fi
|
||||
|
||||
if [ $usersfolder -eq 2 ]; then
|
||||
usersfolder=1
|
||||
fi
|
||||
doalsoguest=1
|
||||
arg='guest'
|
||||
done
|
||||
|
||||
echo
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
#! /bin/bash
|
||||
# vim: set tabstop=4 shiftwidth=4 expandtab filetype=sh:
|
||||
|
||||
# mkvolinfo -- creates a (share)/.AppleDesktop/.volinfo file
|
||||
|
||||
@ -27,7 +28,7 @@ while [[ $1 == "-f" || $1 == "-c" ]]; do
|
||||
force=1
|
||||
shift
|
||||
fi
|
||||
|
||||
|
||||
if [[ $1 == "-c" ]]; then
|
||||
mixedcase=1
|
||||
shift
|
||||
|
@ -1,3 +1,6 @@
|
||||
#! /bin/bash
|
||||
# vim: set tabstop=4 shiftwidth=4 expandtab filetype=sh:
|
||||
|
||||
# A2SERVER master setup script, last update 15-Feb-2015
|
||||
# it downloads and executes several scripts related to the setup of
|
||||
# netatalk configured for Apple II use on Debian, Raspbian, or Ubuntu.
|
||||
@ -42,7 +45,7 @@ while [[ $1 ]]; do
|
||||
setupWindowsSharing="-w"
|
||||
touch /tmp/a2server-setupWindowsSharing
|
||||
elif [[ $1 == "-os" || $1 == "os" ]]; then
|
||||
# elif [[ ${1,,} == "rasppleii" || ${1,,} == "raspple" || ${1,,} == "rasappleii" || ${1,,} == "rasapple" || ${1,,} == "raspple2" || ${1,,} == "rasapple2" ]]; then
|
||||
# elif [[ ${1,,} == "rasppleii" || ${1,,} == "raspple" || ${1,,} == "rasappleii" || ${1,,} == "rasapple" || ${1,,} == "raspple2" || ${1,,} == "rasapple2" ]]; then
|
||||
shift
|
||||
updateRasppleII=1
|
||||
elif [[ $1 == "-v" ]]; then
|
||||
@ -89,9 +92,9 @@ if [[ $isRpi ]]; then #supported Raspbian? (16-Feb-15, 20-Jun-14, 09-Jan-14, etc
|
||||
fwhash=$(zcat /usr/share/doc/raspberrypi-bootloader/changelog.Debian.gz | grep -m 1 'as of' | awk '{print $NF}')
|
||||
[[ ($fwhash == "8aca5762") || ($fwhash == "462f3e3f476f7b6") || ($fwhash == "c32bc633039cd9") || ($fwhash == "9d34d0475f9") || ($fwhash == "d4f5315cfac4e") || ($fwhash == "6f4a90c8cb8817f") || ($fwhash == "5dd9b4962e") || ($fwhash == "17c8799375") ]] && unsupportedOS=0
|
||||
elif [[ "$(lsb_release -rs 2> /dev/null)" == "12.04" ]]; then #Ubuntu 12.04?
|
||||
unsupportedOS=0
|
||||
unsupportedOS=0
|
||||
elif [[ "$(lsb_release -rs 2> /dev/null)" == "7.3" || "$(lsb_release -rs 2> /dev/null)" == "7.6" || "$(lsb_release -rs 2> /dev/null)" == "7.8" ]]; then # tested Debian?
|
||||
unsupportedOS=0
|
||||
unsupportedOS=0
|
||||
fi
|
||||
|
||||
if (( unsupportedOS )); then
|
||||
@ -100,19 +103,19 @@ if (( unsupportedOS )); then
|
||||
echo "operating system version. Continuing is probably fine, but might not be."
|
||||
echo "Worst case could make your operating system no longer work properly,"
|
||||
echo "or cause data to be lost."
|
||||
echo "More information is at http://appleii.ivanx.com/a2server."
|
||||
echo "More information is at http://appleii.ivanx.com/a2server."
|
||||
fi
|
||||
|
||||
doSetup=1
|
||||
if [[ ! -f /usr/local/etc/a2server-help.txt ]] || (( $a2server_update )); then
|
||||
echo
|
||||
echo "Setting up A2SERVER will take up to 60 minutes, during which"
|
||||
echo "you'll see a bunch of stuff spit out across the screen."
|
||||
echo
|
||||
if [[ ! $autoAnswerYes ]]; then
|
||||
echo -n "Ready to set up A2SERVER? "
|
||||
read
|
||||
[[ ${REPLY:0:1} == "y" || ${REPLY:0:1} == "Y" ]]; doSetup=$(( 1 - $? ))
|
||||
echo
|
||||
echo "Setting up A2SERVER will take up to 60 minutes, during which"
|
||||
echo "you'll see a bunch of stuff spit out across the screen."
|
||||
echo
|
||||
if [[ ! $autoAnswerYes ]]; then
|
||||
echo -n "Ready to set up A2SERVER? "
|
||||
read
|
||||
[[ ${REPLY:0:1} == "y" || ${REPLY:0:1} == "Y" ]]; doSetup=$(( 1 - $? ))
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -122,12 +125,12 @@ if (( $doSetup )); then
|
||||
echo "a2server-setup modifies files and performs actions as the root user."
|
||||
echo "For details, visit http://appleii.ivanx.com/a2server."
|
||||
echo
|
||||
if [[ ! $autoAnswerYes ]]; then
|
||||
if [[ ! $autoAnswerYes ]]; then
|
||||
echo -n "Continue? "
|
||||
read
|
||||
[[ ${REPLY:0:1} == "y" || ${REPLY:0:1} == "Y" ]]; doSetup=$(( 1 - $? ))
|
||||
fi
|
||||
|
||||
|
||||
if (( $doSetup )); then
|
||||
|
||||
userPw=$(sudo grep "^$USER" /etc/shadow | cut -f 2 -d ':')
|
||||
@ -137,7 +140,7 @@ if (( $doSetup )); then
|
||||
password="your password"
|
||||
[[ $isApple2Pw ]] && password="'apple2'"
|
||||
[[ $isRaspberryPw ]] && password="'raspberry'"
|
||||
|
||||
|
||||
|
||||
[[ $isRpi ]] && a2server="your Raspberry Pi" || a2server="A2SERVER"
|
||||
if [[ ! $isApple2Pw && ! -f /usr/local/etc/A2SERVER-version ]]; then
|
||||
@ -161,30 +164,30 @@ if (( $doSetup )); then
|
||||
echo
|
||||
|
||||
sudo true
|
||||
|
||||
|
||||
echo
|
||||
echo "A2SERVER: Downloading scripts..."
|
||||
|
||||
|
||||
wget -q -O /tmp/1.storage appleii.ivanx.com/a2server/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
|
||||
chmod ugo+x /tmp/2.tools
|
||||
|
||||
wget -q -O /tmp/3.sharing appleii.ivanx.com/a2server/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
|
||||
chmod ugo+x /tmp/5.netboot
|
||||
|
||||
|
||||
wget -q -O /tmp/6.samba appleii.ivanx.com/a2server/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
|
||||
chmod ugo+x /tmp/7.console
|
||||
|
||||
echo "A2SERVER: Scripts have been downloaded. Installing..."
|
||||
|
||||
|
||||
/tmp/1.storage
|
||||
rm /tmp/1.storage
|
||||
/tmp/2.tools
|
||||
@ -198,9 +201,9 @@ if (( $doSetup )); then
|
||||
/tmp/7.console
|
||||
rm /tmp/7.console
|
||||
rm /tmp/a2server-packageReposUpdated &> /dev/null
|
||||
|
||||
|
||||
if [[ ! -f /usr/local/etc/A2SERVER-version ]] \
|
||||
|| (( $(cat /usr/local/etc/A2SERVER-version) < "$a2serverVersion" )); then
|
||||
|| (( $(cat /usr/local/etc/A2SERVER-version) < "$a2serverVersion" )); then
|
||||
echo "$a2serverVersion" | sudo tee /usr/local/etc/A2SERVER-version &> /dev/null
|
||||
fi
|
||||
|
||||
@ -253,7 +256,7 @@ if (( $doSetup )); then
|
||||
echo "by typing 'appletalk-on'."
|
||||
echo
|
||||
fi
|
||||
|
||||
|
||||
if [[ -f /tmp/singleUser ]]; then
|
||||
if [[ ! $autoAnswerYes ]]; then
|
||||
echo "Your Raspberry Pi was started in single-user mode in order to"
|
||||
@ -268,11 +271,11 @@ if (( $doSetup )); then
|
||||
fi
|
||||
echo
|
||||
fi
|
||||
|
||||
|
||||
echo
|
||||
echo "Type 'system-shutdown' to turn off A2SERVER."
|
||||
echo "Type 'a2server-setup' to configure network boot."
|
||||
echo "Type 'a2server-help' for a list of other commands."
|
||||
echo "Type 'system-shutdown' to turn off A2SERVER."
|
||||
echo "Type 'a2server-setup' to configure network boot."
|
||||
echo "Type 'a2server-help' for a list of other commands."
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -1,9 +1,12 @@
|
||||
#! /bin/bash
|
||||
# vim: set tabstop=4 shiftwidth=4 expandtab filetype=sh:
|
||||
|
||||
currentVersion=124
|
||||
|
||||
if [[ -f /usr/local/etc/A2SERVER-version ]]; then
|
||||
installedVersion=$(cat /usr/local/etc/A2SERVER-version)
|
||||
installedVersion=$(cat /usr/local/etc/A2SERVER-version)
|
||||
else
|
||||
installedVersion=100
|
||||
installedVersion=100
|
||||
fi
|
||||
|
||||
autoAnswerYes=
|
||||
|
Loading…
Reference in New Issue
Block a user