mirror of
https://github.com/RasppleII/a2server.git
synced 2026-01-23 09:16:16 +00:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14f5ef66be | ||
|
|
04ad897c97 | ||
|
|
06bc59ece7 | ||
|
|
c2bb79860a | ||
|
|
343bde59fa | ||
|
|
024f579850 | ||
|
|
0fffaf93cb | ||
|
|
0bd95253fe | ||
|
|
b5496b55aa | ||
|
|
9f397b1f9f | ||
|
|
435857e3bb | ||
|
|
b0bb0e7b99 | ||
|
|
bb9e458a98 |
13
LICENSE.md
Normal file
13
LICENSE.md
Normal file
@@ -0,0 +1,13 @@
|
||||
License for A2SERVER
|
||||
====================
|
||||
|
||||
A2SERVER
|
||||
|
||||
Copyright (C) 2013-2015 Ivan Drucker <ivan@ivanx.com>
|
||||
|
||||
The A2SERVER scripts themselves are written primarily by Ivan Drucker and
|
||||
released under the WTFPL version 2, which you may download from its web page
|
||||
at <http://www.wtfpl.net/txt/copying/>. This is essentially a public domain
|
||||
release, which doesn't extend to the other programs used by A2SERVER such as
|
||||
netatalk or the various Linux tools it installs. These have their own license
|
||||
terms and Copyrights.
|
||||
14
README.md
14
README.md
@@ -18,16 +18,14 @@ the shell variable A2SERVER_SCRIPT_URL to the base URL of this repository
|
||||
on your server. The base-URL should be slash-terminated. You can then run
|
||||
the following snippet:
|
||||
|
||||
```bash
|
||||
~~~ bash
|
||||
wget -O a2server-setup ${A2SERVER_SCRIPT_URL}setup/index.txt; source a2server-setup
|
||||
```
|
||||
~~~
|
||||
|
||||
A simple method installing from a local folder is to change to that sudirectory
|
||||
and run the following. Then export A2SERVER_SCRIPT_URL to "http://localhost:8000/"
|
||||
|
||||
```bash
|
||||
python -m SimpleHTTPServer
|
||||
```
|
||||
A simple method for installing from a local subdirectory is to `cd` to it and
|
||||
then type `python -m SimpleHTTPServer`. Then
|
||||
`export A2SERVER_SCRIPT_URL="http://localhost:8000/"`
|
||||
or use the IP address of the host machine on your LAN instead of localhost.
|
||||
|
||||
You should probably export A2SERVER_SCRIPT_URL in your .bashrc or whatever
|
||||
file configures your development environment. Also be advised that as of
|
||||
|
||||
@@ -34,7 +34,7 @@ behavior like invisible files.
|
||||
|
||||
Unix-type computers can also use `scp` to copy files to and from A2SERVER;
|
||||
Windows computers can also do so in the command window by using `pscp` in
|
||||
[PuTTY][1]. The shared volumes are within /media/A2SHARED.
|
||||
[PuTTY][1]. The shared volumes are within /srv/A2SERVER.
|
||||
|
||||
If you need to set the ProDOS file type of a file you have copied to A2SERVER,
|
||||
[log in to A2SERVER](a2server_commands.md) and use `afptype`.
|
||||
|
||||
@@ -26,7 +26,7 @@ The default username is either "pi" for Raspberry Pi, and otherwise
|
||||
standard installation of Raspbian; you can use the
|
||||
[installer script](a2server_installer.md) to install A2SERVER.)
|
||||
|
||||
Shared volumes can be found at /media/A2SHARED. Netatalk configuration files
|
||||
Shared volumes can be found at /srv/A2SERVER. Netatalk configuration files
|
||||
are in /usr/local/etc/netatalk.
|
||||
|
||||
Once logged in, you can enter the following commands.
|
||||
|
||||
@@ -21,7 +21,7 @@ themselves):
|
||||
|
||||
[Storage setup](scripts/a2server-1-storage.txt) (runs during initial setup, skipped on subsequent runs)
|
||||
|
||||
* Make the /media/A2SHARED directory
|
||||
* Make the /srv/A2SERVER directory
|
||||
|
||||
|
||||
[A2SERVER tools install](scripts/a2server-2-tools.txt) (always runs)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
|
||||
# skip if we're already set up
|
||||
if [[ -d /media/A2SHARED ]]; then
|
||||
if [[ -d /srv/A2SERVER ]]; then
|
||||
|
||||
echo "A2SERVER: Shared disk is already prepared for use."
|
||||
|
||||
@@ -12,8 +12,8 @@ else
|
||||
|
||||
echo "A2SERVER: Preparing the shared files disk..."
|
||||
|
||||
sudo mkdir /media/A2SHARED
|
||||
sudo mkdir /srv/A2SERVER
|
||||
|
||||
sudo chown $USER:$USER /media/A2SHARED
|
||||
sudo chown $USER:$USER /srv/A2SERVER
|
||||
|
||||
fi
|
||||
@@ -213,7 +213,7 @@ fi
|
||||
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
|
||||
[[ -d /srv/A2SERVER/GSFILES ]] || mkdir -p /srv/A2SERVER/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)
|
||||
@@ -222,9 +222,9 @@ sudo sed -i \
|
||||
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
|
||||
[[ -d /srv/A2SERVER/A2FILES ]] || mkdir -p /srv/A2SERVER/A2FILES
|
||||
if [[ ! -d /srv/A2SERVER/A2FILES/.AppleDesktop ]]; then
|
||||
cd /srv/A2SERVER/A2FILES
|
||||
mkdir .AppleDesktop
|
||||
ln -s .AppleDesktop .APPLEDESKTOP
|
||||
fi
|
||||
@@ -232,11 +232,11 @@ 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
|
||||
if [[ ! -d /srv/A2SERVER/ADTDISKS ]]; then
|
||||
ln -s /usr/local/adtpro/disks /srv/A2SERVER/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
|
||||
sudo sed -i 's@^# End of File@/srv/A2SERVER/ADTDISKS ADTDISKS ea:ad\n\n# End of File@' /usr/local/etc/netatalk/AppleVolumes.default
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@@ -6,15 +6,15 @@
|
||||
# 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"
|
||||
gsosDir="/srv/A2SERVER/A2FILES"
|
||||
imagesDir=$gsosDir/GSOS.INSTALLER/IMAGES
|
||||
imageToolsDir=$gsosDir/GSOS.INSTALLER/IMAGE.TOOLS
|
||||
netInstallDir=$gsosDir/GSOS.INSTALLER/NET.INSTALL
|
||||
|
||||
p8Dir="/media/A2SHARED/A2FILES"
|
||||
p8Dir="/srv/A2SERVER/A2FILES"
|
||||
diskToolsP8Dir=$p8Dir/DISK.TOOLS.P8
|
||||
|
||||
commDir="/media/A2SHARED/A2FILES/COMM"
|
||||
commDir="/srv/A2SERVER/A2FILES/COMM"
|
||||
spectrumDir=$commDir/SPECTRUM
|
||||
protermDir=$commDir/PROTERM
|
||||
zlinkDir=$commDir/Z.LINK
|
||||
@@ -116,7 +116,7 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
|
||||
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
|
||||
if [[ -f "/srv/A2SERVER/A2FILES/SYSTEM/START.GS.OS" ]]; then
|
||||
echo "A2SERVER: GS/OS has already been downloaded and installed."
|
||||
gsosInstall=1
|
||||
else
|
||||
|
||||
@@ -62,7 +62,7 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupWindowsSharing ]]; 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 " path = /srv/A2SERVER/$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
|
||||
|
||||
@@ -47,8 +47,8 @@ alias appletalk-on='sudo sed -i "s/ATALKD_RUN=no/ATALKD_RUN=yes/" /etc/default/n
|
||||
|
||||
|
||||
NETATALK="/usr/local/etc/netatalk"
|
||||
A2FILES="/media/A2SHARED/A2FILES"
|
||||
GSFILES="/media/A2SHARED/GSFILES"
|
||||
A2FILES="/srv/A2SERVER/A2FILES"
|
||||
GSFILES="/srv/A2SERVER/GSFILES"
|
||||
|
||||
alias netboot-gsos="mkatinit -gs -d -f"
|
||||
alias netboot-gsos-guest="mkatinit -gs -d -f guest"
|
||||
@@ -70,9 +70,9 @@ alias samba-start='[[ $(lsb_release -d 2> /dev/null | grep Ubuntu) ]] && { sudo
|
||||
alias samba-restart='[[ $(lsb_release -d 2> /dev/null | grep Ubuntu) ]] && { sudo initctl restart smbd; sudo initctl restart nmbd; } || { sudo /etc/init.d/samba restart; }'
|
||||
|
||||
alias gsfiles-share="sudo sed -i 's/^\/media\/A2SHARED\/GSFILES\ GSFILES options:prodos/#share1/' /usr/local/etc/netatalk/AppleVolumes.default"
|
||||
alias gsfiles-unshare="sudo sed -i 's/^#share1/\/media\/A2SHARED\/GSFILES\ GSFILES options:prodos/' /usr/local/etc/netatalk/AppleVolumes.default; [[ -d /media/A2SHARED/GSFILES ]] || mkdir /media/A2SHARED/GSFILES"
|
||||
alias gsfiles-unshare="sudo sed -i 's/^#share1/\/media\/A2SHARED\/GSFILES\ GSFILES options:prodos/' /usr/local/etc/netatalk/AppleVolumes.default; [[ -d /srv/A2SERVER/GSFILES ]] || mkdir /srv/A2SERVER/GSFILES"
|
||||
alias a2files-share="sudo sed -i 's/^\/media\/A2SHARED\/A2FILES\ A2FILES options:prodos\ casefold:toupper/#share2/' /usr/local/etc/netatalk/AppleVolumes.default"
|
||||
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 a2files-unshare="sudo sed -i 's/^#share2/\/media\/A2SHARED\/A2FILES\ A2FILES options:prodos\ casefold:toupper/' /usr/local/etc/netatalk/AppleVolumes.default; [[ -d /srv/A2SERVER/A2FILES ]] || mkdir /srv/A2SERVER/A2FILES"
|
||||
|
||||
alias showalias="alias | cut -d= -f 1 | cut -d' ' -f2 | more"
|
||||
|
||||
|
||||
@@ -1,541 +0,0 @@
|
||||
#! /usr/bin/env python
|
||||
# vim: set tabstop=4 shiftwidth=4 expandtab filetype=python:
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
import os, sys, subprocess
|
||||
import tempfile
|
||||
import hashlib
|
||||
import shutil
|
||||
import xml.etree.cElementTree as ET
|
||||
|
||||
quiet = False
|
||||
verbose = True
|
||||
|
||||
disk7_sources = {
|
||||
"file" : "Disk_7_of_7-Apple_II_Setup.sea.bin",
|
||||
"digest" : "43fbc296ab66da84aadc275b80fd51ec4f7fe986",
|
||||
"type" : "sea.bin",
|
||||
"sources" : [
|
||||
( "Apple", "http://download.info.apple.com/Apple_Support_Area/Apple_Software_Updates/English-North_American/Apple_II/Apple_IIGS_System_6.0.1/Disk_7_of_7-Apple_II_Setup.sea.bin" ),
|
||||
( "archive.org", "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" )
|
||||
]
|
||||
}
|
||||
|
||||
a2boot_files = [
|
||||
{
|
||||
"unix" : "Apple ::e Boot Blocks",
|
||||
"hfsutils" : "Apple_--e_Boot_Blocks.bin",
|
||||
"netatalk" : "Apple :2f:2fe Boot Blocks",
|
||||
"digest" : "cada362ac2eca3ffa506e9b4e76650ba031e0035",
|
||||
"patches" : (
|
||||
[
|
||||
"Cleartext password login bug",
|
||||
(0x4d43, b"\xA8\xA2\x01\xBD\x80\x38\x99\xA0\x38\xC8\xE8\xE0\x09\x90\xF4"),
|
||||
|
||||
"ProDOS 8 patch: year table, splash date (6.0.3)",
|
||||
(0x004f, b"\xb0\xb2\xad\xc1\xf5\xe7\xad\xb1\xb5"),
|
||||
(0x1b9f, b"\x12\x11\x0b\x10\x0f\x0e\x0d"),
|
||||
],
|
||||
"8cff6ef453533423b34b5b4fefd642441e2ee374",
|
||||
),
|
||||
},
|
||||
{
|
||||
"unix" : "Basic.System",
|
||||
"hfsutils" : "Basic.System.bin",
|
||||
"netatalk" : "Basic.System",
|
||||
"digest" : "4d53424f1451cd2e874cf792dbdc8cc6735dcd36",
|
||||
},
|
||||
{
|
||||
"unix" : "ProDOS16 Boot Blocks",
|
||||
"hfsutils" : "ProDOS16_Boot_Blocks.bin",
|
||||
"netatalk" : "ProDOS16 Boot Blocks",
|
||||
"digest" : "fab829e82e6662ed6aab119ad18e16ded7d43cda",
|
||||
},
|
||||
{
|
||||
"unix" : "ProDOS16 Image",
|
||||
"hfsutils" : "ProDOS16_Image.bin",
|
||||
"netatalk" : "ProDOS16 Image",
|
||||
"digest" : "db4608067b9e7877f45eb557971c4d8c45b46be5",
|
||||
"patches" : (
|
||||
[
|
||||
"Cleartext password login bug",
|
||||
(0x5837, b"\xA8\xA2\x01\xBD\x80\x10\x99\xA0\x10\xC8\xE8\xE0\x09\x90\xF4"),
|
||||
|
||||
"Enable pressing \"8\" during GS/OS netboot to load ProDOS 8",
|
||||
(0x0100, b"\x92"),
|
||||
(0x0360, b"\x20\x7d\x14"),
|
||||
(0x067d, b"\xad\x00\xc0\x29\xff\x00\xc9\xb8\x00\xd0\x06\xa9\x02\x00\x8d\x53\x14\xa9\x10\x0f\x60"),
|
||||
|
||||
"ProDOS 8 patch: year table, splash date (6.0.3)",
|
||||
(0x0c26, b"\xb0\xb2\xad\xc1\xf5\xe7\xad\xb1\xb5"),
|
||||
(0x1b76, b"\x12\x11\x0b\x10\x0f\x0e\x0d"),
|
||||
],
|
||||
"1f0477030b7e9c809b0a2282896ca66033e7ca9f",
|
||||
),
|
||||
},
|
||||
{
|
||||
"unix" : "p8",
|
||||
"hfsutils" : "p8.bin",
|
||||
"netatalk" : "p8",
|
||||
# 36c288a5272cf01e0a64eed16786258959118e0e P8 (02-Apr-93, a2setup)
|
||||
# c99f69c8dbfe79f02c715162fb409aedf52d378a P8 (06-May-93, 6.0.1)
|
||||
# Only splash date differs.
|
||||
"digest" : "36c288a5272cf01e0a64eed16786258959118e0e",
|
||||
"patches" : (
|
||||
[
|
||||
# May as well patch the splash as well. *shrug*
|
||||
"ProDOS 8 patch: year table, splash date (6.0.3)",
|
||||
(0x0026, b"\xb0\xb2\xad\xc1\xf5\xe7\xad\xb1\xb5"),
|
||||
(0x0f76, b"\x12\x11\x0b\x10\x0f\x0e\x0d"),
|
||||
],
|
||||
"ad1e6c8f653df428d13cb8ae5ce4f8425a52016b",
|
||||
),
|
||||
},
|
||||
]
|
||||
|
||||
# True for Python 3.0 and later
|
||||
PY3 = sys.version_info >= (3, 0)
|
||||
|
||||
if PY3:
|
||||
stdin_input = input
|
||||
import urllib.request as urlrequest
|
||||
else:
|
||||
stdin_input = raw_input
|
||||
import urllib2 as urlrequest
|
||||
|
||||
|
||||
def sha1sum_file (filename, blocksize=65536):
|
||||
f = open(filename, "rb")
|
||||
digest = hashlib.sha1()
|
||||
buf = f.read(blocksize)
|
||||
while len(buf) > 0:
|
||||
digest.update(buf)
|
||||
buf = f.read(blocksize)
|
||||
f.close()
|
||||
return digest.hexdigest()
|
||||
|
||||
|
||||
def download_from_sources(fileinfo, output_dir):
|
||||
output_path = os.path.join(output_dir, fileinfo["file"])
|
||||
if not quiet:
|
||||
print("Downloading %s" % (fileinfo["file"]))
|
||||
for (source, url) in fileinfo["sources"]:
|
||||
if not quiet:
|
||||
print(" From %s..." % (source), end="")
|
||||
|
||||
try:
|
||||
html = urlrequest.urlopen(url)
|
||||
data = html.read()
|
||||
f = open(output_path, "wb")
|
||||
f.write(data)
|
||||
f.close()
|
||||
except:
|
||||
if not quiet:
|
||||
print(" download failed.")
|
||||
if 'f' in locals():
|
||||
if not f.isclosed():
|
||||
f.close()
|
||||
continue
|
||||
|
||||
digest = sha1sum_file(output_path)
|
||||
if digest == fileinfo["digest"]:
|
||||
if not quiet:
|
||||
print(" successfully downloaded.")
|
||||
return True
|
||||
else:
|
||||
if not quiet:
|
||||
print(" failed (digest mismatch).")
|
||||
if verbose:
|
||||
print(" Expected: %s\n Received: %s"
|
||||
% (fileinfo["digest"], digest))
|
||||
|
||||
return False
|
||||
|
||||
|
||||
# Apple's GS/OS 6.0.1 images are stored in MacBinary-wrapped
|
||||
# self-extracting disk image files. The Unarchiver's unar is able
|
||||
# to unwrap the MacBinary wrapper for us, but we have to extract the
|
||||
# disk image oursselves. Fortunately, it's uncompressed.
|
||||
def extract_800k_sea_bin(archive_name, image_name, archive_dir):
|
||||
if not quiet:
|
||||
print("Extracting %s..." % (archive_name), end="")
|
||||
|
||||
archive_path = os.path.join(archive_dir, archive_name)
|
||||
image_path = os.path.join(archive_dir, image_name)
|
||||
|
||||
if not os.path.isfile(archive_path):
|
||||
if not quiet:
|
||||
print(" not found.")
|
||||
return False
|
||||
|
||||
# Extract the original filename from the file
|
||||
# MacBinary II header is 128 bytes. The first byte is NUL, followed by a
|
||||
# Pascal string of length 63 (so 64 bytes total) containing the encoded
|
||||
# filename.
|
||||
#
|
||||
# Source: http://files.stairways.com/other/macbinaryii-standard-info.txt
|
||||
# FIXME: We should eventually implement a full MacBinary reader.
|
||||
|
||||
try:
|
||||
f = open(archive_path, "rb")
|
||||
sea_name = f.read(65)
|
||||
f.close()
|
||||
|
||||
if len(sea_name) < 65:
|
||||
if not quiet:
|
||||
print(" file too short.")
|
||||
return False
|
||||
|
||||
if PY3:
|
||||
sea_name = sea_name[2:2 + sea_name[1]].decode("mac_roman")
|
||||
else:
|
||||
sea_name = sea_name[2:2 + ord(sea_name[1])]
|
||||
except:
|
||||
if not quiet:
|
||||
print(" error: cannot read expanded name")
|
||||
if 'f' in locals():
|
||||
if not f.isclosed():
|
||||
f.close()
|
||||
return False
|
||||
|
||||
try:
|
||||
cmdline = ["unar", "-q", "-o", archive_dir, "-k", "skip", archive_path]
|
||||
ret = subprocess.call(cmdline)
|
||||
if ret != 0:
|
||||
if not quiet:
|
||||
print(" error: unar returned error %i" % (ret))
|
||||
return False
|
||||
except OSError as e:
|
||||
if not quiet:
|
||||
print(" error: running unar: %s" % (e))
|
||||
return False
|
||||
|
||||
sea_path = os.path.join(archive_dir, sea_name)
|
||||
if not os.path.isfile(sea_path):
|
||||
if not quiet:
|
||||
print(" error: \"%s\" was not extracted." % (sea_name))
|
||||
return False
|
||||
|
||||
try:
|
||||
# The image starts 84 bytes in, and is exactly 819200 bytes long
|
||||
with open(sea_path, "rb") as src, open(image_path, "wb") as dst:
|
||||
src.seek(84)
|
||||
dst.write(src.read(819200))
|
||||
if dst.tell() != 819200:
|
||||
raise IOError()
|
||||
extracted = True
|
||||
except:
|
||||
if not quiet:
|
||||
print(" error: \"%s\" is not an 800k floppy image"
|
||||
% (sea_name))
|
||||
extracted = False
|
||||
finally:
|
||||
if not quiet:
|
||||
print(" done.")
|
||||
os.unlink(sea_path)
|
||||
os.unlink(archive_path)
|
||||
|
||||
return extracted
|
||||
|
||||
|
||||
def plist_keyvalue(plist_dict, key):
|
||||
if plist_dict.tag != "dict":
|
||||
raise ValueError("not a plist dict")
|
||||
found = False
|
||||
for elem in plist_dict:
|
||||
if found:
|
||||
return elem
|
||||
if elem.tag == "key" and elem.text == key:
|
||||
found = True
|
||||
return None
|
||||
|
||||
def find_mountpoint(xmlstr):
|
||||
plistroot = ET.fromstring(xmlstr)
|
||||
if plistroot.tag != "plist":
|
||||
raise ValueError("xmlstr is not an XML-format plist")
|
||||
if plistroot[0].tag == "dict":
|
||||
sys_entities = plist_keyvalue(plistroot[0], "system-entities")
|
||||
if sys_entities.tag != "array":
|
||||
raise ValueError("expected dict to contain an array")
|
||||
for child in sys_entities:
|
||||
if child.tag == "dict":
|
||||
mountpoint = plist_keyvalue(child, "mount-point")
|
||||
return mountpoint.text
|
||||
else:
|
||||
raise ValueError("system-entities should be an array of dict objects")
|
||||
else:
|
||||
raise ValueError("Root element is not a dict")
|
||||
|
||||
a2setup_platform = None
|
||||
|
||||
def a2setup_set_platform():
|
||||
global a2setup_platform
|
||||
|
||||
a2setup_platform = os.uname()[0]
|
||||
if a2setup_platform not in ["Linux", "Darwin"]:
|
||||
a2setup_platform = "hfsutils"
|
||||
elif a2setup_platform == "Linux":
|
||||
use_sudo = False
|
||||
if os.geteuid() != 0:
|
||||
reply = stdin_input("""
|
||||
You must have either root access or the hfsutils package to
|
||||
access the disk image containing Apple // boot blocks. Do
|
||||
you want to mount the image using the sudo command? [y] """)
|
||||
if reply.startswith("y") or reply.startswith("Y") or reply == "":
|
||||
use_sudo = True
|
||||
print("""
|
||||
Okay, if asked for a password, type your user password. It
|
||||
will not be echoed when you type.""")
|
||||
else:
|
||||
a2setup_platform = "hfsutils"
|
||||
|
||||
|
||||
def a2setup_mount(image_path):
|
||||
mountpoint = None
|
||||
if a2setup_platform == "Linux":
|
||||
mountpoint = tempfile.mkdtemp(prefix = "tmp-hfsmount.")
|
||||
mount_cmd = ["mount", "-t", "hfs", "-o", "ro,loop", image_path, mountpoint]
|
||||
if use_sudo:
|
||||
mount_cmd = ["sudo"] + mount_cmd
|
||||
subprocess.call(mount_cmd)
|
||||
elif a2setup_platform == "Darwin":
|
||||
xmlstr = subprocess.check_output(["hdiutil", "attach", "-plist",
|
||||
image_path])
|
||||
mountpoint = find_mountpoint(xmlstr)
|
||||
elif a2setup_platform == "hfsutils":
|
||||
mountpoint = tempfile.mkdtemp(prefix = "tmp-hfsmount.")
|
||||
sys_folder = os.path.join(mountpoint, "System Folder")
|
||||
os.mkdir(sys_folder)
|
||||
devnull = open(os.devnull, "wb")
|
||||
subprocess.call(["hmount", image_path], stdout=devnull)
|
||||
devnull.close()
|
||||
subprocess.call(["hcopy", "Apple II Setup:System Folder:*", sys_folder])
|
||||
subprocess.call(["humount", "Apple II Setup"])
|
||||
|
||||
return mountpoint
|
||||
|
||||
|
||||
def a2setup_copyfile(bootfile, mountpoint, dest_dir, dest_fmt):
|
||||
src_dir = os.path.join(mountpoint, "System Folder")
|
||||
if a2setup_platform == "Linux" or a2setup_platform == "Darwin":
|
||||
src_path = os.path.join(src_dir, bootfile["unix"])
|
||||
elif a2setup_platform == "hfsutils":
|
||||
src_path = os.path.join(src_dir, bootfile["hfsutils"])
|
||||
dest_path = os.path.join(dest_dir, bootfile[dest_fmt])
|
||||
try:
|
||||
shutil.copyfile(src_path, dest_path)
|
||||
except:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def a2setup_umount(mountpoint):
|
||||
if a2setup_platform == "Linux":
|
||||
umount_cmd = ["umount", mountpoint]
|
||||
if use_sudo:
|
||||
umount_cmd = ["sudo"] + umount_cmd
|
||||
subprocess.call(umount_cmd)
|
||||
os.rmdir(mountpoint)
|
||||
elif a2setup_platform == "Darwin":
|
||||
devnull = open(os.devnull, "wb")
|
||||
subprocess.call(["hdiutil", "eject", mountpoint], stdout=devnull)
|
||||
devnull.close()
|
||||
elif a2setup_platform == "hfsutils":
|
||||
sys_folder = os.path.join(mountpoint, "System Folder")
|
||||
for f in os.listdir(sys_folder):
|
||||
os.unlink(os.path.join(sys_folder, f))
|
||||
os.rmdir(sys_folder)
|
||||
os.rmdir(mountpoint)
|
||||
|
||||
|
||||
def apply_patches(bootfile, dest_dir, dest_fmt):
|
||||
if "patches" in bootfile:
|
||||
(patches, digest) = bootfile["patches"]
|
||||
patch_path = os.path.join(dest_dir, bootfile[dest_fmt])
|
||||
dest_digest = sha1sum_file(patch_path)
|
||||
if dest_digest == digest:
|
||||
if not quiet:
|
||||
print(" \"%s\" is already patched." % (bootfile[dest_fmt]))
|
||||
return True
|
||||
else:
|
||||
if verbose:
|
||||
print(" Patching %s..." % (bootfile[dest_fmt]))
|
||||
elif not quiet:
|
||||
print(" Patching %s..." % (bootfile[dest_fmt]), end="")
|
||||
f = open(patch_path, "r+b")
|
||||
for patch in patches:
|
||||
if isinstance(patch, str):
|
||||
if verbose:
|
||||
print(" %s" % (patch))
|
||||
else:
|
||||
(offset, data) = patch
|
||||
f.seek(offset)
|
||||
f.write(data)
|
||||
f.close()
|
||||
|
||||
# Verify...
|
||||
dest_digest = sha1sum_file(patch_path)
|
||||
if dest_digest == digest:
|
||||
print(" patched.")
|
||||
else:
|
||||
print(" patch failed.\n Expected: %s\n Received: %s"
|
||||
% (bootfile["patches"][1], dest_digest))
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def install_bootblocks(dest_dir, dest_fmt):
|
||||
if dest_fmt not in ["unix", "netatalk"]:
|
||||
raise ValueError("Only basic UNIX and netatalk formats are supported for now")
|
||||
|
||||
if not quiet:
|
||||
print("Installing Apple // boot blocks...")
|
||||
|
||||
if not os.path.isdir(dest_dir):
|
||||
os.makedirs(dest_dir, mode=0o0755)
|
||||
|
||||
work_dir = tempfile.mkdtemp(prefix = "tmp-a2sv-bootblocks.")
|
||||
a2setup_name = "A2SETUP.img"
|
||||
if verbose:
|
||||
print(" dest_fmt : %s\n dest_dir : %s\n work_dir : %s\n"
|
||||
% (dest_fmt, dest_dir, work_dir))
|
||||
|
||||
a2setup_set_platform()
|
||||
|
||||
a2boot_needed = False
|
||||
a2setup_extracted = False
|
||||
a2boot_installed = False
|
||||
|
||||
for bootfile in a2boot_files:
|
||||
dest_path = os.path.join(dest_dir, bootfile[dest_fmt])
|
||||
if not os.path.isfile(dest_path):
|
||||
a2boot_needed = True
|
||||
break
|
||||
else:
|
||||
dest_digest = sha1sum_file(dest_path)
|
||||
if dest_digest != bootfile["digest"]:
|
||||
if "patches" not in bootfile or dest_digest != bootfile["patches"][1]:
|
||||
a2boot_needed = True
|
||||
break
|
||||
|
||||
if not a2boot_needed:
|
||||
if not quiet:
|
||||
print("Files already copied.")
|
||||
a2boot_installed = True
|
||||
else:
|
||||
if download_from_sources(disk7_sources, work_dir):
|
||||
if disk7_sources["type"] == "sea.bin":
|
||||
a2setup_extracted = extract_800k_sea_bin(disk7_sources["file"],
|
||||
a2setup_name, work_dir)
|
||||
else:
|
||||
# Placeholder for 6.0.4+ files packed some other way
|
||||
pass
|
||||
|
||||
if a2setup_extracted:
|
||||
a2setup_path = os.path.join(work_dir, a2setup_name)
|
||||
mountpoint = a2setup_mount(a2setup_path)
|
||||
src_dir = os.path.join(mountpoint, "System Folder")
|
||||
|
||||
if not quiet:
|
||||
print("Copying files...", end="")
|
||||
a2boot_installed = True
|
||||
for bootfile in a2boot_files:
|
||||
if not a2setup_copyfile(bootfile, mountpoint, dest_dir, dest_fmt):
|
||||
a2boot_installed = False
|
||||
|
||||
if not quiet:
|
||||
if a2boot_installed:
|
||||
print(" success.")
|
||||
else:
|
||||
print(" error copying files")
|
||||
|
||||
a2setup_umount(mountpoint)
|
||||
os.unlink(a2setup_path)
|
||||
|
||||
os.rmdir(work_dir)
|
||||
|
||||
if not a2boot_installed and not quiet:
|
||||
print("Installation failed.")
|
||||
return False
|
||||
|
||||
for bootfile in a2boot_files:
|
||||
apply_patches(bootfile, dest_dir, dest_fmt)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def do_install():
|
||||
netboot_tmp = tempfile.mkdtemp(suffix = ".a2server-netboot")
|
||||
print("You'll want to go and delete this directory:")
|
||||
print(netboot_tmp)
|
||||
os.chdir(netboot_tmp)
|
||||
|
||||
# If we need boot files:
|
||||
# Download a disk image
|
||||
# If it is one we need to unpack (.sea.bin):
|
||||
# unar it
|
||||
# extract the embedded image
|
||||
# If we need to apply boot block patches:
|
||||
# fix cleartext password bug in //e boot block
|
||||
# fix cleartext password bug in IIgs boot block
|
||||
# patch IIgs boot block to allow booting ProDOS 8
|
||||
# If we don't have A2SERVER tools:
|
||||
# Download the installer script
|
||||
# Run the installer script
|
||||
# Copy Basic.System to A2FILES for ProDOS 8
|
||||
# If NETBOOT.P8 (battery ram set to boot into ProDOS 8) doesn't exist:
|
||||
# Create it
|
||||
# If NETBOOT.GSOS (battery ram set to boot into GSOS) doesn't exist:
|
||||
# Create it
|
||||
# Set GS/OS to boot SYSTEM/FINDER (registered user or guest)
|
||||
# Set ProDOS 8 to boot BASIC.SYSTEM (guest)
|
||||
# If SYSTEM/START.GS.OS doesn't exist in A2FILES:
|
||||
# Ask if user wants to install GS/OS 6.0.1
|
||||
# If they answer yes:
|
||||
# create imagesDir
|
||||
# create netInstallDir
|
||||
# For each disk:
|
||||
# Download the disk
|
||||
# If it is one we need to unpack (.sea.bin):
|
||||
# extract_800k_sea_bin it
|
||||
# unpack the disk to netInstallDir
|
||||
|
||||
|
||||
# XXX Re-enable this
|
||||
#os.rmdir(netboot_tmp)
|
||||
|
||||
if __name__ == '__main__':
|
||||
# bail out on automated netboot setup unless -b is also specified
|
||||
# FIXME: This logic belongs in a2server-setup, not here
|
||||
autoAnswerYes = os.path.isfile("/tmp/a2server-autoAnswerYes")
|
||||
if autoAnswerYes and not os.path.isfile("/tmp/a2server-setupNetBoot"):
|
||||
sys.exit(0)
|
||||
|
||||
# We need root to do this. If we don't have it, just rerun the command with
|
||||
# sudo and be done with it.
|
||||
#
|
||||
# FIXME: Should we be doing this? A generic installer should not assume it's
|
||||
# writing to a root-owned dir, nor care. Probably the reason to do it this way
|
||||
# is as a proof of concept that it can be done this way in the main
|
||||
# a2server-setup script, which of course means we don't actually need to change
|
||||
# the password for the user.
|
||||
#
|
||||
# XXX Disabling this for development
|
||||
"""
|
||||
if os.geteuid() != 0:
|
||||
args = sys.argv
|
||||
args.insert(0, "sudo")
|
||||
# At the very least, we should print the command line we"re running here
|
||||
print ("Rerunning with sudo...")
|
||||
ret = subprocess.call(args)
|
||||
sys.exit(ret)
|
||||
"""
|
||||
|
||||
install_bootblocks(os.path.join(os.getcwd(), "a2boot"), "netatalk")
|
||||
#reply = stdin_input("""\nDo you want to set up A2SERVER to be able to boot Apple II\ncomputers over the network? [y] """)
|
||||
#if reply.startswith("y") or reply.startswith("Y") or reply == "":
|
||||
# do_install()
|
||||
114
fix/fix.txt
Normal file
114
fix/fix.txt
Normal file
@@ -0,0 +1,114 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo
|
||||
echo "A2SERVER fix: This utility will make a Raspberry Pi SD card boot if it"
|
||||
echo "kernel panics (crashes) on startup after updating its operating system"
|
||||
echo "while A2SERVER is installed."
|
||||
echo
|
||||
echo -n "Continue? "
|
||||
read
|
||||
doFix=
|
||||
if [[ ${REPLY:0:1} == "y" || ${REPLY:0:1} == "Y" ]]; then
|
||||
while true; do
|
||||
echo
|
||||
echo "If attached, remove the Raspberry Pi's SD card from this computer."
|
||||
echo -n "Press return to continue..."; read; echo
|
||||
|
||||
ls -1 /dev/sd? > /tmp/sd1 2> /dev/null
|
||||
|
||||
echo "Insert the Raspberry Pi's SD card into this computer, using a USB"
|
||||
echo "reader if you don't have an SD slot. If this is a virtual machine,"
|
||||
echo "make sure you select the reader or SD slot from its USB menu."
|
||||
echo -n "Press return to continue..."; read; echo
|
||||
|
||||
ls -1 /dev/sd? > /tmp/sd2 2> /dev/null
|
||||
|
||||
# if exactly one drive has been inserted, exit loop
|
||||
if { ! diff /tmp/sd1 /tmp/sd2 &> /dev/null; }; then
|
||||
# files are different, get dev name
|
||||
if [[ $(wc -c /tmp/sd1 | cut -f 1 -d ' ') -eq 0 ]]; then
|
||||
if [[ $(wc -l /tmp/sd2 | cut -f 1 -d ' ') -eq 1 ]]; then
|
||||
devName=$(cat /tmp/sd2)
|
||||
break
|
||||
else
|
||||
echo "More than one volume seems to have appeared. Trying again..."
|
||||
echo
|
||||
fi
|
||||
else
|
||||
devName=$(grep -v "$(cat /tmp/sd1)" /tmp/sd2)
|
||||
if [[ $(wc -l <<< $devName) -eq 1 ]]; then
|
||||
break
|
||||
else
|
||||
echo "More than one volume seems to have appeared. Trying again..."
|
||||
echo
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "No SD card found. Trying again..."
|
||||
echo
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
mkdir -p /tmp/sd
|
||||
sudo mount ${devName}6 /tmp/sd
|
||||
|
||||
raspbianDate=$(date -d "$(zcat /tmp/sd/usr/share/doc/raspberrypi-bootloader/changelog.Debian.gz | grep -m 1 ' --' | rev | cut -f 1-6 -d ' ' | rev)" +%s)
|
||||
doFix=
|
||||
if [[ $raspbianDate -lt 1403204265 ]]; then
|
||||
echo "This doesn't appear to be a version of Raspbian that requires fixing."
|
||||
echo -n "Are you sure you want to continue? "
|
||||
read
|
||||
if [[ ${REPLY:0:1} == "y" || ${REPLY:0:1} == "Y" ]]; then
|
||||
doFix=1
|
||||
fi
|
||||
else
|
||||
doFix=1
|
||||
fi
|
||||
|
||||
if [[ $doFix ]]; then
|
||||
while read kernelRelease; do
|
||||
kernelReplaced=
|
||||
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 kernel 3.12 below 3.12.25+, delete defective AppleTalk kernel
|
||||
if [[ $kernelMajorRelease -eq 3 && $kernelMinorRelease -eq 12 && $kernelPatchRelease -lt 25 ]]; then
|
||||
if [[ -f /tmp/sd/lib/modules/$kernelRelease/kernel/net/appletalk/appletalk.ko ]]; then
|
||||
if [[ $(sha1sum /tmp/sd/lib/modules/$kernelRelease/kernel/net/appletalk/appletalk.ko | cut -f 1 -d ' ') != "ecb239fc084c36de93f6926e7749b80f6024f269" ]]; then
|
||||
echo "Removing defective AppleTalk module from kernel $kernelRelease..."
|
||||
sudo rm -rf /tmp/sd/lib/modules/$kernelRelease/kernel/net/appletalk 2> /dev/null
|
||||
wget -qO /tmp/appletalk.ko.gz ${A2SERVER_SCRIPT_URL}files/appletalk-$kernelRelease.ko.gz
|
||||
if [[ $? -eq 0 ]]; then
|
||||
# if we found a prebuilt one on a2server site, so install it
|
||||
gunzip -f /tmp/appletalk.ko.gz
|
||||
sudo mkdir -p /tmp/sd/lib/modules/$kernelRelease/kernel/net/appletalk
|
||||
sudo mv /tmp/appletalk.ko /tmp/sd/lib/modules/$kernelRelease/kernel/net/appletalk
|
||||
echo "Installed fixed AppleTalk module for kernel $kernelRelease."
|
||||
kernelReplaced=1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done <<< "$(ls -1 /tmp/sd/lib/modules | sort -V)"
|
||||
sudo umount /tmp/sd
|
||||
|
||||
echo kern:$kernelReplaced
|
||||
if [[ $kernelReplaced ]]; then
|
||||
echo
|
||||
echo "All set. Remove your SD card, put it back in your Pi, and boot it."
|
||||
echo
|
||||
echo "You should be able to connect from your Apple II, but if you can't,"
|
||||
echo "log in to your Pi and type 'a2server-setup' to complete the fix."
|
||||
else
|
||||
echo
|
||||
echo "Okey doke. Half done. Remove your SD card, and put it back in your Pi."
|
||||
echo "After it boots, log in and type 'a2server-setup' to complete the fix."
|
||||
fi
|
||||
echo "See the A2SERVER web site at http://ivanx.com/a2server for more help."
|
||||
echo "(You can type 'sudo shutdown -h now' if you're done on this machine.)"
|
||||
echo
|
||||
fi
|
||||
fi
|
||||
|
||||
rm fix &> /dev/null
|
||||
@@ -3,18 +3,29 @@
|
||||
|
||||
# --- Setting up the share volume
|
||||
|
||||
# 1.3.0: move /media/A2SHARED (pre-1.3.0) to /srv/A2SERVER
|
||||
if [[ -d /media/A2SHARED ]]; then
|
||||
echo "A2SERVER: Moving /media/A2SHARED to /srv/A2SERVER..."
|
||||
sudo /etc/init.d/netatalk stop &> /dev/null
|
||||
sudo /etc/init.d/samba stop &> /dev/null
|
||||
[[ ! -d /srv ]] && sudo mkdir -p /srv
|
||||
sudo mv /media/A2SHARED /srv/A2SERVER
|
||||
sudo sed -i 's|/media/A2SHARED|/srv/A2SERVER|g' /usr/local/etc/netatalk/AppleVolumes.default
|
||||
[[ -f /etc/samba/smbd.conf ]] && sudo sed -i 's|/media/A2SHARED|/srv/A2SERVER|g' /etc/samba/smbd.conf
|
||||
|
||||
fi
|
||||
|
||||
# skip if we're already set up
|
||||
if [[ -d /media/A2SHARED ]]; then
|
||||
if [[ -d /srv/A2SERVER ]]; then
|
||||
|
||||
echo "A2SERVER: Shared disk is already prepared for use."
|
||||
echo "A2SERVER: Shared volume is already prepared for use."
|
||||
|
||||
else
|
||||
|
||||
echo "A2SERVER: Preparing the shared files disk..."
|
||||
echo "A2SERVER: Preparing the shared files volume..."
|
||||
|
||||
sudo mkdir /media/A2SHARED
|
||||
sudo mkdir -p /srv/A2SERVER
|
||||
|
||||
sudo chown $USER:$USER /media/A2SHARED
|
||||
sudo chown $USER:$USER /srv/A2SERVER
|
||||
|
||||
fi
|
||||
|
||||
@@ -7,14 +7,26 @@
|
||||
# Ensure URL we'll use ends in a /
|
||||
case "$A2SERVER_SCRIPT_URL" in
|
||||
*/) scriptURL="$A2SERVER_SCRIPT_URL" ;;
|
||||
*) scriptURL="${A2SERVER_SCRIPT_URL:-http://appleii.ivanx.com/a2server}/" ;;
|
||||
*) scriptURL="${A2SERVER_SCRIPT_URL:-http://ivanx.com/a2server}/" ;;
|
||||
esac
|
||||
case "$A2SERVER_BINARY_URL" in
|
||||
*/) binaryURL="$A2SERVER_BINARY_URL" ;;
|
||||
*) binaryURL="${A2SERVER_BINARY_URL:-http://ivanx.com/a2server/files}/" ;;
|
||||
esac
|
||||
useExternalURL=1
|
||||
[[ $A2SERVER_NO_EXTERNAL ]] && useExternalURL=
|
||||
|
||||
isRpi=
|
||||
[[ -f /usr/bin/raspi-config ]] && isRpi=1
|
||||
|
||||
isDebian=
|
||||
[[ ( -f /etc/debian_version ) && ( $(cut -c 1 < /etc/debian_version) -ge "7" ) && ( $(uname -m) == "i686" ) ]] && isDebian=1
|
||||
arch=
|
||||
if [[ -f /usr/bin/raspi-config ]]; then
|
||||
isRpi=1
|
||||
elif lsb_release -a 2> /dev/null | grep -q 'Distributor ID:.Debian' && [[ ( -f /etc/debian_version ) && ( $(cut -c 1 < /etc/debian_version) -ge "7" ) ]]; then
|
||||
uname_m="$(uname -m)"
|
||||
if [[ $uname_m == "i686" ]]; then
|
||||
arch='debian_x86'
|
||||
elif [[ $uname_m == "x86_64" ]]; then
|
||||
arch='debian_x64'
|
||||
fi
|
||||
fi
|
||||
|
||||
isJessie=
|
||||
[[ ( -f /etc/debian_version ) && ( $(cut -c 1-2 < /etc/debian_version) == "8." ) ]] && isJessie=1
|
||||
@@ -26,10 +38,8 @@ if ! command -v nulib2 > /dev/null; then
|
||||
echo "A2SERVER: Installing nulib2..."
|
||||
|
||||
cd /tmp
|
||||
if [[ $isRpi ]]; then
|
||||
wget -qO- "http://appleii.ivanx.com/a2server/files/nulib2-rpi.tgz" | sudo tar Pzx
|
||||
elif [[ $isDebian ]]; then
|
||||
wget -qO- "http://appleii.ivanx.com/a2server/files/nulib2-debian7_x86.tgz" | sudo tar Pzx
|
||||
if [[ $arch ]]; then
|
||||
{ wget -qO- "${binaryURL}precompiled/nulib2-${arch}.tgz" | sudo tar Pzx; } &> /dev/null
|
||||
fi
|
||||
|
||||
if ! command -v nulib2 > /dev/null; then
|
||||
@@ -40,15 +50,22 @@ if ! command -v nulib2 > /dev/null; then
|
||||
touch /tmp/a2server-packageReposUpdated
|
||||
fi
|
||||
|
||||
sudo apt-get -y install build-essential
|
||||
sudo apt-get -y install zlib1g-dev
|
||||
# Dependencies: build-dep for nulib
|
||||
sudo apt-get -y install build-essential 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
|
||||
if [[ $useExternalURL ]]; then
|
||||
wget -q -O nulibdist.tar.gz http://web.archive.org/web/20131031160750/http://www.nulib.com/downloads/nulibdist.tar.gz
|
||||
tar zxf nulibdist.tar.gz &> /dev/null
|
||||
fi
|
||||
if [[ ! -d nulib2-220 ]]; then
|
||||
wget -q -O nulibdist.tar.gz ${binaryURL}external/nulibdist.tar.gz
|
||||
tar zxf nulibdist.tar.gz &> /dev/null
|
||||
fi
|
||||
cd nufxlib*
|
||||
./configure
|
||||
make
|
||||
@@ -78,34 +95,39 @@ if ! command -v unar > /dev/null; then
|
||||
touch /tmp/a2server-packageReposUpdated
|
||||
fi
|
||||
|
||||
# jessie and later: Just use the unar package
|
||||
if [[ $isJessie ]]; then
|
||||
sudo apt-get install -y unar
|
||||
sudo apt-get -y install unar
|
||||
sudo apt-get clean
|
||||
fi
|
||||
|
||||
if ! command -v unar > /dev/null; then
|
||||
if [[ $isRpi || $isDebian ]]; then
|
||||
if [[ $arch ]]; then
|
||||
# Dependencies: for unar
|
||||
sudo apt-get -y install libgnustep-base1.22
|
||||
sudo apt-get clean
|
||||
if [[ $isRpi ]]; then
|
||||
wget -qO- "http://appleii.ivanx.com/a2server/files/unar-rpi_wheezy.tgz" | sudo tar Pzx
|
||||
elif [[ $isDebian ]]; then
|
||||
wget -qO- "http://appleii.ivanx.com/a2server/files/unar-debian7_x86.tgz" | sudo tar Pzx
|
||||
fi
|
||||
{ wget -qO- "${binaryURL}precompiled/unar-${arch}.tgz" | sudo tar Pzx; } &> /dev/null
|
||||
fi
|
||||
|
||||
# If all else fails, compile from source.
|
||||
if ! command -v unar >/dev/null; 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
|
||||
|
||||
# Dependencies: build-deps for unar
|
||||
sudo apt-get -y install build-essential libgnustep-base-dev libz-dev libbz2-dev 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
|
||||
if [[ $useExternalURL ]]; then
|
||||
wget -O unar_1.8.zip https://github.com/incbee/Unarchiver/archive/unar-1.8.zip
|
||||
unzip -o unar_1.8.zip &> /dev/null
|
||||
fi
|
||||
if [ ! -d *Unarchiver*/XADMaster ]; then # need single bracket for glob
|
||||
wget -O unar_1.8.zip ${binaryURL}external/unar-1.8.zip
|
||||
unzip -o unar_1.8.zip &> /dev/null
|
||||
fi
|
||||
cd *Unarchiver*/XADMaster
|
||||
make -f Makefile.linux
|
||||
sudo mv lsar unar /usr/local/bin
|
||||
cd ../Extra
|
||||
@@ -121,7 +143,15 @@ fi
|
||||
|
||||
if ! command -v unzip >/dev/null; then
|
||||
echo "A2SERVER: Installing unzip..."
|
||||
sudo apt-get -y install unzip
|
||||
if [[ ! -f /tmp/a2server-packageReposUpdated ]]; then
|
||||
# prepare for installing packages
|
||||
sudo apt-get -y update
|
||||
touch /tmp/a2server-packageReposUpdated
|
||||
fi
|
||||
|
||||
# Dependencies: unzip
|
||||
sudo apt-get -y install unzip
|
||||
sudo apt-get clean
|
||||
else
|
||||
echo "A2SERVER: unzip has already been installed."
|
||||
fi
|
||||
@@ -138,15 +168,20 @@ sudo wget -q -O /usr/local/bin/cppo "${scriptURL}scripts/tools/cppo.txt"
|
||||
sudo chmod ugo+x /usr/local/bin/cppo
|
||||
sudo wget -q -O /usr/local/etc/a2server-help.txt "${scriptURL}scripts/tools/a2server-help.txt"
|
||||
sudo wget -q -O /usr/local/etc/a2server-aliases "${scriptURL}scripts/tools/a2server-aliases.txt"
|
||||
sudo wget -q -O /usr/local/etc/a2serverrc "${scriptURL}scripts/tools/a2serverrc.txt"
|
||||
|
||||
grep a2server-aliases /etc/bash.bashrc > /dev/null || \
|
||||
echo "source /usr/local/etc/a2server-aliases" | sudo tee -a /etc/bash.bashrc > /dev/null
|
||||
# 1.3.0: a2serverrc is now called from /etc/bash.bashrc,
|
||||
# which in turn calls a2server-aliases
|
||||
grep 'a2server-aliases' /etc/bash.bashrc > /dev/null && \
|
||||
sudo sed -i 's/a2server-aliases/a2serverrc/' /etc/bash.bashrc
|
||||
grep 'a2serverrc' /etc/bash.bashrc > /dev/null || \
|
||||
echo "source /usr/local/etc/a2serverrc" | sudo tee -a /etc/bash.bashrc > /dev/null
|
||||
|
||||
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
|
||||
|
||||
@@ -19,18 +19,32 @@ case "$A2SERVER_SCRIPT_URL" in
|
||||
*/) scriptURL="$A2SERVER_SCRIPT_URL" ;;
|
||||
*) scriptURL="${A2SERVER_SCRIPT_URL:-http://appleii.ivanx.com/a2server}/" ;;
|
||||
esac
|
||||
case "$A2SERVER_BINARY_URL" in
|
||||
*/) binaryURL="$A2SERVER_BINARY_URL" ;;
|
||||
*) binaryURL="${A2SERVER_BINARY_URL:-http://ivanx.com/a2server/files}/" ;;
|
||||
esac
|
||||
useExternalURL=1
|
||||
[[ $A2SERVER_NO_EXTERNAL ]] && useExternalURL=
|
||||
|
||||
isRpi=
|
||||
[[ -f /usr/bin/raspi-config ]] && isRpi=1
|
||||
|
||||
isDebian_x86=
|
||||
[[ ( -f /etc/debian_version ) && ( $(cut -c 1 < /etc/debian_version) -ge 7 ) && ( $(uname -m) == "i686" ) ]] && isDebian_x86=1
|
||||
arch=
|
||||
if [[ -f /usr/bin/raspi-config ]]; then
|
||||
isRpi=1
|
||||
arch='rpi'
|
||||
elif lsb_release -a 2> /dev/null | grep -q 'Distributor ID:.Debian' && [[ ( -f /etc/debian_version ) && ( $(cut -c 1 < /etc/debian_version) -ge "7" ) ]]; then
|
||||
uname_m="$(uname -m)"
|
||||
if [[ $uname_m == "i686" ]]; then
|
||||
arch='debian_x86'
|
||||
elif [[ $uname_m == "x86_64" ]]; then
|
||||
arch='debian_x64'
|
||||
fi
|
||||
fi
|
||||
|
||||
isJessie=
|
||||
[[ ( -f /etc/debian_version ) && ( $(cut -c 1-2 < /etc/debian_version) == "8." ) ]] && isJessie=1
|
||||
|
||||
# skip this if already done
|
||||
if [[ -f /usr/local/etc/A2SERVER-version ]] && (( $(cat /usr/local/etc/A2SERVER-version) >= 101 )); then
|
||||
if [[ -f /usr/local/etc/A2SERVER-version ]] && (( $(head -c 3 /usr/local/etc/A2SERVER-version) >= 101 )); then
|
||||
|
||||
echo "A2SERVER: Netatalk is already installed."
|
||||
|
||||
@@ -38,8 +52,11 @@ 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
|
||||
# stop Netatalk and samba if running (during upgrade)
|
||||
if [[ $(ps --no-headers -C afpd) ]]; then
|
||||
sudo /etc/init.d/netatalk stop &> /dev/null
|
||||
sudo /etc/init.d/samba stop &> /dev/null
|
||||
fi
|
||||
|
||||
if [[ ! -f /tmp/a2server-packageReposUpdated ]]; then
|
||||
# prepare for installing packages
|
||||
@@ -52,56 +69,62 @@ else
|
||||
pkgFile=${url##*/}
|
||||
pkgName=${pkgFile%%_*}
|
||||
if ! dpkg -l $pkgName 2> /dev/null | grep -q '^ii'; then
|
||||
wget -qO /tmp/${url##*/} "$url"
|
||||
sudo dpkg -i /tmp/${url##*/}
|
||||
if [[ $useExternalURL ]]; then
|
||||
wget -qO "/tmp/${url##*/}" "$url"
|
||||
fi
|
||||
if [[ $? -ne 0 || ! -f "/tmp/${url##*/}" ]]; then
|
||||
wget -qO "/tmp/${url##*/}" "${binaryURL}external/deb/${url##*/}"
|
||||
fi
|
||||
sudo dpkg -i "/tmp/${url##*/}"
|
||||
sudo apt-get clean
|
||||
rm /tmp/${url##*/}
|
||||
rm "/tmp/${url##*/}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
compileFromSource=1
|
||||
urls=
|
||||
while [[ $isRpi || $isDebian_x86 ]]; do
|
||||
while [[ $arch ]]; do
|
||||
# Install runtime libraries needed by Netatalk
|
||||
if [[ $isJessie ]]; then
|
||||
if [[ $isRpi ]]; then
|
||||
if [[ $arch == "rpi" ]]; then
|
||||
getOldPackage "http://mirrordirector.raspbian.org/raspbian/pool/main/d/db/libdb5.1_5.1.29-5_armhf.deb"
|
||||
elif [[ $isDebian_x86 ]]; then
|
||||
elif [[ $arch == "debian_x86" ]]; then
|
||||
getOldPackage "http://ftp.debian.org/debian/pool/main/d/db/libdb5.1_5.1.29-5_i386.deb"
|
||||
elif [[ $arch == "debian_x64" ]]; then
|
||||
getOldPackage "http://ftp.debian.org/debian/pool/main/d/db/libdb5.1_5.1.29-5_amd64.deb"
|
||||
fi
|
||||
elif [[ $(apt-cache search '^libdb4.8$') ]]; then
|
||||
sudo apt-get -y install libdb4.8
|
||||
elif [[ $(apt-cache search '^libdb5.1$') ]]; then
|
||||
# Dependencies: netatalk 2.2.4
|
||||
sudo apt-get -y install libdb5.1
|
||||
else
|
||||
break
|
||||
fi
|
||||
if [[ $(apt-cache search '^libssl1.0.0$') ]]; then
|
||||
# Dependencies: netatalk 2.2.4
|
||||
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 [[ $isJessie ]]; then
|
||||
if [[ $isRpi ]]; then
|
||||
if [[ $arch == "rpi" ]]; then
|
||||
getOldPackage "http://mirrordirector.raspbian.org/raspbian/pool/main/libg/libgcrypt11/libgcrypt11_1.5.0-5+deb7u3_armhf.deb"
|
||||
elif [[ $isDebian_x86 ]]; then
|
||||
elif [[ $arch == "debian_x86" ]]; then
|
||||
getOldPackage "http://ftp.debian.org/debian/pool/main/libg/libgcrypt11/libgcrypt11_1.5.0-5+deb7u3_i386.deb"
|
||||
elif [[ $arch == "debian_x64" ]]; then
|
||||
getOldPackage "http://ftp.debian.org/debian/pool/main/libg/libgcrypt11/libgcrypt11_1.5.0-5+deb7u3_amd64.deb"
|
||||
fi
|
||||
elif [[ $(apt-cache search '^libgcrypt11$') ]]; then
|
||||
# Dependencies: netatalk 2.2.4
|
||||
sudo apt-get -y install libgcrypt11
|
||||
else
|
||||
break
|
||||
fi
|
||||
|
||||
# install Netatalk
|
||||
if [[ $isRpi ]]; then
|
||||
{ wget -qO- /tmp/netatalk.tgz "http://appleii.ivanx.com/a2server/files/netatalk224-rpi_wheezy.tgz" | sudo tar Pzx; } 2> /dev/null
|
||||
elif [[ $isDebian_x86 ]]; then
|
||||
{ wget -qO- /tmp/netatalk.tgz "http://appleii.ivanx.com/a2server/files/netatalk224-debian7_x86.tgz" | sudo tar Pzx; } 2> /dev/null
|
||||
if [[ $arch ]]; then
|
||||
{ wget -qO- "${binaryURL}precompiled/netatalk224-${arch}.tgz" | sudo tar Pzx; } &> /dev/null
|
||||
fi
|
||||
sudo mandb &> /dev/null
|
||||
|
||||
@@ -111,34 +134,42 @@ else
|
||||
done
|
||||
|
||||
if [[ $compileFromSource ]]; then
|
||||
# Install development libraries needed by Netatalk
|
||||
sudo apt-get -y install build-essential
|
||||
sudo apt-get -y install libssl-dev
|
||||
if [[ $isJessie ]]; then
|
||||
if [[ $isRpi ]]; then
|
||||
# Dependencies: build-deps for netatalk 2.2.4
|
||||
sudo apt-get -y install build-essential libssl-dev
|
||||
if [[ $arch ]]; then
|
||||
if [[ $arch == "rpi" ]]; then
|
||||
getOldPackage "http://mirrordirector.raspbian.org/raspbian/pool/main/d/db/libdb5.1-dev_5.1.29-5_armhf.deb"
|
||||
elif [[ $isDebian_x86 ]]; then
|
||||
elif [[ $arch == "debian_x86" ]]; then
|
||||
getOldPackage "http://ftp.us.debian.org/debian/pool/main/d/db/libdb5.1-dev_5.1.29-5_i386.deb"
|
||||
elif [[ $arch == "debian_x64" ]]; then
|
||||
getOldPackage "http://ftp.us.debian.org/debian/pool/main/d/db/libdb5.1-dev_5.1.29-5_amd64.deb"
|
||||
fi
|
||||
elif [[ $(apt-cache search '^libdb4.8-dev$') ]]; then
|
||||
sudo apt-get -y install libdb4.8-dev
|
||||
elif [[ $(apt-cache search '^libdb5.1-dev$') ]]; then
|
||||
# Dependencies: build-deps for netatalk 2.2.4
|
||||
sudo apt-get -y install libdb5.1-dev
|
||||
elif [[ $(apt-cache search '^libdb4.8-dev$') ]]; then
|
||||
# Dependencies: build-deps for netatalk 2.2.4
|
||||
sudo apt-get -y install libdb4.8-dev
|
||||
else
|
||||
echo "A2SERVER: WARNING: unknown version of libdb-dev is being installed"
|
||||
echo "A2SERVER: WARNING: unknown version of libdb-dev is being installed."
|
||||
# Dependencies: build-deps for netatalk 2.2.4
|
||||
sudo apt-get -y install libdb-dev
|
||||
fi
|
||||
if [[ $isJessie ]]; then
|
||||
sudo apt-get -y install libgpg-error-dev
|
||||
if [[ $isRpi ]]; then
|
||||
if [[ $arch == "rpi" ]]; then
|
||||
getOldPackage "http://mirrordirector.raspbian.org/raspbian/pool/main/libg/libgcrypt11/libgcrypt11-dev_1.5.0-5+deb7u3_armhf.deb"
|
||||
elif [[ $isDebian_x86 ]]; then
|
||||
elif [[ $arch == "debian_x86" ]]; then
|
||||
getOldPackage "http://ftp.debian.org/debian/pool/main/libg/libgcrypt11/libgcrypt11-dev_1.5.0-5+deb7u3_i386.deb"
|
||||
elif [[ $arch == "debian_x64" ]]; then
|
||||
getOldPackage "http://ftp.debian.org/debian/pool/main/libg/libgcrypt11/libgcrypt11-dev_1.5.0-5+deb7u3_amd64.deb"
|
||||
fi
|
||||
elif [[ $(apt-cache search '^libgcrypt11-dev$') ]]; then
|
||||
# Dependencies: build-deps for netatalk 2.2.4
|
||||
sudo apt-get -y install libgcrypt11-dev
|
||||
else
|
||||
echo "A2SERVER: WARNING: unknown version of libgcrypt-dev is being installed"
|
||||
echo "A2SERVER: WARNING: unknown version of libgcrypt-dev is being installed."
|
||||
# Dependencies: build-deps for netatalk 2.2.4
|
||||
sudo apt-get -y install $(apt-cache search '^libgcrypt.*dev$' | sort -r | head -1 | cut -d ' ' -f 1)
|
||||
fi
|
||||
sudo apt-get clean
|
||||
@@ -148,8 +179,14 @@ else
|
||||
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
|
||||
if [[ $useExternalURL ]]; then
|
||||
wget -qO netatalk-2.2.4.tar.gz "http://downloads.sourceforge.net/project/netatalk/netatalk/2.2.4/netatalk-2.2.4.tar.gz"
|
||||
tar zxf netatalk-2.2.4.tar.gz &> /dev/null
|
||||
fi
|
||||
if [[ ! -d netatalk-2.2.4 ]]; then
|
||||
wget -O netatalk-2.2.4.tar.gz "${binaryURL}external/netatalk-2.2.4.tar.gz"
|
||||
tar zxf netatalk-2.2.4.tar.gz &> /dev/null
|
||||
fi
|
||||
cd netatalk-2.2.4
|
||||
|
||||
# Patch the source so file dates are preserved during a GS/OS folder copy,
|
||||
@@ -174,6 +211,38 @@ else
|
||||
rm -rf /tmp/netatalk
|
||||
fi
|
||||
fi
|
||||
|
||||
# --- Install MacIPgw
|
||||
if ! command -v macipgw > /dev/null; then
|
||||
echo "A2SERVER: Installing TCP over AppleTalk (MacIP)..."
|
||||
|
||||
if [[ $arch ]]; then
|
||||
{ wget -qO- "${binaryURL}precompiled/macipgw-${arch}.tgz" | sudo tar Pzx; } 2> /dev/null
|
||||
fi
|
||||
|
||||
if ! command -v macipgw > /dev/null; then
|
||||
wd="$PWD"
|
||||
sudo apt-get -y install build-essential
|
||||
rm -rf /tmp/macipgw &> /dev/null
|
||||
mkdir /tmp/macipgw
|
||||
cd /tmp/macipgw
|
||||
if [[ $useExternalURL ]]; then
|
||||
wget -qO macipgw.zip "https://github.com/zero2sixd/macipgw/archive/master.zip"
|
||||
unzip macipgw-src.zip &> /dev/null
|
||||
fi
|
||||
if [[ ! -d macipgw-master ]]; then
|
||||
wget -qO macipgw-src.zip "${binaryURL}external/macipgw-src.zip"
|
||||
unzip macipgw-src.zip &> /dev/null
|
||||
fi
|
||||
cd macipgw-master
|
||||
make
|
||||
sudo make install
|
||||
cd "$wd"
|
||||
rm -rf /tmp/macipgw
|
||||
fi
|
||||
else
|
||||
echo "A2SERVER: TCP over AppleTalk (MacIP) has already been installed."
|
||||
fi
|
||||
|
||||
# --- Configuring Netatalk
|
||||
|
||||
@@ -182,7 +251,7 @@ echo "A2SERVER: Configuring Netatalk..."
|
||||
# if missing Netatalk startup file, download a fresh one
|
||||
if [ ! -f /etc/init.d/netatalk ]; then
|
||||
echo "A2SERVER: Downloading new Netatalk startup script..."
|
||||
sudo wget -qO /etc/init.d/netatalk http://appleii.ivanx.com/a2server/files/netatalk-init.d-clean.txt
|
||||
sudo wget -qO /etc/init.d/netatalk ${binaryURL}netatalk-init.d-clean.txt
|
||||
fi
|
||||
|
||||
# make the Netatalk startup script work correctly
|
||||
@@ -192,7 +261,13 @@ sudo sed -i 's/bin\/sh/bin\/bash/' /etc/init.d/netatalk
|
||||
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
|
||||
sudo sed -i 's@\(\tif \[ x\"$ATALKD_RUN\)@\n\t# check for valid AppleTalk kernel module\n\t[[ $ATALKD_RUN == "yes" ]] \&\& { kernelRelease=$(uname -r); kernelMajor=$(cut -d "." -f 1 <<< $kernelRelease); kernelMinor=$(cut -d "." -f 2 <<< $kernelRelease | sed '"'"'s/\\(^[0-9]*\\)[^0-9].*$/\\1/'"'"'); kernelPatch=$(cut -d "." -f 3- <<< $kernelRelease | sed '"'"'s/\\(^[0-9]*\\)[^0-9].*$/\\1/'"'"'); [[ ( $kernelMajor -eq 3 \&\& $kernelMinor -ge 12 \&\& $kernelMinor -le 15 ) \&\& ( ! ( -f /usr/bin/raspi-config \&\& $kernelMinor -eq 12 \&\& $kernelPatch -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 MacIPgw support after launching atalkd
|
||||
if ! grep -q -i 'macipgw' /etc/init.d/netatalk; then
|
||||
sudo sed -i ':a;N;$!ba;s@\(echo -n " atalkd"\)\(.*# prepare\)@\1\n\n # start MacIPgw (TCP over AppleTalk) service\n ps aux | grep -q "[m]acipgw" \&\& sudo killall macipgw 2> /dev/null\n atalkd_interface=$(grep "^[^ #]" /etc/netatalk/atalkd.conf | tail -1 | cut -d " " -f 1)\n sysctl -w net.ipv4.ip_forward=1 > /dev/null\n macipgw -n 8.8.8.8 192.168.151.0 255.255.255.0\n /sbin/iptables -t nat -A POSTROUTING -o ${atalkd_interface} -j MASQUERADE\n /sbin/iptables -A FORWARD -i ${atalkd_interface} -o tun0 -m state --state RELATED,ESTABLISHED -j ACCEPT\n /sbin/iptables -A FORWARD -i tun1 -o ${atalkd_interface} -j ACCEPT\n\n echo -n " macipgw"\n\2@' /etc/init.d/netatalk
|
||||
sudo sed -i 's@\(start-stop-daemon --stop --quiet --oknodo --exec /usr/local/sbin/atalkd.*$\)@\1\n echo -n " macipgw"\n sudo killall macipgw 2> /dev/null@' /etc/init.d/netatalk
|
||||
fi
|
||||
|
||||
# enable network boot support in netatalk
|
||||
@@ -255,8 +330,8 @@ fi
|
||||
# /usr/local/etc/netatalk/AppleVolumes.default
|
||||
|
||||
# 1.3.0: if GSFILES is being shared, make directory if not there
|
||||
if grep -q '^/media/A2SHARED/GSFILES' /usr/local/etc/netatalk/AppleVolumes.default; then
|
||||
[[ -d /media/A2SHARED/GSFILES ]] || mkdir -p /media/A2SHARED/GSFILES;
|
||||
if grep -q '^/srv/A2SERVER/GSFILES' /usr/local/etc/netatalk/AppleVolumes.default; then
|
||||
[[ -d /srv/A2SERVER/GSFILES ]] || mkdir -p /srv/A2SERVER/GSFILES;
|
||||
fi
|
||||
|
||||
# prior to 1.3.0:
|
||||
@@ -268,19 +343,22 @@ fi
|
||||
# see if shared already uses ciopfs (case-insensitive file system), and convert if not
|
||||
# restore known GS/OS file paths to mixed case
|
||||
# set up ciopfs (case insensitive file system) for share
|
||||
if [[ -d /media/A2SHARED/A2FILES && ! -d /media/A2SHARED/.a2files ]]; then
|
||||
if [[ -d /srv/A2SERVER/A2FILES && ! -d /srv/A2SERVER/.a2files ]]; then
|
||||
echo "A2SERVER: Converting A2FILES to support mixed case..."
|
||||
sudo /etc/init.d/netatalk stop &> /dev/null
|
||||
sudo /etc/init.d/samba stop &> /dev/null
|
||||
if ! command -v getfattr &> /dev/null; then
|
||||
# Dependency: for ciopfs conversion (setfattr)
|
||||
sudo apt-get -y install attr &> /dev/null
|
||||
sudo apt-get clean
|
||||
fi
|
||||
rm /media/A2SHARED/A2FILES/.APPLEDESKTOP 2> /dev/null
|
||||
rm /srv/A2SERVER/A2FILES/.APPLEDESKTOP 2> /dev/null
|
||||
mkdir -p /tmp/netboot
|
||||
a2FilesList="$(wget -qO- http://ivanx.com/a2server/files/A2FILES-list.txt)"
|
||||
find /media/A2SHARED/A2FILES -name '*' | tail -n +2 | tac | while read -d $'\n' thisFile; do
|
||||
wget -qO /tmp/A2FILES-list.txt ${binaryURL}A2FILES-list.txt
|
||||
find /srv/A2SERVER/A2FILES -name '*' | tail -n +2 | tac > /tmp/filelist.txt
|
||||
while read thisFile; do
|
||||
mixedCase="${thisFile##*/}"
|
||||
gsosPath=$(grep -i "^${thisFile}$" <<< "$a2FilesList")
|
||||
gsosPath=$(grep -i -m 1 "^${thisFile}$" /tmp/A2FILES-list.txt)
|
||||
[[ $gsosPath ]] && mixedCase="${gsosPath##*/}"
|
||||
sudo setfattr -n "user.filename" -v "$mixedCase" "$thisFile"
|
||||
if [[ ${thisFile##*/} != $mixedCase ]]; then
|
||||
@@ -288,24 +366,25 @@ if [[ -d /media/A2SHARED/A2FILES && ! -d /media/A2SHARED/.a2files ]]; then
|
||||
else
|
||||
echo -e " processing $thisFile\n"
|
||||
fi
|
||||
sudo mv "$thisFile" "${thisFile%/*}"/"$(tr [:upper:] [:lower:] <<< $mixedCase)" 2> /dev/null
|
||||
done
|
||||
mv /media/A2SHARED/A2FILES /media/A2SHARED/.a2files
|
||||
mkdir /media/A2SHARED/A2FILES
|
||||
sudo sed -i 's/casefold:toupper //' /usr/local/etc/netatalk/AppleVolumes.default
|
||||
sudo sed -i 's/^VOLCASEFOLD:.*/VOLCASEFOLD:/' /media/A2SHARED/.a2files/.appledesktop/.volinfo
|
||||
sudo mv "$thisFile" "${thisFile%/*}/${mixedCase,,}" 2> /dev/null
|
||||
done < /tmp/filelist.txt
|
||||
mv /srv/A2SERVER/A2FILES /srv/A2SERVER/.a2files
|
||||
mkdir /srv/A2SERVER/A2FILES
|
||||
sudo sed -i 's/casefold:toupper //' /usr/local/etc/netatalk/AppleVolumes.default 2> /dev/null
|
||||
sudo sed -i 's/^VOLCASEFOLD:.*/VOLCASEFOLD:/' /srv/A2SERVER/.a2files/.appledesktop/.volinfo 2> /dev/null
|
||||
fi
|
||||
|
||||
# 1.3.0: remove GSFILES if empty
|
||||
if grep -q '^/media/A2SHARED/GSFILES' /usr/local/etc/netatalk/AppleVolumes.default; then
|
||||
if grep -q '^/srv/A2SERVER/GSFILES' /usr/local/etc/netatalk/AppleVolumes.default; then
|
||||
gsFilesContents=
|
||||
if [[ -d /media/A2SHARED/GSFILES ]]; then
|
||||
gsFilesContents="$(find /media/A2SHARED/GSFILES -not -path '*/\.*' | grep -v '^/media/A2SHARED/GSFILES$' | grep -v '^/media/A2SHARED/GSFILES/Network Trash Folder$' | grep -v '^/media/A2SHARED/GSFILES/Temporary Items$')"
|
||||
if [[ -d /srv/A2SERVER/GSFILES ]]; then
|
||||
gsFilesContents="$(find /srv/A2SERVER/GSFILES -not -path '*/\.*' | grep -v '^/srv/A2SERVER/GSFILES$' | grep -v '^/srv/A2SERVER/GSFILES/Network Trash Folder$' | grep -v '^/srv/A2SERVER/GSFILES/Temporary Items$')"
|
||||
if [[ ! $gsFilesContents ]]; then
|
||||
echo "A2SERVER: Removing empty GSFILES shared volume..."
|
||||
sudo /etc/init.d/netatalk stop &> /dev/null
|
||||
sudo sed -i 's|^/media/A2SHARED/GSFILES.*$|#share1|' /usr/local/etc/netatalk/AppleVolumes.default
|
||||
sudo rm -r /media/A2SHARED/GSFILES
|
||||
sudo /etc/init.d/samba stop &> /dev/null
|
||||
sudo sed -i 's|^/srv/A2SERVER/GSFILES.*$|#share1|' /usr/local/etc/netatalk/AppleVolumes.default
|
||||
sudo rm -r /srv/A2SERVER/GSFILES
|
||||
else
|
||||
echo "A2SERVER: GSFILES shared volume has files, leaving as is."
|
||||
fi
|
||||
@@ -314,20 +393,20 @@ fi
|
||||
|
||||
# set up A2FILES case-insensitive share (for ProDOS 8 files, and GS/OS system)
|
||||
sudo sed -i \
|
||||
's/^#share2/\/media\/A2SHARED\/A2FILES\ A2FILES options:prodos\ ea:ad/' \
|
||||
's/^#share2/\/srv\/A2SERVER\/A2FILES\ A2FILES options:prodos\ ea:ad/' \
|
||||
/usr/local/etc/netatalk/AppleVolumes.default
|
||||
[[ -d /media/A2SHARED/A2FILES ]] || mkdir -p /media/A2SHARED/A2FILES
|
||||
[[ -d /media/A2SHARED/.a2files ]] || mkdir -p /media/A2SHARED/.a2files
|
||||
[[ -d /srv/A2SERVER/A2FILES ]] || mkdir -p /srv/A2SERVER/A2FILES
|
||||
[[ -d /srv/A2SERVER/.a2files ]] || mkdir -p /srv/A2SERVER/.a2files
|
||||
|
||||
# set up ciopfs
|
||||
if ! command -v ciopfs > /dev/null; then
|
||||
echo "A2SERVER: Installing ciopfs (case insensitive file system)..."
|
||||
cd /tmp
|
||||
|
||||
# Dependency: For ciopfs
|
||||
sudo apt-get -y install fuse libglib2.0-0 libattr1 libfuse2
|
||||
if [[ $isRpi ]]; then
|
||||
wget -qO- "http://appleii.ivanx.com/a2server/files/ciopfs-rpi.tgz" | sudo tar Pzx
|
||||
elif [[ $isDebian_x86 ]]; then
|
||||
wget -qO- "http://appleii.ivanx.com/a2server/files/ciopfs-debian7_x86.tgz" | sudo tar Pzx
|
||||
if [[ $arch ]]; then
|
||||
{ wget -qO- "${binaryURL}precompiled/ciopfs-${arch}.tgz" | sudo tar Pzx; } &> /dev/null
|
||||
fi
|
||||
if [[ -f /etc/fuse.conf ]] && sudo grep -q user_allow_other /etc/fuse.conf; then
|
||||
sudo sed -i 's/#user_allow_other/user_allow_other/' /etc/fuse.conf
|
||||
@@ -341,15 +420,23 @@ if ! command -v ciopfs > /dev/null; then
|
||||
sudo apt-get -y update
|
||||
touch /tmp/a2server-packageReposUpdated
|
||||
fi
|
||||
sudo apt-get -y install build-essential
|
||||
sudo apt-get -y install libfuse-dev libglib2.0-dev libattr1-dev
|
||||
|
||||
# Dependency: build-dep for ciopfs
|
||||
sudo apt-get -y install build-essential libfuse-dev libglib2.0-dev libattr1-dev
|
||||
sudo apt-get -y clean
|
||||
|
||||
cd /tmp
|
||||
rm -rf /tmp/ciopfs &> /dev/null
|
||||
mkdir /tmp/ciopfs
|
||||
cd /tmp/ciopfs
|
||||
wget -q -O ciopfs-0.4.tar.gz http://www.brain-dump.org/projects/ciopfs/ciopfs-0.4.tar.gz
|
||||
tar zxf ciopfs-0.4.tar.gz
|
||||
if [[ $useExternalURL ]]; then
|
||||
wget -q -O ciopfs-0.4.tar.gz http://www.brain-dump.org/projects/ciopfs/ciopfs-0.4.tar.gz
|
||||
tar zxf ciopfs-0.4.tar.gz &> /dev/null
|
||||
fi
|
||||
if [ ! -f ciopfs*/ciopfs.c ]; then # single brackets required for glob
|
||||
wget -q -O ciopfs-0.4.tar.gz ${binaryURL}external/ciopfs-0.4.tar.gz
|
||||
tar zxf ciopfs-0.4.tar.gz &> /dev/null
|
||||
fi
|
||||
cd ciopfs*
|
||||
make
|
||||
sudo mv ciopfs /usr/local/bin
|
||||
@@ -357,28 +444,28 @@ if ! command -v ciopfs > /dev/null; then
|
||||
rm -rf /tmp/ciopfs
|
||||
fi
|
||||
if ! grep -q '^ciopfs' /etc/fstab; then
|
||||
echo "ciopfs#/media/A2SHARED/.a2files /media/A2SHARED/A2FILES fuse allow_other 0 0" | sudo tee -a /etc/fstab > /dev/null
|
||||
echo "ciopfs#/srv/A2SERVER/.a2files /srv/A2SERVER/A2FILES fuse allow_other 0 0" | sudo tee -a /etc/fstab > /dev/null
|
||||
fi
|
||||
if ! mount | grep '^ciopfs.*A2FILES'; then
|
||||
sudo ciopfs /media/A2SHARED/.a2files /media/A2SHARED/A2FILES -o allow_other
|
||||
sudo ciopfs /srv/A2SERVER/.a2files /srv/A2SERVER/A2FILES -o allow_other
|
||||
fi
|
||||
else
|
||||
echo "A2SERVER: ciopfs (case insensitive file system) has already been installed."
|
||||
fi
|
||||
|
||||
if [[ ! -d /media/A2SHARED/A2FILES/.AppleDesktop ]]; then
|
||||
cd /media/A2SHARED/A2FILES
|
||||
if [[ ! -d /srv/A2SERVER/A2FILES/.AppleDesktop ]]; then
|
||||
cd /srv/A2SERVER/A2FILES
|
||||
mkdir .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
|
||||
if [[ ! -d /srv/A2SERVER/ADTDISKS ]]; then
|
||||
ln -s /usr/local/adtpro/disks /srv/A2SERVER/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
|
||||
sudo sed -i 's@^# End of File@/srv/A2SERVER/ADTDISKS ADTDISKS ea:ad\n\n# End of File@' /usr/local/etc/netatalk/AppleVolumes.default
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -398,17 +485,14 @@ if [[ -f /usr/local/etc/netatalk/afppasswd ]]; then
|
||||
else
|
||||
|
||||
echo
|
||||
echo "A2SERVER: Setting up AFP password 'apple2' for Apple II and Mac clients."
|
||||
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/^\(${USER}\).*$/\1: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.)
|
||||
# the afppasswd -a to make Netatalk randnum logins for other Linux users.)
|
||||
|
||||
fi
|
||||
|
||||
@@ -416,24 +500,25 @@ fi
|
||||
|
||||
# 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/')
|
||||
kernelMajor=$(cut -d '.' -f 1 <<< $kernelRelease)
|
||||
kernelMinor=$(cut -d '.' -f 2 <<< $kernelRelease | sed 's/\(^[0-9]*\)[^0-9].*$/\1/')
|
||||
kernelPatch=$(cut -d '.' -f 3- <<< $kernelRelease | sed 's/\(^[0-9]*\)[^0-9].*$/\1/')
|
||||
kernelMajorMinor=$(cut -d '.' -f 1-2 <<< $kernelRelease)
|
||||
|
||||
# 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 [[ $kernelMajor -eq 3 && $kernelMinor -ge 12 && $kernelMinor -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 [[ ! ( $isRpi && $kernelMinor -eq 12 && $kernelPatch -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."
|
||||
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."
|
||||
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
|
||||
@@ -442,6 +527,97 @@ if [[ $kernelMajorRelease -eq 3 && $kernelMinorRelease -ge 12 && $kernelMinorRel
|
||||
fi
|
||||
fi
|
||||
|
||||
# if IPDDP module exists (e.g. Debian, but not Raspbian),
|
||||
# AppleTalk kernel module has been compiled to support it and can't work with MacIP
|
||||
if [[ -f "/lib/modules/$kernelRelease/kernel/drivers/net/appletalk/ipddp.ko" ]]; then
|
||||
sudo /etc/init.d/netatalk stop &> /dev/null
|
||||
sudo rmmod ipddp 2> /dev/null
|
||||
sudo rmmod appletalk 2> /dev/null
|
||||
echo "A2SERVER: Attempting to replace AppleTalk kernel module for MacIP use..."
|
||||
|
||||
sudo mv /lib/modules/$kernelRelease/kernel/net/appletalk/appletalk.ko /tmp 2> /dev/null
|
||||
|
||||
if [[ ${arch%_*} == "debian" ]]; then
|
||||
echo "A2SERVER: Attempting to fetch AppleTalk kernel module for Debian..."
|
||||
wget -qO /tmp/appletalk.tgz ${binaryURL}precompiled/appletalk-$kernelRelease-${arch}.tgz
|
||||
if [[ $? -eq 0 ]]; then
|
||||
# if we found a prebuilt one on a2server site, install it and load it
|
||||
sudo tar Pxf /tmp/appletalk.tgz &> /dev/null
|
||||
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 &> /dev/null
|
||||
else
|
||||
# if we didn't load it successfully, remove it
|
||||
sudo rm /lib/modules/$kernelRelease/kernel/net/appletalk/appletalk.ko 2> /dev/null
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! lsmod | grep -q appletalk; then
|
||||
# we don't have a prebuilt AppleTalk module, try to build from source
|
||||
if [[ ! -f /tmp/a2server-packageReposUpdated ]]; then
|
||||
# prepare for installing packages
|
||||
sudo apt-get -y update
|
||||
touch /tmp/a2server-packageReposUpdated
|
||||
fi
|
||||
|
||||
# kernel module compile adapted from from: http://askubuntu.com/a/338403/288003
|
||||
for i in 1; do
|
||||
echo "A2SERVER: Attempting to build AppleTalk kernel module..."
|
||||
[[ -f /boot/config-$kernelRelease ]] || break
|
||||
sudo apt-get -y install linux-headers-$kernelRelease linux-source-$kernelMajorMinor || break
|
||||
sudo apt-get -y install build-essential
|
||||
cd /usr/src
|
||||
kernelSrc=$(find linux-source-${kernelMajorMinor}*)
|
||||
if [[ ${kernelSrc##*.} == "xz" ]]; then
|
||||
{ xzcat $kernelSrc | sudo tar x; } &> /dev/null
|
||||
elif [[ ${kernelSrc##*.} == "bz2" ]]; then
|
||||
sudo tar jxf $kernelSrc &> /dev/null
|
||||
elif [[ ${kernelSrc##*.} == "gz" || ${kernelSrc##*.} == "tgz" ]]; then
|
||||
sudo tar zxf $kernelSrc &> /dev/null
|
||||
fi
|
||||
cd linux-source-$kernelMajorMinor
|
||||
sudo make mrproper
|
||||
sudo cp ../linux-headers-$kernelRelease/Module.symvers .
|
||||
yes '' | sudo make oldconfig
|
||||
sudo sed -i 's:^.*IPDDP.*$:# CONFIG_IPDDP is not set:gI' .config # disable IPDDP in kernel config
|
||||
sudo sed -i '$!N; /^\(# CONFIG_IPDDP is not set\)\n\1$/!P; D' .config # delete repeated entries
|
||||
sudo make prepare
|
||||
sudo make modules_prepare
|
||||
sudo make SUBDIRS=scripts/mod
|
||||
sudo make SUBDIRS=net/appletalk modules
|
||||
sudo cp net/appletalk/appletalk.ko /lib/modules/$kernelRelease/kernel/net/appletalk
|
||||
sudo depmod
|
||||
sudo modprobe appletalk
|
||||
sudo rm -r /lib/modules/$kernelRelease/kernel/drivers/net/appletalk/ipddp.ko
|
||||
sudo rmdir /lib/modules/$kernelRelease/kernel/drivers/net/appletalk 2> /dev/null
|
||||
|
||||
# clean up
|
||||
cd
|
||||
sudo rm /usr/src/$kernelSrc
|
||||
sudo rm -r /usr/src/linux-source-$kernelMajorMinor
|
||||
sudo apt-get -y purge linux-source-$kernelMajorMinor
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ $(lsmod | grep appletalk) ]]; then
|
||||
# if it loaded, make permanent and restart netatalk
|
||||
sudo rm /lib/modules/$kernelRelease/kernel/drivers/net/appletalk/ipddp.ko 2> /dev/null
|
||||
sudo sed -i 's:^.*IPDDP.*$:# CONFIG_IPDDP is not set:gI' /boot/config-$kernelRelease
|
||||
sudo sed -i '$!N; /^\(# CONFIG_IPDDP is not set\)\n\1$/!P; D' /boot/config-$kernelRelease
|
||||
sudo sed -i "s/ATALKD_RUN=no/ATALKD_RUN=yes/" /etc/default/netatalk; sudo /etc/init.d/netatalk restart &> /dev/null
|
||||
else
|
||||
# if we didn't load it successfully, put back the one that was there
|
||||
echo "A2SERVER: Unable to replace AppleTalk module, replacing original."
|
||||
sudo mv /tmp/appletalk.ko /lib/modules/$kernelRelease/kernel/net/appletalk 2> /dev/null
|
||||
sudo depmod
|
||||
touch /tmp/noMacIP # to notify at end of install
|
||||
fi
|
||||
fi
|
||||
|
||||
# --- Start Netatalk (if not running)
|
||||
|
||||
bground=
|
||||
@@ -475,10 +651,10 @@ if [[ ( ! $(ps aux | grep [a]talkd) ) && ( $isRpi ) ]]; then
|
||||
# if no AppleTalk module, try to download it from a2server site
|
||||
if [[ ! -f /lib/modules/$kernelRelease/kernel/net/appletalk/appletalk.ko ]]; then # check for rpi kernel module
|
||||
echo "A2SERVER: Attempting to install AppleTalk kernel module for Raspbian..."
|
||||
wget -qO /tmp/appletalk.ko.gz http://appleii.ivanx.com/a2server/files/appletalk-$kernelRelease.ko.gz
|
||||
wget -qO /tmp/appletalk.ko.gz ${binaryURL}appletalk-$kernelRelease-rpi.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
|
||||
gunzip -f /tmp/appletalk.ko.gz &> /dev/null
|
||||
sudo mkdir -p /lib/modules/$kernelRelease/kernel/net/appletalk
|
||||
sudo mv /tmp/appletalk.ko /lib/modules/$kernelRelease/kernel/net/appletalk
|
||||
sudo depmod
|
||||
@@ -539,7 +715,10 @@ if [[ ! $(dpkg -l avahi-daemon 2> /dev/null | grep ^ii) || ! $(dpkg -l libnss-md
|
||||
sudo apt-get -y update
|
||||
touch /tmp/a2server-packageReposUpdated
|
||||
fi
|
||||
|
||||
# Dependency: Bonjour for netatalk
|
||||
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
|
||||
|
||||
@@ -12,16 +12,22 @@ case "$A2SERVER_SCRIPT_URL" in
|
||||
*/) scriptURL="$A2SERVER_SCRIPT_URL" ;;
|
||||
*) scriptURL="${A2SERVER_SCRIPT_URL:-http://ivanx.com/a2server}/" ;;
|
||||
esac
|
||||
case "$A2SERVER_BINARY_URL" in
|
||||
*/) binaryURL="$A2SERVER_BINARY_URL" ;;
|
||||
*) binaryURL="${A2SERVER_BINARY_URL:-http://ivanx.com/a2server/files}/" ;;
|
||||
esac
|
||||
useExternalURL=1
|
||||
[[ $A2SERVER_NO_EXTERNAL ]] && useExternalURL=
|
||||
|
||||
gsosDir="/media/A2SHARED/A2FILES"
|
||||
gsosDir="/srv/A2SERVER/A2FILES"
|
||||
imagesDir=$gsosDir/GSOS.Installer/Images
|
||||
imageToolsDir=$gsosDir/GSOS.Installer/Image.Tools
|
||||
netInstallDir=$gsosDir/GSOS.Installer/Net.Install
|
||||
|
||||
p8Dir="/media/A2SHARED/A2FILES"
|
||||
p8Dir="/srv/A2SERVER/A2FILES"
|
||||
diskToolsP8Dir=$p8Dir/Disk.Tools.P8
|
||||
|
||||
commDir="/media/A2SHARED/A2FILES/Comm"
|
||||
commDir="/srv/A2SERVER/A2FILES/Comm"
|
||||
spectrumDir=$commDir/Spectrum
|
||||
protermDir=$commDir/ProTERM
|
||||
zlinkDir=$commDir/Z.Link
|
||||
@@ -72,11 +78,18 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
|
||||
echo "A2SERVER: Downloading Apple II Boot Blocks..."
|
||||
cd /tmp/netboot
|
||||
|
||||
wget --max-redirect 0 -qO Disk_7_of_7-Apple_II_Setup.sea.bin ${gsosURL}Disk_7_of_7-Apple_II_Setup.sea.bin
|
||||
if (( $? != 0 )); then
|
||||
wget -qO Disk_7_of_7-Apple_II_Setup.sea.bin ${gsosBackupURL}Disk_7_of_7-Apple_II_Setup.sea.bin
|
||||
if [[ $useExternalURL ]]; then
|
||||
wget --max-redirect 0 -qO Disk_7_of_7-Apple_II_Setup.sea.bin ${gsosURL}Disk_7_of_7-Apple_II_Setup.sea.bin
|
||||
unar -k skip Disk_7_of_7-Apple_II_Setup.sea.bin &> /dev/null
|
||||
if (( $? != 0 )); then
|
||||
wget -qO Disk_7_of_7-Apple_II_Setup.sea.bin ${gsosBackupURL}Disk_7_of_7-Apple_II_Setup.sea.bin
|
||||
unar -k skip Disk_7_of_7-Apple_II_Setup.sea.bin &> /dev/null
|
||||
fi
|
||||
fi
|
||||
if [[ ! -f 'Disk 7 of 7-Apple II Setup.sea' ]]; then
|
||||
wget -qO Disk_7_of_7-Apple_II_Setup.sea.bin ${binaryURL}external/appleii/gsos601/Disk_7_of_7-Apple_II_Setup.sea.bin
|
||||
unar -k skip Disk_7_of_7-Apple_II_Setup.sea.bin &> /dev/null
|
||||
fi
|
||||
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
|
||||
|
||||
@@ -234,21 +247,38 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
|
||||
afpsync -v $gsosDir > /dev/null
|
||||
|
||||
for diskname in ${diskNames[@]}; do
|
||||
outfile="$imagesDir/$diskname"
|
||||
outfile="$imagesDir/$diskname.po"
|
||||
(( activeDisk++ ))
|
||||
echo "A2SERVER: Disk ${activeDisk} of ${#diskNames[@]}: $diskname"
|
||||
if (( $gsosInstall == 1 )); then
|
||||
wget --max-redirect 0 -qO "Disk_${activeDisk}_of_7-$diskname.sea.bin" "${gsosURL}Disk_${activeDisk}_of_7-$diskname.sea.bin"
|
||||
if (( $? != 0 )); then
|
||||
wget -qO "Disk_${activeDisk}_of_7-$diskname.sea.bin" "${gsosBackupURL}Disk_${activeDisk}_of_7-$diskname.sea.bin"
|
||||
if [[ $useExternalURL ]]; then
|
||||
wget --max-redirect 0 -qO "Disk_${activeDisk}_of_7-${diskname}.sea.bin" "${gsosURL}Disk_${activeDisk}_of_7-${diskname}.sea.bin"
|
||||
unar -k skip "Disk_${activeDisk}_of_7-${diskname}.sea.bin" &> /dev/null
|
||||
if [[ ! -f "Disk ${activeDisk} of 7-${diskname}.sea" ]]; then
|
||||
wget -qO "Disk_${activeDisk}_of_7-${diskname}.sea.bin" "${gsosBackupURL}Disk_${activeDisk}_of_7-${diskname}.sea.bin"
|
||||
unar -k skip "Disk_${activeDisk}_of_7-${diskname}.sea.bin" &> /dev/null
|
||||
fi
|
||||
fi
|
||||
if [[ ! -f "Disk ${activeDisk} of 7-${diskname}.sea" ]]; then
|
||||
wget -qO "Disk_${activeDisk}_of_7-${diskname}.sea.bin" "${binaryURL}external/appleii/gsos601/Disk_${activeDisk}_of_7-${diskname}.sea.bin"
|
||||
unar -k skip "Disk_${activeDisk}_of_7-${diskname}.sea.bin" &> /dev/null
|
||||
fi
|
||||
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
|
||||
elif (( $gsosInstall == 2 )); then
|
||||
wget -qO $outfile "$gsosURL/IIGS%20System%206.0.2%20-%20Disk%20${activeDisk}%20${diskWebNames[$activeDisk-1]}.po"
|
||||
if [[ $useExternalURL ]]; then
|
||||
wget -qO $outfile "$gsosURL/IIGS%20System%206.0.2%20-%20Disk%20${activeDisk}%20${diskWebNames[$activeDisk-1]}.po"
|
||||
fi
|
||||
if [[ $? -ne 0 || ! -f $outfile ]]; then
|
||||
wget -qO $outfile "${binaryURL}external/appleii/gsos602/$diskname.po"
|
||||
fi
|
||||
elif (( $gsosInstall == 3 )); then
|
||||
wget -qO $outfile "$gsosURL/$diskname.po"
|
||||
if [[ $useExternalURL ]]; then
|
||||
wget -qO $outfile "$gsosURL/$diskname.po"
|
||||
fi
|
||||
if [[ $? -ne 0 || ! -f $outfile ]]; then
|
||||
wget -qO $outfile "${binaryURL}external/appleii/gsos603/$diskname.po"
|
||||
fi
|
||||
fi
|
||||
cppo -s -ad $outfile $netInstallDir 2> /dev/null
|
||||
done
|
||||
@@ -358,8 +388,14 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
|
||||
else
|
||||
echo
|
||||
cd /tmp/netboot
|
||||
wget -qO Asimov.shk http://www.ninjaforce.com/downloads/Asimov.shk
|
||||
nulib2 -x -s Asimov.shk > /dev/null
|
||||
if [[ $useExternalURL ]]; then
|
||||
wget -qO Asimov.shk http://www.ninjaforce.com/downloads/Asimov.shk
|
||||
nulib2 -x -s Asimov.shk &> /dev/null
|
||||
fi
|
||||
if [[ ! -d Asimov ]]; then
|
||||
wget -qO Asimov.shk ${binaryURL}external/appleii/Asimov.shk
|
||||
nulib2 -x -s Asimov.shk &> /dev/null
|
||||
fi
|
||||
cp -p Asimov/Asimov $imageToolsDir/Asimov
|
||||
afpsync -v $gsosDir > /dev/null
|
||||
cat Asimov/Asimov_rsrc_ >> $imageToolsDir/.AppleDouble/Asimov
|
||||
@@ -372,14 +408,22 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; 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
|
||||
mkdir -p /tmp/netboot/gshk
|
||||
cd /tmp/netboot/gshk
|
||||
if [[ $useExternalURL ]]; then
|
||||
wget -qO gshk11.sea http://web.archive.org/web/20131031160750/http://nulib.com/library/gshk11.sea
|
||||
#wget -qO gshk11.sea http://www.nulib.com/library/gshk11.sea
|
||||
nulib2 -x -s gshk11.sea &> /dev/null
|
||||
fi
|
||||
if [[ ! -f GSHK ]]; then
|
||||
wget -qO gshk11.sea ${binaryURL}external/appleii/gshk11.sea
|
||||
nulib2 -x -s gshk11.sea &> /dev/null
|
||||
fi
|
||||
cp -p GSHK $imageToolsDir/GSHK
|
||||
afpsync -v $gsosDir > /dev/null
|
||||
cat GSHK_rsrc_ >> $imageToolsDir/.AppleDouble/GSHK
|
||||
afptype -p S16 -a DB07 -q $imageToolsDir/GSHK
|
||||
cd /tmp/netboot
|
||||
fi
|
||||
|
||||
echo -n "MountIt 1.4"
|
||||
@@ -389,7 +433,12 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
|
||||
else
|
||||
echo
|
||||
cd /tmp/netboot
|
||||
wget -q -O MOUNTIT.SHK http://www.brutaldeluxe.fr/products/apple2gs/MOUNTIT.SHK
|
||||
if [[ $useExternalURL ]]; then
|
||||
wget -q -O MOUNTIT.SHK http://www.brutaldeluxe.fr/products/apple2gs/MOUNTIT.SHK
|
||||
fi
|
||||
if [[ $? -ne 0 || ! -f MOUNTIT.SHK ]]; then
|
||||
wget -qO MOUNTIT.SHK ${binaryURL}external/appleii/MOUNTIT.SHK
|
||||
fi
|
||||
cp -p MOUNTIT.SHK $imageToolsDir/MOUNTIT.SHK
|
||||
afpsync -v $gsosDir > /dev/null
|
||||
afptype -p SHK -q $imageToolsDir/MOUNTIT.SHK
|
||||
@@ -415,9 +464,14 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
|
||||
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 "http://appleii.ivanx.com/a2server/files/shrinkit.sdk"
|
||||
nulib2 -xs shrinkit.sdk > /dev/null
|
||||
if [[ $useExternalURL ]]; then
|
||||
wget -qO shrinkit.sdk http://web.archive.org/web/20131031160750/http://www.nulib.com/library/shrinkit.sdk
|
||||
nulib2 -x -s shrinkit.sdk &> /dev/null
|
||||
fi
|
||||
if [[ ! -f SHRINKIT ]]; then
|
||||
wget -qO shrinkit.sdk ${binaryURL}external/appleii/shrinkit.sdk
|
||||
nulib2 -x -s shrinkit.sdk &> /dev/null
|
||||
fi
|
||||
cppo -s -ad SHRINKIT /SHRINKIT/SHRINKIT $diskToolsP8Dir 2> /dev/null
|
||||
afpsync -v $sharepath > /dev/null
|
||||
fi
|
||||
@@ -429,8 +483,14 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
|
||||
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
|
||||
if [[ $useExternalURL ]]; then
|
||||
wget -q -O dsk2file.shk http://www.dwheeler.com/6502/oneelkruns/dsk2file.zip
|
||||
nulib2 -x -s dsk2file.shk &> /dev/null
|
||||
fi
|
||||
if [[ ! -f DSK2FILE58 ]]; then
|
||||
wget -qO dsk2file.shk ${binaryURL}external/appleii/dsk2file.shk
|
||||
nulib2 -x -s dsk2file.shk &> /dev/null
|
||||
fi
|
||||
cp -p DSK2FILE58 $diskToolsP8Dir/DSK2FILE
|
||||
afpsync -v $sharepath > /dev/null
|
||||
afptype -p SYS -q $diskToolsP8Dir/DSK2FILE
|
||||
@@ -442,11 +502,17 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
|
||||
else
|
||||
echo
|
||||
cd /tmp/netboot
|
||||
wget --max-redirect 0 -qO Apple_II_System_Disk_3.2.sea.bin http://download.info.apple.com/Apple_Support_Area/Apple_Software_Updates/English-North_American/Apple_II/Apple_II_Supplemental/Apple_II_System_Disk_3.2.sea.bin
|
||||
if (( $? != 0 )); then
|
||||
wget -qO Apple_II_System_Disk_3.2.sea.bin http://archive.org/download/download.info.apple.com.2012.11/download.info.apple.com.2012.11.zip/download.info.apple.com%2FApple_Support_Area%2FApple_Software_Updates%2FEnglish-North_American%2FApple_II%2FApple_II_Supplemental%2FApple_II_System_Disk_3.2.sea.bin
|
||||
if [[ $useExternalURL ]]; then
|
||||
wget --max-redirect 0 -qO Apple_II_System_Disk_3.2.sea.bin http://download.info.apple.com/Apple_Support_Area/Apple_Software_Updates/English-North_American/Apple_II/Apple_II_Supplemental/Apple_II_System_Disk_3.2.sea.bin
|
||||
if (( $? != 0 )); then
|
||||
wget -qO Apple_II_System_Disk_3.2.sea.bin http://archive.org/download/download.info.apple.com.2012.11/download.info.apple.com.2012.11.zip/download.info.apple.com%2FApple_Support_Area%2FApple_Software_Updates%2FEnglish-North_American%2FApple_II%2FApple_II_Supplemental%2FApple_II_System_Disk_3.2.sea.bin
|
||||
unar -k skip Apple_II_System_Disk_3.2.sea.bin &> /dev/null
|
||||
fi
|
||||
fi
|
||||
if [[ ! -f 'Apple II System Disk 3.2.sea' ]]; then
|
||||
wget -qO Apple_II_System_Disk_3.2.sea.bin ${binaryURL}external/appleii/Apple_II_System_Disk_3.2.sea.bin
|
||||
unar -k skip Apple_II_System_Disk_3.2.sea.bin &> /dev/null
|
||||
fi
|
||||
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
|
||||
@@ -478,22 +544,33 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
|
||||
else
|
||||
mkdir -p $spectrumDir
|
||||
echo
|
||||
mkdir -p /tmp/netboot
|
||||
cd /tmp/netboot
|
||||
mkdir -p /tmp/netboot/spectrum
|
||||
cd /tmp/netboot/spectrum
|
||||
if [[ ! -f $gsosDir/SYSTEM/START.GS.OS ]]; then
|
||||
#if true; then
|
||||
# provide disk images for MountIt if no GS/OS present
|
||||
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
|
||||
echo -n "These Spectrum installer disk image files can be converted to floppy disks with Asimov or DSK2FILE, or mounted directly with MountIt. If using MountIt, mount bouth SPECTRUM.HDV and EXTRAS.HDV before running the installer." > $spectrumDir/SPECTRUM.README
|
||||
for filename in spectrum.2mg spectrum_extras.2mg spectrum_sounds.2mg spectrum_manuals.2mg; do
|
||||
if [[ $useExternalURL ]]; then
|
||||
wget -qO $filename http://www.speccie.co.uk/speccie/software/$filename
|
||||
fi
|
||||
if [[ $? -ne 0 || ! -f $filename ]]; then
|
||||
wget -qO $filename ${binaryURL}external/appleii/spectrum/$filename
|
||||
fi
|
||||
dd bs=64 skip=1 if=$filename of=$spectrumDir/${filename,,}.HDV 2> /dev/null
|
||||
done
|
||||
echo -n "The Spectrum installer disk image files can be converted to floppy disks with Asimov or DSK2FILE, or mounted directly with MountIt. If using MountIt, mount bouth SPECTRUM.HDV and EXTRAS.HDV before running the installer." > $spectrumDir/SPECTRUM.README
|
||||
afpsync -v $gsosDir > /dev/null
|
||||
afptype -p TXT -q $spectrumDir/SPECTRUM.README
|
||||
else
|
||||
# install Spectrum into GS/OS
|
||||
wget -qO spectrum_gold_2mg.zip http://www.speccie.co.uk/speccie/software/spectrum_gold_2mg.zip
|
||||
unzip -p spectrum_gold_2mg.zip | dd bs=64 skip=1 of=Spectrum.Gold.HDV 2> /dev/null
|
||||
if [[ $useExternalURL ]]; then
|
||||
wget -qO spectrum_gold_2mg.zip http://www.speccie.co.uk/speccie/software/spectrum_gold_2mg.zip
|
||||
unzip -p spectrum_gold_2mg.zip 2> /dev/null | dd bs=64 skip=1 of=Spectrum.Gold.HDV 2> /dev/null
|
||||
fi
|
||||
if [[ ! -f Spectrum.Gold.2mg ]]; then
|
||||
wget -qO spectrum_gold_2mg.zip ${binaryURL}external/appleii/spectrum/spectrum_gold_2mg.zip
|
||||
unzip -p spectrum_gold_2mg.zip 2> /dev/null | dd bs=64 skip=1 of=Spectrum.Gold.HDV 2> /dev/null
|
||||
fi
|
||||
cppo -s -ad Spectrum.Gold.HDV .
|
||||
userFolder=$(tr [:lower:] [:upper:] <<< $USER)
|
||||
for thisFolder in \
|
||||
@@ -532,7 +609,7 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
|
||||
mkdir -p $zlinkDir/.AppleDouble
|
||||
echo
|
||||
cd /tmp/netboot
|
||||
wget -qO A2CLOUD.HDV "http://ivanx.com/a2server/files/A2CLOUD.HDV"
|
||||
wget -qO A2CLOUD.HDV "${binaryURL}A2CLOUD.HDV"
|
||||
cppo -ad A2CLOUD.HDV . > /dev/null
|
||||
cd A2CLOUD
|
||||
mv *PT3* *PROTERM* $protermDir
|
||||
@@ -561,8 +638,6 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
|
||||
|
||||
# clean up
|
||||
cd
|
||||
[[ -d /tmp/netboot ]] && rm -rf /tmp/netboot
|
||||
[[ -d ~/GNUstep ]] && rm -rf ~/GNUstep
|
||||
|
||||
# rock and roll!
|
||||
echo
|
||||
@@ -572,7 +647,7 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; 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://ivanx.com/a2server for info using it."
|
||||
|
||||
fi
|
||||
|
||||
@@ -585,7 +660,7 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
|
||||
if [[ $autoAnswerYes || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
|
||||
# Farallon bridge patch for GS/OS courtesy of Geoff Body
|
||||
echo "A2SERVER: Downloading Farallon bridge patch..."
|
||||
wget -O /tmp/FARALLON.PO "http://appleii.ivanx.com/a2server/files/FARALLON.B1.PO" &> /dev/null
|
||||
wget -O /tmp/FARALLON.PO "${binaryURL}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
|
||||
|
||||
@@ -28,8 +28,10 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupWindowsSharing ]]; then
|
||||
touch /tmp/a2server-packageReposUpdated
|
||||
fi
|
||||
|
||||
# Dependency: samba for Windows/modern Macs
|
||||
# FIXME: Figure out when smbpasswd moved and adjust this as necessary
|
||||
sudo apt-get -y install samba
|
||||
command -v smbpasswd >/dev/null || sudo apt-get -y install samba-common-bin
|
||||
command -v smbpasswd > /dev/null || sudo apt-get -y install samba-common-bin
|
||||
sudo apt-get clean
|
||||
fi
|
||||
|
||||
@@ -46,13 +48,19 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupWindowsSharing ]]; then
|
||||
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 \
|
||||
# remove GSFILES if no longer serving it
|
||||
if ! grep ^/srv/A2SERVER/GSFILES /usr/local/etc/netatalk/AppleVolumes.default; then
|
||||
sudo sed -i ':a;N;$!ba;s#\n\[GSFILES\].*\[#\n[#' /etc/samba/smb.conf
|
||||
sudo sed -i ':a;N;$!ba;s#\n\[GSFILES\].*$#\n#' /etc/samba/smb.conf
|
||||
fi
|
||||
|
||||
grep ^/srv/A2SERVER /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 " path = /srv/A2SERVER/$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
|
||||
|
||||
233
scripts/raspbian-update.txt
Normal file
233
scripts/raspbian-update.txt
Normal file
@@ -0,0 +1,233 @@
|
||||
#!/bin/bash
|
||||
|
||||
# raspbian-update
|
||||
# updates Raspbian to latest version, including NOOBS if installed
|
||||
|
||||
[[ -f /usr/bin/raspi-config ]] && isRpi=1 || isRpi=
|
||||
|
||||
if [[ ! $isRpi ]]; then
|
||||
echo "This ain't a Raspberry Pi."
|
||||
[[ $0 == "-bash" ]] && return 1 || exit 1
|
||||
fi
|
||||
|
||||
skipRepoUpdate=
|
||||
autoYes=
|
||||
updateA2Cloud=
|
||||
updateA2Server=
|
||||
while [[ $1 ]]; do
|
||||
if [[ $1 == "-r" ]]; then
|
||||
shift
|
||||
skipRepoUpdate="-r"
|
||||
elif [[ $1 == "-y" ]]; then
|
||||
shift
|
||||
autoYes="-y"
|
||||
elif [[ $1 == "-n" ]]; then
|
||||
shift
|
||||
noobsOnly="-n"
|
||||
elif [[ $1 == "a2cloud" ]]; then
|
||||
shift
|
||||
updateA2Cloud=1
|
||||
elif [[ $1 == "a2server" ]]; then
|
||||
shift
|
||||
updateA2Server=1
|
||||
elif [[ $1 ]]; then
|
||||
echo "options:"
|
||||
echo "-y: auto-answer yes to all prompts and don't prompt for restart"
|
||||
echo "-r: don't update package repositories"
|
||||
echo "-n: update NOOBS only; don't update Raspbian"
|
||||
echo "a2cloud : update A2CLOUD when complete"
|
||||
echo "a2server: update A2SERVER when complete"
|
||||
[[ $0 == "-bash" ]] && return 1 || exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
noobs=
|
||||
readarray -t partitions < <(sudo fdisk -l | grep '^/dev')
|
||||
if [[ \
|
||||
${partitions[0]:0:14} == "/dev/mmcblk0p1" && ${partitions[0]:57:2} == " e" &&
|
||||
${partitions[1]:0:14} == "/dev/mmcblk0p2" && ${partitions[1]:57:2} == "85" &&
|
||||
${partitions[2]:0:14} == "/dev/mmcblk0p3" && ${partitions[2]:57:2} == "83" &&
|
||||
${partitions[3]:0:14} == "/dev/mmcblk0p5" && ${partitions[3]:57:2} == " c" &&
|
||||
${partitions[4]:0:14} == "/dev/mmcblk0p6" && ${partitions[4]:57:2} == "83" ]]; then
|
||||
noobs=" and the NOOBS install manager"
|
||||
fi
|
||||
|
||||
if [[ ! $autoYes ]]; then
|
||||
echo
|
||||
echo "You are about to update your SD card to the latest version of the"
|
||||
echo "Raspbian operating system${noobs}."
|
||||
echo
|
||||
echo "This may take an hour or more, and will require restarting when complete."
|
||||
echo "You might want a backup before continuing in case it doesn't go as planned."
|
||||
echo
|
||||
echo -n "Update Raspbian? "
|
||||
read
|
||||
if [[ ${REPLY:0:1} != "Y" && ${REPLY:0:1} != "y" ]]; then
|
||||
[[ $0 == "-bash" ]] && return 2 || exit 2
|
||||
fi
|
||||
fi
|
||||
|
||||
origDir="$PWD"
|
||||
cd /tmp
|
||||
|
||||
if [[ ! $skipRepoUpdate ]]; then
|
||||
echo "Updating package repositories..."
|
||||
sudo apt-get -y update > /dev/null
|
||||
else
|
||||
echo "Not updating package repositories..."
|
||||
echo
|
||||
fi
|
||||
|
||||
if [[ ! $noobsOnly ]]; then
|
||||
{ cd /tmp; sudo apt-get -y autoremove; sudo apt-get -y autoclean; sudo apt-get -y clean; } > /dev/null
|
||||
freeSpace=$(df / | tail -1 | awk '{ print $4 }')
|
||||
if (( $freeSpace < 400000 )); then
|
||||
if dpkg -l | grep -q wolfram-engine; then
|
||||
if [[ ! $autoYes ]]; then
|
||||
echo "In order to create enough space on your SD card to upgrade,"
|
||||
echo "the Wolfram Language and Mathematica software packages must be removed."
|
||||
echo "If you don't know what these are, this won't affect you at all."
|
||||
echo
|
||||
echo -n "Remove Wolfram software? "
|
||||
read
|
||||
if [[ ${REPLY:0:1} != "Y" && ${REPLY:0:1} != "y" ]]; then
|
||||
[[ $0 == "-bash" ]] && return 2 || exit 2
|
||||
fi
|
||||
sudo rm /opt/Wolfram/WolframEngine/10.0/SystemFiles/Java/Linux-ARM 2> /dev/null
|
||||
sudo apt-get -y purge wolfram-engine
|
||||
else
|
||||
echo "Removing Wolfram software due to space constraints..."
|
||||
sudo rm /opt/Wolfram/WolframEngine/10.0/SystemFiles/Java/Linux-ARM 2> /dev/null
|
||||
sudo apt-get -y purge wolfram-engine
|
||||
fi
|
||||
else
|
||||
echo "You don't have enough free space on your SD card to upgrade."
|
||||
echo "Sorry, man. Delete some stuff or get a bigger card."
|
||||
[[ $0 == "-bash" ]] && return 1 || exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
{ cd /tmp; sudo apt-get -y autoremove; sudo apt-get -y autoclean; sudo apt-get -y clean; } > /dev/null
|
||||
dpkg -l | grep -q a2pi && sudo apt-get -y --force-yes install a2pi
|
||||
dpkg -l | grep -q apple2user && sudo apt-get -y --force-yes install apple2user gsport
|
||||
if dpkg -l | grep -q wolfram-engine; then
|
||||
sudo rm /opt/Wolfram/WolframEngine/10.0/SystemFiles/Java/Linux-ARM 2> /dev/null
|
||||
if [[ $freeSpace -lt 750000 && $(apt-get -s install wolfram-engine | grep upgraded) ]]; then
|
||||
sudo apt-get -y purge wolfram-engine
|
||||
{ cd /tmp; sudo apt-get -y autoremove; sudo apt-get -y autoclean; sudo apt-get -y clean; } > /dev/null
|
||||
fi
|
||||
sudo apt-get -y install wolfram-engine
|
||||
{ cd /tmp; sudo apt-get -y autoremove; sudo apt-get -y autoclean; sudo apt-get -y clean; } > /dev/null
|
||||
fi
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
|
||||
{ cd /tmp; sudo apt-get -y autoremove; sudo apt-get -y autoclean; sudo apt-get -y clean; } > /dev/null
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade
|
||||
{ cd /tmp; sudo apt-get -y autoremove; sudo apt-get -y autoclean; sudo apt-get -y clean; } > /dev/null
|
||||
sudo apt-get -y install raspberrypi-ui-mods
|
||||
{ cd /tmp; sudo apt-get -y autoremove; sudo apt-get -y autoclean; sudo apt-get -y clean; } > /dev/null
|
||||
fi
|
||||
|
||||
if [[ $noobs ]]; then
|
||||
echo "Updating NOOBS..."
|
||||
|
||||
# update Partition 3
|
||||
mkdir -p /tmp/p3
|
||||
sudo mount /dev/mmcblk0p3 /tmp/p3
|
||||
sudo rm -rf /tmp/p3/os/* 2> /dev/null
|
||||
if grep -q 'Raspple II' /tmp/p3/installed_os.json; then
|
||||
echo "Downloading Raspple II lite..."
|
||||
noobsUrl="ivanx.com/rasppleii/files/RasppleII_lite.zip"
|
||||
noobsOSurl="ivanx.com/rasppleii/noobs-os"
|
||||
distDir="Raspple_II"
|
||||
sudo mkdir -p /tmp/p3/os/$distDir
|
||||
sudo sed -i 's:/Raspbian:/Raspple_II:' /tmp/p3/installed_os.json
|
||||
sudo wget -qO /tmp/p3/icon.png $noobsOSurl/Raspple_II.png
|
||||
{ wget -qO- $noobsOSurl/slidesAB.tar | sudo tar -C /tmp/p3/os/$distDir -x; } &> /dev/null
|
||||
else
|
||||
echo "Downloading NOOBS lite..."
|
||||
noobsRoot="downloads.raspberrypi.org/NOOBS_lite/images/"
|
||||
noobsDir=$(wget -qO- $noobsRoot | grep '^<tr><td' | tail -1 | grep -P -o 'href=".*?"' | cut -c 6- | tr -d '"')
|
||||
noobsUrl=$noobsRoot$noobsDir$(wget -qO- $noobsRoot$noobsDir | grep -P -o 'href=".*.zip"' | cut -c 6- | tr -d '"')
|
||||
noobsOSurl="downloads.raspberrypi.org/raspbian"
|
||||
distDir="Raspbian"
|
||||
sudo mkdir -p /tmp/p3/os/$distDir
|
||||
sudo wget -qO /tmp/p3/icon.png $noobsOSurl/Raspbian.png
|
||||
{ wget -qO- $noobsOSurl/marketing.tar | sudo tar -C /tmp/p3/os/$distDir -x; } &> /dev/null
|
||||
fi
|
||||
sudo rm -rf /tmp/p3/cache 2> /dev/null
|
||||
releaseDate=$(wget -qO- $noobsOSurl/os.json | grep 'release_date' | cut -f 4 -d '"')
|
||||
sudo sed -i 's/"release_date".*$/"release_date" : "'$releaseDate'"/' /tmp/p3/installed_os.json
|
||||
sudo sed -i 's/keyboard_layout=gb/keyboard_layout=us/' /tmp/p3/noobs.conf
|
||||
sudo sed -i 's:/mnt/:/settings/:' /tmp/p3/installed_os.json
|
||||
sudo sed -i 's@"icon".*,@"icon" : "/settings/os/'$distDir'/icon.png",@' /tmp/p3/installed_os.json
|
||||
sudo cp /tmp/p3/icon.png /tmp/p3/os/$distDir
|
||||
sudo wget -qO /tmp/p3/os/$distDir/os.json $noobsOSurl/os.json
|
||||
sudo wget -qO /tmp/p3/os/$distDir/partition_setup.sh $noobsOSurl/partition_setup.sh
|
||||
sudo wget -qO /tmp/p3/os/$distDir/partitions.json $noobsOSurl/partitions.json
|
||||
sudo umount /tmp/p3
|
||||
rmdir /tmp/p3
|
||||
|
||||
# update Partition 1
|
||||
mkdir -p /tmp/p1
|
||||
sudo mount /dev/mmcblk0p1 /tmp/p1
|
||||
wget -qO /tmp/noobs_lite.zip $noobsUrl
|
||||
sudo rm -rf /tmp/p1/*
|
||||
sudo unzip -d /tmp/p1 /tmp/noobs_lite.zip
|
||||
sudo sed -i 's/^runinstaller //' /tmp/p1/recovery.cmdline
|
||||
sudo sed -i 's/silentinstall//' /tmp/p1/recovery.cmdline
|
||||
grep -q 'keyboard=us' /tmp/p1/recovery.cmdline || sudo sed -i '1 s/^\(.*\)$/\1 keyboard=us/' /tmp/p1/recovery.cmdline
|
||||
grep -q 'disablesafemode' /tmp/p1/recovery.cmdline || sudo sed -i '1 s/^\(.*\)$/\1 disablesafemode/' /tmp/p1/recovery.cmdline
|
||||
sudo umount /tmp/p1
|
||||
rmdir /tmp/p1
|
||||
|
||||
sudo sed -i 's/\(Raspple II release.*[^u]$\)/\1u/' /etc/issue
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "*** Raspbian update completed. ***"
|
||||
echo
|
||||
|
||||
cd /tmp
|
||||
|
||||
if [[ $updateA2Cloud ]]; then
|
||||
wget -qO /tmp/a2cloud-setup ivanx.com/a2cloud/setup/
|
||||
source /tmp/a2cloud-setup -y -r noSetGroups
|
||||
if acmd -g /usr/share/gsport/disks/GSport\ Internet\ Starter\ Kit.2mg SYSTEM/FONTS/SIS.4.10 &> /dev/null; then
|
||||
wget -qO /tmp/ua2.txt ivanx.com/rasppleii/files/a/ua2.txt
|
||||
source /tmp/ua2.txt
|
||||
fi
|
||||
echo
|
||||
echo "*** A2CLOUD update completed. ***"
|
||||
echo
|
||||
fi
|
||||
|
||||
cd /tmp
|
||||
|
||||
if [[ $updateA2Server ]]; then
|
||||
wget -q -O /tmp/a2server-setup ivanx.com/a2server/setup/
|
||||
if ps aux | grep -q [s]mbd; then
|
||||
source /tmp/a2server-setup -y -r -w
|
||||
else
|
||||
source /tmp/a2server-setup -y -r
|
||||
fi
|
||||
echo
|
||||
echo "*** A2SERVER update completed. ***"
|
||||
echo
|
||||
fi
|
||||
|
||||
cd "$origDir"
|
||||
|
||||
if [[ ! $autoYes ]]; then
|
||||
echo
|
||||
echo
|
||||
echo "Your system has been updated and needs to reboot to use its new software."
|
||||
echo
|
||||
echo -n "Reboot now (recommended)? "
|
||||
read
|
||||
if [[ ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
|
||||
sudo shutdown -r now
|
||||
fi
|
||||
else
|
||||
echo "*** raspbian-update completed. ***"
|
||||
sudo shutdown -r now
|
||||
fi
|
||||
@@ -2,17 +2,17 @@
|
||||
# vim: set tabstop=4 shiftwidth=4 expandtab filetype=sh:
|
||||
|
||||
alias a2server-help="more /usr/local/etc/a2server-help.txt"
|
||||
alias a2server-setup="wget -q -O /tmp/a2server-setup ${A2SERVER_SCRIPT_URL:-http://appleii.ivanx.com/a2server}$([[ "$A2SERVER_SCRIPT_URL" == */ ]] || echo -n "/")setup/ || { echo \"Can't download A2SERVER setup scripts. Do you has internet?\"; false; } && source /tmp/a2server-setup"
|
||||
alias a2server-setup="wget -q -O /tmp/a2server-setup ${A2SERVER_SCRIPT_URL}setup/index.txt || { echo \"Can't download A2SERVER setup scripts. Do you has internet?\"; false; } && source /tmp/a2server-setup"
|
||||
|
||||
alias a2server-version="cat /usr/local/etc/A2SERVER-version"
|
||||
alias a2server-update="wget -q -O /tmp/a2server-update ${A2SERVER_SCRIPT_URL:-http://appleii.ivanx.com/a2server}$([[ "$A2SERVER_SCRIPT_URL" == */ ]] || echo -n "/")update/ || { echo \"Can't download A2SERVER setup scripts. Do you has internet?\"; false; } && source /tmp/a2server-update"
|
||||
alias a2server-update="wget -q -O /tmp/a2server-update ${A2SERVER_SCRIPT_URL}update/index.txt || { echo \"Can't download A2SERVER setup scripts. Do you has internet?\"; false; } && source /tmp/a2server-update"
|
||||
|
||||
alias system-shutdown='sudo shutdown -h now'
|
||||
alias system-restart='sudo shutdown -r now'
|
||||
|
||||
|
||||
alias raspi-config='[[ -f /usr/bin/raspi-config ]] && sudo /usr/bin/raspi-config || echo "raspi-config not found. Are you using a Raspberry Pi with Raspbian?"'
|
||||
alias raspbian-update='wget -qO /tmp/raspbian-update ivanx.com/a2server/files/raspbian-update.txt; source /tmp/raspbian-update'
|
||||
alias raspbian-update='wget -qO /tmp/raspbian-update ${A2SERVER_SCRIPT_URL}scripts/raspbian-update.txt; source /tmp/raspbian-update'
|
||||
alias rasppleii-update='raspbian-update a2cloud a2server'
|
||||
|
||||
alias welcome-message-edit='sudo nano /etc/motd'
|
||||
@@ -24,8 +24,8 @@ alias showmac-wifi='ifconfig wlan0 | grep "HWaddr" | cut -dH -f2 | cut -c7-23'
|
||||
alias ifreset='sudo rm /etc/udev/rules.d/70-persistent-net.rules; echo Interfaces removed. You should system-restart now.'
|
||||
|
||||
alias netatalk-stop="sudo /etc/init.d/netatalk stop; bonjour-off"
|
||||
alias netatalk-start="sudo /etc/init.d/netatalk start; bonjour-on"
|
||||
alias netatalk-restart="sudo /etc/init.d/netatalk restart; bonjour-on"
|
||||
alias netatalk-start="sudo /etc/init.d/netatalk start; bonjour-on; grep -q 'ATALKD_RUN=yes' /etc/default/netatalk"
|
||||
alias netatalk-restart="sudo /etc/init.d/netatalk restart; bonjour-on; grep -q 'ATALKD_RUN=yes' /etc/default/netatalk"
|
||||
alias netatalk-off='sudo /etc/init.d/netatalk stop; bonjour-off; sudo update-rc.d -f netatalk remove &> /dev/null'
|
||||
alias netatalk-on='sudo update-rc.d netatalk defaults &> /dev/null; bonjour-on; sudo /etc/init.d/netatalk restart'
|
||||
|
||||
@@ -42,13 +42,13 @@ alias netatalk-wifi='sudo sed -i 's/^eth0/wlan0/' /usr/local/etc/netatalk/atalkd
|
||||
|
||||
|
||||
|
||||
alias appletalk-off='sudo sed -i "s/ATALKD_RUN=yes/ATALKD_RUN=no/" /etc/default/netatalk; sudo /etc/init.d/netatalk restart'
|
||||
alias appletalk-off='sudo sed -i "s/ATALKD_RUN=yes/ATALKD_RUN=no/" /etc/default/netatalk; sudo killall macipgw > /dev/null; /etc/init.d/netatalk restart'
|
||||
alias appletalk-on='sudo sed -i "s/ATALKD_RUN=no/ATALKD_RUN=yes/" /etc/default/netatalk; sudo /etc/init.d/netatalk restart'
|
||||
|
||||
|
||||
NETATALK="/usr/local/etc/netatalk"
|
||||
A2FILES="/media/A2SHARED/A2FILES"
|
||||
GSFILES="/media/A2SHARED/GSFILES"
|
||||
A2FILES="/srv/A2SERVER/A2FILES"
|
||||
GSFILES="/srv/A2SERVER/GSFILES"
|
||||
|
||||
alias netboot-gsos="mkatinit -gs -d -f"
|
||||
alias netboot-gsos-guest="mkatinit -gs -d -f guest"
|
||||
@@ -69,8 +69,8 @@ alias samba-stop='sudo /etc/init.d/samba stop'
|
||||
alias samba-start='sudo /etc/init.d/samba start'
|
||||
alias samba-restart='sudo /etc/init.d/samba restart'
|
||||
|
||||
alias a2files-share="sudo sed -i 's/^#share2/\/media\/A2SHARED\/A2FILES\ A2FILES options:prodos ea:ad/' /usr/local/etc/netatalk/AppleVolumes.default; [[ -d /media/A2SHARED/A2FILES ]] || mkdir /media/A2SHARED/A2FILES"
|
||||
alias a2files-unshare="sudo sed -i 's/^\/media\/A2SHARED\/A2FILES.*$/#share2/' /usr/local/etc/netatalk/AppleVolumes.default"
|
||||
alias a2files-share="sudo sed -i 's/^#share2/\/srv\/A2SERVER\/A2FILES\ A2FILES options:prodos ea:ad/' /usr/local/etc/netatalk/AppleVolumes.default; [[ -d /srv/A2SERVER/A2FILES ]] || mkdir /srv/A2SERVER/A2FILES"
|
||||
alias a2files-unshare="sudo sed -i 's/^\/srv\/A2SERVER\/A2FILES.*$/#share2/' /usr/local/etc/netatalk/AppleVolumes.default"
|
||||
|
||||
alias showalias="alias | cut -d= -f 1 | cut -d' ' -f2 | more"
|
||||
|
||||
|
||||
6
scripts/tools/a2serverrc.txt
Executable file
6
scripts/tools/a2serverrc.txt
Executable file
@@ -0,0 +1,6 @@
|
||||
#! /bin/bash
|
||||
# vim: set tabstop=4 shiftwidth=4 expandtab filetype=sh:
|
||||
|
||||
export A2SERVER_SCRIPT_URL="${A2SERVER_SCRIPT_URL:-http://ivanx.com/a2server/}"
|
||||
export A2SERVER_BINARY_URL="${A2SERVER_BINARY_URL:-http://ivanx.com/a2server/files/}"
|
||||
source /usr/local/etc/a2server-aliases
|
||||
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# -v will silently create a .volinfo file if none exists.
|
||||
# If a path is specified, only that volume is synced; otherwise, all
|
||||
# all paths in /media which appear in
|
||||
# all paths in /srv/A2SERVER which appear in
|
||||
# /usr/local/etc/netatalk/AppleVolumes.default are synced.
|
||||
|
||||
processPath () {
|
||||
@@ -108,7 +108,7 @@ else
|
||||
# (as opposed to defaulting to casefold:toupper previously)
|
||||
processPath 1
|
||||
else
|
||||
grep ^/media /usr/local/etc/netatalk/AppleVolumes.default | \
|
||||
grep ^/srv/A2SERVER /usr/local/etc/netatalk/AppleVolumes.default | \
|
||||
while read line; do
|
||||
[[ $(echo $line | grep toupper) ]]; nocasefold=$?
|
||||
sharepath=$(echo $line | cut -d" " -f1)
|
||||
|
||||
@@ -333,7 +333,8 @@ def processEntry(arg1, arg2):
|
||||
g.activeFileName = getFileName(arg1 ,arg2).decode("L1")
|
||||
g.activeFileSize = getFileLength(arg1, arg2)
|
||||
|
||||
if ((not g.PDOSPATH_INDEX) or (g.activeFileName == g.PDOSPATH_SEGMENT)):
|
||||
if ((not g.PDOSPATH_INDEX) or
|
||||
(g.activeFileName.upper() == g.PDOSPATH_SEGMENT.upper())):
|
||||
|
||||
if (getStorageType(arg1, arg2) == 13): # if ProDOS directory
|
||||
if not g.PDOSPATH_INDEX:
|
||||
|
||||
@@ -49,7 +49,7 @@ else
|
||||
if [[ $1 ]]; then
|
||||
sharepath=$(readlink -m $1)
|
||||
else
|
||||
sharepath=$(grep ^/media /usr/local/etc/netatalk/AppleVolumes.default | tail -1 | cut -d" " -f1)
|
||||
sharepath=$(grep ^/srv/A2SERVER /usr/local/etc/netatalk/AppleVolumes.default | tail -1 | cut -d" " -f1)
|
||||
fi
|
||||
|
||||
volinfo=$sharepath/.AppleDesktop/.volinfo
|
||||
|
||||
@@ -4,30 +4,41 @@
|
||||
# A2SERVER master setup script, last update 17-Nov-15
|
||||
# it downloads and executes several scripts related to the setup of
|
||||
# netatalk configured for Apple II use on Debian or Raspbian.
|
||||
# more info is at http://appleii.ivanx.com/a2server
|
||||
# more info is at http://ivanx.com/a2server
|
||||
|
||||
# to download and execute, type:
|
||||
# wget appleii.ivanx.com/a2server/setup; source setup
|
||||
# wget ivanx.com/a2server/setup; source setup
|
||||
|
||||
a2serverVersion="127"
|
||||
a2serverVersion="128"
|
||||
|
||||
# Ensure URL we'll use ends in a /
|
||||
case "$A2SERVER_SCRIPT_URL" in
|
||||
*/) scriptURL="$A2SERVER_SCRIPT_URL" ;;
|
||||
*) scriptURL="${A2SERVER_SCRIPT_URL:-http://appleii.ivanx.com/a2server}/" ;;
|
||||
*) scriptURL="${A2SERVER_SCRIPT_URL:-http://ivanx.com/a2server}/" ;;
|
||||
esac
|
||||
case "$A2SERVER_BINARY_URL" in
|
||||
*/) binaryURL="$A2SERVER_BINARY_URL" ;;
|
||||
*) binaryURL="${A2SERVER_BINARY_URL:-http://ivanx.com/a2server/files}/" ;;
|
||||
esac
|
||||
useExternalURL=1
|
||||
[[ $A2SERVER_NO_EXTERNAL ]] && useExternalURL=
|
||||
|
||||
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
|
||||
lsb_release -a 2> /dev/null | grep -q 'Distributor ID:.Debian' && [[ ( -f /etc/debian_version ) && ( $(cut -c 1 < /etc/debian_version) -ge "7" ) ]] && isDebian=1
|
||||
|
||||
if [[ -f /usr/local/etc/A2SERVER-version ]]; then
|
||||
echo "A2SERVER version available: $a2serverVersion"
|
||||
echo "A2SERVER version installed: $(cat /usr/local/etc/A2SERVER-version)"
|
||||
fi
|
||||
|
||||
echo
|
||||
[[ $scriptURL != *"ivanx.com"* ]] && echo "Using script URL: $scriptURL"
|
||||
[[ $binaryURL != *"ivanx.com"* ]] && echo "Using binary URL: $binaryURL"
|
||||
[[ ! $useExternalURL ]] && echo -e "Not using external URLs. Payloads must be in:\n ${binaryURL}external\n (See A2SERVER developer page for more information.)"
|
||||
|
||||
skipRepoUpdate=
|
||||
autoAnswerYes=
|
||||
setupNetBoot=
|
||||
@@ -78,12 +89,12 @@ done
|
||||
|
||||
if [[ $updateRasppleII ]]; then
|
||||
echo "A2SERVER: Updating Raspple II (takes up to an hour)..."
|
||||
wget -qO /tmp/raspbian-update "http://appleii.ivanx.com/a2server/files/raspbian-update.txt"
|
||||
wget -qO /tmp/raspbian-update "${A2SERVER_SCRIPT_URL}scripts/raspbian-update.txt"
|
||||
source /tmp/raspbian-update a2cloud a2server $autoAnswerYes $skipRepoUpdate
|
||||
[[ $0 == "-bash" ]] && return 0 || exit 0
|
||||
fi
|
||||
|
||||
if { [[ -f /usr/local/etc/A2SERVER-version ]] && (( $(cat /usr/local/etc/A2SERVER-version) < 110 )); }; then
|
||||
if { [[ -f /usr/local/etc/A2SERVER-version ]] && (( $(head -c 3 /usr/local/etc/A2SERVER-version) < 110 )); }; then
|
||||
echo
|
||||
echo "WARNING: The current A2SERVER installer scripts haven't been tested for"
|
||||
echo "updating the earlier version of A2SERVER that you have. A fresh install"
|
||||
@@ -100,19 +111,33 @@ if [[ $isRpi ]]; then #supported Raspbian? (16-Feb-15, 20-Jun-14, 09-Jan-14, etc
|
||||
fwsupported="-8aca5762- -462f3e3f476f7b6- -c32bc633039cd9- -9d34d0475f9-
|
||||
-d4f5315cfac4e- -6f4a90c8cb8817f- -5dd9b4962e- -17c8799375-
|
||||
-960832a6c2590635216c296b6ee0bebf67b21d50-"
|
||||
[[ "$fwsupported" == *-$fwhash-* ]] && unsupportedOS=0
|
||||
[[ ($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)" == "7.3" || "$(lsb_release -rs 2> /dev/null)" == "7.6" || "$(lsb_release -rs 2> /dev/null)" == "7.8" ]]; then # tested Debian?
|
||||
unsupportedOS=0
|
||||
[[ "$fwsupported" == *-$fwhash-* ]] && unsupportedOS=
|
||||
# [[ ($fwhash == "8aca5762") || ($fwhash == "462f3e3f476f7b6") || ($fwhash == "c32bc633039cd9") || ($fwhash == "9d34d0475f9") || ($fwhash == "d4f5315cfac4e") || ($fwhash == "6f4a90c8cb8817f") || ($fwhash == "5dd9b4962e") || ($fwhash == "17c8799375") ]] && unsupportedOS=
|
||||
elif [[ $isDebian ]]; then # supported Debian?
|
||||
debianVersion=$(cat /etc/debian_version)
|
||||
debianSupported="-8.2- -7.9- -7.8- -7.6- -7.3-"
|
||||
[[ $debianSupported == *-$debianVersion-* ]] && unsupportedOS=
|
||||
fi
|
||||
|
||||
if (( unsupportedOS )); then
|
||||
if [[ $unsupportedOS && $isRpi ]]; then
|
||||
echo
|
||||
echo "WARNING: A2SERVER and its installer scripts have not been tested on this"
|
||||
echo "operating system version. Continuing is probably fine, but might not be."
|
||||
echo "A2SERVER and its installer scripts have been tested on Raspbian Wheezy and"
|
||||
echo "Jessie, though not this specific firmware version ($fwhash). Just FYI."
|
||||
unsupportedOS=
|
||||
elif [[ $unsupportedOS && $isDebian ]]; then
|
||||
echo
|
||||
echo "A2SERVER and its installer scripts have been tested on Debian 7 and 8,"
|
||||
echo "though not this specific point release ($debianVersion). Just FYI."
|
||||
unsupportedOS=
|
||||
fi
|
||||
|
||||
if [[ $unsupportedOS ]]; then
|
||||
echo
|
||||
echo "WARNING: A2SERVER and its installer scripts have only been tested on"
|
||||
echo "Debian and Raspbian. 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://ivanx.com/a2server."
|
||||
fi
|
||||
|
||||
doSetup=1
|
||||
@@ -132,7 +157,7 @@ if (( $doSetup )); then
|
||||
|
||||
echo
|
||||
echo "a2server-setup modifies files and performs actions as the root user."
|
||||
echo "For details, visit http://appleii.ivanx.com/a2server."
|
||||
echo "For details, visit http://ivanx.com/a2server."
|
||||
echo
|
||||
if [[ ! $autoAnswerYes ]]; then
|
||||
echo -n "Continue? "
|
||||
@@ -212,11 +237,11 @@ if (( $doSetup )); then
|
||||
rm /tmp/a2server-packageReposUpdated &> /dev/null
|
||||
|
||||
if [[ ! -f /usr/local/etc/A2SERVER-version ]] \
|
||||
|| (( $(cat /usr/local/etc/A2SERVER-version) < "$a2serverVersion" )); then
|
||||
|| (( $(head -c 3 /usr/local/etc/A2SERVER-version) < ${a2serverVersion:0:3} )); then
|
||||
echo "$a2serverVersion" | sudo tee /usr/local/etc/A2SERVER-version &> /dev/null
|
||||
fi
|
||||
|
||||
source /usr/local/etc/a2server-aliases
|
||||
source /usr/local/etc/a2serverrc
|
||||
|
||||
# get Kernel release (e.g. 3.6.11+) and version (e.g. #557)
|
||||
kernelRelease=$(uname -r)
|
||||
@@ -230,7 +255,19 @@ if (( $doSetup )); then
|
||||
echo "On an Apple IIe, it should be accessible via \"Log In\" on the"
|
||||
echo "Workstation Card software. For IIgs users, it should be accessible"
|
||||
echo "via the AppleShare control panel."
|
||||
echo
|
||||
if [[ -f /srv/A2SERVER/A2FILES/System/Start.GS.OS ]]; then
|
||||
echo
|
||||
echo "You can network boot GS/OS. On a ROM 01 IIgs, set slot 1 or 2, and slot 7,"
|
||||
echo 'to AppleTalk, and Startup Slot to 7 or "Scan". On a ROM 3 IIgs, set'
|
||||
echo "slot 1 or 2, and startup slot, to AppleTalk."
|
||||
fi
|
||||
if [[ -f /srv/A2SERVER/A2FILES/BASIC.System ]]; then
|
||||
echo
|
||||
echo "You can network boot ProDOS 8. On an Apple IIe, put your Workstation Card"
|
||||
echo "in a slot above your disk controller card, or type PR#X with open-apple"
|
||||
echo "held down, with X being the slot of your Workstation Card."
|
||||
echo 'On a IIgs, press "8" during the initial procession of periods.'
|
||||
fi
|
||||
echo
|
||||
echo "A2SERVER setup is complete! Go connect from your Apple II!"
|
||||
echo
|
||||
@@ -266,9 +303,18 @@ if (( $doSetup )); then
|
||||
echo "by typing 'appletalk-on'."
|
||||
echo
|
||||
fi
|
||||
|
||||
if [[ -f /tmp/noMacIP ]]; then
|
||||
echo
|
||||
echo "MacIP connections may be unavailable. If you know how, try"
|
||||
echo "recompiling the AppleTalk kernel module with IPDDP options disabled."
|
||||
echo
|
||||
rm /tmp/noMacIP
|
||||
fi
|
||||
|
||||
if [[ -f /tmp/singleUser ]]; then
|
||||
if [[ ! $autoAnswerYes ]]; then
|
||||
echo
|
||||
echo "Your Raspberry Pi was started in single-user mode in order to"
|
||||
echo -n "fix a problem. You should restart to operate normally. Restart now? "
|
||||
read
|
||||
@@ -279,6 +325,7 @@ if (( $doSetup )); then
|
||||
echo "A2SERVER: Preparing to restart..."
|
||||
while :; do sleep 60; done
|
||||
fi
|
||||
rm /tmp/singleUser
|
||||
echo
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
#! /bin/bash
|
||||
# vim: set tabstop=4 shiftwidth=4 expandtab filetype=sh:
|
||||
|
||||
currentVersion=127
|
||||
# Ensure URL we'll use ends in a /
|
||||
case "$A2SERVER_SCRIPT_URL" in
|
||||
*/) scriptURL="$A2SERVER_SCRIPT_URL" ;;
|
||||
*) scriptURL="${A2SERVER_SCRIPT_URL:-http://ivanx.com/a2server}/" ;;
|
||||
esac
|
||||
|
||||
currentVersion=$(wget -qO- "${scriptURL}setup/index.txt" | grep '^a2serverVersion' | cut -d '"' -f 2)
|
||||
|
||||
if [[ -f /usr/local/etc/A2SERVER-version ]]; then
|
||||
installedVersion=$(cat /usr/local/etc/A2SERVER-version)
|
||||
@@ -9,12 +15,6 @@ else
|
||||
installedVersion=100
|
||||
fi
|
||||
|
||||
# Ensure URL we'll use ends in a /
|
||||
case "$A2SERVER_SCRIPT_URL" in
|
||||
*/) scriptURL="$A2SERVER_SCRIPT_URL" ;;
|
||||
*) scriptURL="${A2SERVER_SCRIPT_URL:-http://appleii.ivanx.com/a2server}/" ;;
|
||||
esac
|
||||
|
||||
autoAnswerYes=
|
||||
for arg in $@; do
|
||||
if [[ $arg == "-y" ]]; then
|
||||
@@ -39,7 +39,7 @@ fi
|
||||
if [[ ${REPLY:0:1} == "y" || ${REPLY:0:1} == "Y" ]]; then
|
||||
sudo rm /usr/local/etc/A2SERVER-version &> /dev/null
|
||||
# sudo rm /usr/local/etc/netatalk/a2boot/* &> /dev/null
|
||||
wget -q -O /tmp/setup "${scriptURL}setup"; source /tmp/setup "$@"
|
||||
wget -q -O /tmp/setup "${scriptURL}setup/index.txt"; source /tmp/setup "$@"
|
||||
fi
|
||||
|
||||
unset currentVersion 2> /dev/null
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
1.2.4: Jul 2015: offer to download A2CLOUD disk contents onto A2FILES volume
|
||||
|
||||
1.2.4+:Oct 2015: support for using A2SERVER scripts from a location other than
|
||||
appleii.ivanx.com/a2server for development purposes
|
||||
ivanx.com/a2server for development purposes
|
||||
[not released]
|
||||
|
||||
1.2.5: Nov 2015: netboot install option for GS/OS 6.0.2/3
|
||||
@@ -79,3 +79,13 @@
|
||||
and TEACH are installed with netboot installation; minor bug
|
||||
fixes and tweaks
|
||||
[not released]
|
||||
|
||||
1.2.8: Dec 2015: moved /media/A2SHARED to /srv/A2SERVER
|
||||
macipgw installed
|
||||
files subdirectory reorganized
|
||||
64-bit Debian binaries
|
||||
A2SERVER_SCRIPT_URL now works everywhere
|
||||
A2SERVER_BINARY_URL can now be specified
|
||||
self-hosted binaries fallback, or preferred with A2SERVER_NO_EXTERNAL
|
||||
better information at start and end of install
|
||||
[not released]
|
||||
|
||||
Reference in New Issue
Block a user