mirror of
https://github.com/RasppleII/a2server.git
synced 2025-08-08 02:25:19 +00:00
Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
e499a3db46 | ||
|
5010a496e6 | ||
|
a033151c66 | ||
|
f9b11b6dde | ||
|
98ed939e9f | ||
|
f1b141bd9c | ||
|
d71b2a4048 | ||
|
16e1306dbb | ||
|
7d3ae1d200 | ||
|
6229dba43f | ||
|
f3ae970d37 |
79
install.sh
79
install.sh
@@ -8,21 +8,74 @@
|
|||||||
# scripts themselves. Software used or installed by these scripts is subject
|
# scripts themselves. Software used or installed by these scripts is subject
|
||||||
# to other licenses. This work is published from the United States.
|
# to other licenses. This work is published from the United States.
|
||||||
|
|
||||||
a2serverVersion="1.9.0"
|
a2serverVersion="1.9.0" # Leave this quoted!
|
||||||
a2sScriptURL="https://raw.githubusercontent.com/RasppleII/a2server/master"
|
|
||||||
|
|
||||||
# Find the path of our source directory
|
if test "x$BASH" = "x"; then
|
||||||
a2sSource="$( dirname "${BASH_SOURCE[0]}" )"
|
printf "This script requires bash. Please run\nit as ./install.sh from the source\ndirectory.\n"
|
||||||
echo $a2source
|
|
||||||
pushd $a2sSource >/dev/null
|
|
||||||
a2sSource="$PWD"
|
|
||||||
popd >/dev/null
|
|
||||||
if [[ ! -f "$a2sSource/.a2server_source" ]]; then
|
|
||||||
printf "\na2server: cannot find a2server source directory in $a2sSource.\n\n"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run the legacy setup script for anything not yet ported
|
# Find the path of our source directory
|
||||||
if [[ -e "${a2sSource}/setup/ivan.sh" ]]; then
|
top_src="$( dirname "${BASH_SOURCE[0]}" )"
|
||||||
"${a2sSource}/setup/ivan.sh" "$@"
|
pushd $top_src >/dev/null
|
||||||
|
top_src="$PWD"
|
||||||
|
popd >/dev/null
|
||||||
|
if [[ ! -f "$top_src/.a2server_source" ]]; then
|
||||||
|
printf "\na2server: cannot find a2server source directory in $top_src.\n\n"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
noPicoPkg=
|
||||||
|
autoAnswerYes=
|
||||||
|
|
||||||
|
process_args() {
|
||||||
|
while [[ $1 ]]; do
|
||||||
|
if [[ $1 == "-c" ]]; then
|
||||||
|
shift
|
||||||
|
noPicoPkg="-c"
|
||||||
|
elif [[ $1 == "-y" ]]; then
|
||||||
|
shift
|
||||||
|
autoAnswerYes="-y"
|
||||||
|
else
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
process_args "$@"
|
||||||
|
|
||||||
|
# FIXME: Show version, changes, config, allow reconfig, etc…
|
||||||
|
"$top_src/scripts/show_changes"
|
||||||
|
cat <<EOF
|
||||||
|
|
||||||
|
Your system will be set up for a2server, providing you with
|
||||||
|
AppleTalk for your Apple IIgs/IIe and Macintosh systems using
|
||||||
|
netatalk, as well as SMB via Samba.
|
||||||
|
|
||||||
|
If a2server is already installed, it will be upgraded to the
|
||||||
|
latest version. It would sure be handy if we had an up to
|
||||||
|
date website to send you to for details. You should harass
|
||||||
|
iKarith about that if you haven't recently.
|
||||||
|
|
||||||
|
A full installation could take quite awhile on very low-end
|
||||||
|
systems like the Raspberry Pi Zero.
|
||||||
|
|
||||||
|
Also, some actions will need to be performed as the root
|
||||||
|
(administrator) user. We are assuming you have access to the
|
||||||
|
sudo command for that.
|
||||||
|
EOF
|
||||||
|
if [[ ! $autoAnswerYes ]]; then
|
||||||
|
printf "\nContinue? "
|
||||||
|
read
|
||||||
|
if [[ ${REPLY:0:1} != "Y" && ${REPLY:0:1} != "y" ]]; then
|
||||||
|
[[ $0 == "-bash" ]] && return 2 || exit 2
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Fix any mistakes we've made in previous versions
|
||||||
|
. "$top_src/scripts/fixup"
|
||||||
|
|
||||||
|
# Run the legacy setup script for anything not yet ported
|
||||||
|
if [[ -e "${top_src}/setup/ivan.sh" ]]; then
|
||||||
|
"${top_src}/setup/ivan.sh" "$@"
|
||||||
fi
|
fi
|
||||||
|
@@ -2,24 +2,10 @@
|
|||||||
# vim: set tabstop=4 shiftwidth=4 noexpandtab filetype=sh:
|
# vim: set tabstop=4 shiftwidth=4 noexpandtab filetype=sh:
|
||||||
|
|
||||||
# --- Setting up the share volume
|
# --- 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
|
|
||||||
if [[ -f /etc/samba/smbd.conf ]]; then
|
|
||||||
sudo sed -i 's|/media/A2SHARED|/srv/A2SERVER|g' /etc/samba/smbd.conf
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -d /srv/A2SERVER ]]; then
|
if [[ ! -d /srv/A2SERVER ]]; then
|
||||||
echo "A2SERVER: Preparing the shared files volume..."
|
echo "A2SERVER: Preparing the shared files volume..."
|
||||||
sudo mkdir -p /srv/A2SERVER
|
mygroup="$(id -ng)"
|
||||||
sudo chown $USER:$USER /srv/A2SERVER
|
sudo install -d -m 755 -u "$USER" -g "$mygroup" "/srv/A2SERVER"
|
||||||
else
|
else
|
||||||
echo "A2SERVER: Shared volume is already prepared for use."
|
echo "A2SERVER: Shared volume is already prepared for use."
|
||||||
fi
|
fi
|
||||||
|
@@ -8,12 +8,12 @@ a2sScriptURL="https://raw.githubusercontent.com/RasppleII/a2server/master"
|
|||||||
a2sBinaryURL="http://blocksfree.com/downloads"
|
a2sBinaryURL="http://blocksfree.com/downloads"
|
||||||
|
|
||||||
# Find the path of our source directory
|
# Find the path of our source directory
|
||||||
a2sSource="$( dirname "${BASH_SOURCE[0]}" )/.."
|
top_src="$( dirname "${BASH_SOURCE[0]}" )/.."
|
||||||
pushd $a2sSource >/dev/null
|
pushd $top_src >/dev/null
|
||||||
a2sSource="$PWD"
|
top_src="$PWD"
|
||||||
popd >/dev/null
|
popd >/dev/null
|
||||||
if [[ ! -f "$a2sSource/.a2server_source" ]]; then
|
if [[ ! -f "$top_src/.a2server_source" ]]; then
|
||||||
printf "\na2server: cannot find a2server source directory in $a2sSource.\n\n"
|
printf "\na2server: cannot find a2server source directory in $top_src.\n\n"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -184,13 +184,13 @@ a2sTools="afpsync afptype mkatinit mkvolinfo cppo debupdate"
|
|||||||
a2sHelp="a2server-help.txt"
|
a2sHelp="a2server-help.txt"
|
||||||
a2sConfScripts="a2server-aliases a2serverrc"
|
a2sConfScripts="a2server-aliases a2serverrc"
|
||||||
for _tool in $a2sTools; do
|
for _tool in $a2sTools; do
|
||||||
sudo install -m 755 "$a2sSource/scripts/tools/$_tool" "/usr/local/bin/$_tool"
|
sudo install -m 755 "$top_src/scripts/tools/$_tool" "/usr/local/bin/$_tool"
|
||||||
done
|
done
|
||||||
for _help in $a2sHelp; do
|
for _help in $a2sHelp; do
|
||||||
sudo install -m 644 "$a2sSource/scripts/tools/$_help" "/usr/local/etc/$_help"
|
sudo install -m 644 "$top_src/scripts/tools/$_help" "/usr/local/etc/$_help"
|
||||||
done
|
done
|
||||||
for _confscript in $a2sConfScripts; do
|
for _confscript in $a2sConfScripts; do
|
||||||
sudo install -m 755 "$a2sSource/scripts/tools/$_confscript" "/usr/local/etc/$_tool"
|
sudo install -m 755 "$top_src/scripts/tools/$_confscript" "/usr/local/etc/$_tool"
|
||||||
done
|
done
|
||||||
|
|
||||||
# 1.3.0: a2serverrc is now called from /etc/bash.bashrc,
|
# 1.3.0: a2serverrc is now called from /etc/bash.bashrc,
|
||||||
|
@@ -48,7 +48,7 @@ if [[ -f /usr/local/etc/A2SERVER-version ]]; then
|
|||||||
read a2sVersion </usr/local/etc/A2SERVER-version
|
read a2sVersion </usr/local/etc/A2SERVER-version
|
||||||
fi
|
fi
|
||||||
# If A2SERVER 101 or greater is installed, we already did this and can skip it.
|
# If A2SERVER 101 or greater is installed, we already did this and can skip it.
|
||||||
if [[ "$a2sVersion" != *.*.* && "$a2sVersion" -lt 101 ]]; then
|
if [[ "$a2sVersion" != *.*.* || "$a2sVersion" -lt 101 ]]; then
|
||||||
echo "A2SERVER: Installing Netatalk (this will take a while)..."
|
echo "A2SERVER: Installing Netatalk (this will take a while)..."
|
||||||
# stop Netatalk and samba if running (during upgrade)
|
# stop Netatalk and samba if running (during upgrade)
|
||||||
if [[ $(ps --no-headers -C afpd) ]]; then
|
if [[ $(ps --no-headers -C afpd) ]]; then
|
||||||
|
@@ -11,12 +11,12 @@ a2sScriptURL="https://raw.githubusercontent.com/RasppleII/a2server/master"
|
|||||||
a2sBinaryURL="http://blocksfree.com/downloads"
|
a2sBinaryURL="http://blocksfree.com/downloads"
|
||||||
|
|
||||||
# Find the path of our source directory
|
# Find the path of our source directory
|
||||||
a2sSource="$( dirname "${BASH_SOURCE[0]}" )/.."
|
top_src="$( dirname "${BASH_SOURCE[0]}" )/.."
|
||||||
pushd $a2sSource >/dev/null
|
pushd $top_src >/dev/null
|
||||||
a2sSource="$PWD"
|
top_src="$PWD"
|
||||||
popd >/dev/null
|
popd >/dev/null
|
||||||
if [[ ! -f "$a2sSource/.a2server_source" ]]; then
|
if [[ ! -f "$top_src/.a2server_source" ]]; then
|
||||||
printf "\na2server: cannot find a2server source directory in $a2sSource.\n\n"
|
printf "\na2server: cannot find a2server source directory in $top_src.\n\n"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -263,7 +263,7 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
|
|||||||
|| [[ ! -f /usr/local/bin/mkvolinfo ]] \
|
|| [[ ! -f /usr/local/bin/mkvolinfo ]] \
|
||||||
|| [[ ! -f /usr/local/bin/afpsync ]] \
|
|| [[ ! -f /usr/local/bin/afpsync ]] \
|
||||||
|| [[ ! -f /usr/local/bin/cppo ]]; then
|
|| [[ ! -f /usr/local/bin/cppo ]]; then
|
||||||
"$a2sSource/scripts/a2server-2-tools.txt"
|
"$top_src/scripts/a2server-2-tools.txt"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# put BASIC.SYSTEM at root for ProDOS 8 startup
|
# put BASIC.SYSTEM at root for ProDOS 8 startup
|
||||||
@@ -522,7 +522,7 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
|
|||||||
echo "A2SERVER: Updating ProDOS 8 Thunderclock driver year table..."
|
echo "A2SERVER: Updating ProDOS 8 Thunderclock driver year table..."
|
||||||
mkdir -p /tmp/netboot
|
mkdir -p /tmp/netboot
|
||||||
rm -r /tmp/netboot/* 2> /dev/null
|
rm -r /tmp/netboot/* 2> /dev/null
|
||||||
p8ClockPatch="$a2sSource/scripts/clock.patch.py"
|
p8ClockPatch="$top_src/scripts/clock.patch.py"
|
||||||
updateP8YearTables $(python $p8ClockPatch $(LANG=C date +"%a %m/%d/%y"))
|
updateP8YearTables $(python $p8ClockPatch $(LANG=C date +"%a %m/%d/%y"))
|
||||||
|
|
||||||
gsosInstalled=""
|
gsosInstalled=""
|
||||||
|
69
scripts/fixup
Executable file
69
scripts/fixup
Executable file
@@ -0,0 +1,69 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
# vim: set tabstop=4 shiftwidth=4 noexpandtab filetype=sh:
|
||||||
|
|
||||||
|
# fixup - correct any mistakes from previous versions
|
||||||
|
#
|
||||||
|
# To the extent possible under law, T. Joseph Carter and Ivan Drucker have
|
||||||
|
# waived all copyright and related or neighboring rights to the a2server
|
||||||
|
# scripts themselves. Software used or installed by these scripts is subject
|
||||||
|
# to other licenses. This work is published from the United States.
|
||||||
|
|
||||||
|
# The idea behind this script is to prevent other scripts from becoming a
|
||||||
|
# minefield of ancient and deprecated code designed to compensate for other
|
||||||
|
# even more ancient and replaced code that is no longer needed, no longer
|
||||||
|
# useful, and honestly complicates maintenance of that code. Everything here
|
||||||
|
# will explain what it does, when it was put here, and it should remain clear
|
||||||
|
# when the legacy code may be removed.
|
||||||
|
#
|
||||||
|
# The use of functions which get immediately called is to try and prevent the
|
||||||
|
# long spidery conditional blocks a2cloud was originally known for.
|
||||||
|
|
||||||
|
# # Added 2000-00-00
|
||||||
|
# fix_some_stupid_mistake()
|
||||||
|
# {
|
||||||
|
# # Needed until: Upgrades from 0.0.0 no longer supported
|
||||||
|
# :
|
||||||
|
# }
|
||||||
|
# fix_some_stupid_mistake
|
||||||
|
|
||||||
|
|
||||||
|
# Added 2018-09-07
|
||||||
|
move_media_a2shared()
|
||||||
|
{
|
||||||
|
# # Needed until: Upgrades from versions < 1.3.0 are not supported
|
||||||
|
local netatalk_restart
|
||||||
|
if [[ -d /media/A2SHARED ]]; then
|
||||||
|
cat <<-EOF
|
||||||
|
a2server: As of version 1.3.0, the standard location for
|
||||||
|
netatalk to store Apple II files is /srv/A2SERVER.
|
||||||
|
We will move /media/A2SHARED to the new location.
|
||||||
|
If you need to do that yourself (you'll know if
|
||||||
|
you do), press ctrl-c now. Otherwise press Return.
|
||||||
|
EOF
|
||||||
|
read
|
||||||
|
|
||||||
|
# netatalk doesn't much like its sharepoint just disappearing
|
||||||
|
if service netatalk status >/dev/null; then
|
||||||
|
netatalk_restart=1
|
||||||
|
sudo service netatalk stop
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Debated: Create /media/A2SHARED symlink? Nah, bad idea.
|
||||||
|
sudo mv /media/A2SHARED /srv/A2SERVER
|
||||||
|
sudo sed -i 's|/media/A2SHARED|/srv/A2SERVER|g' /usr/local/etc/netatalk/AppleVolumes.default
|
||||||
|
if [[ $netatalk_restart ]]; then
|
||||||
|
sudo service netatalk start
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Samba can just be reloaded after modifying the config
|
||||||
|
if [[ -f /etc/samba/smbd.conf ]]; then
|
||||||
|
sudo sed -i 's|/media/A2SHARED|/srv/A2SERVER|g' /etc/samba/smbd.conf
|
||||||
|
if service smbd status >/dev/null; then
|
||||||
|
sudo service smbd reload
|
||||||
|
elif service samba status >/dev/null; then
|
||||||
|
sudo service samba reload
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
move_media_a2shared
|
33
scripts/show_changes
Executable file
33
scripts/show_changes
Executable file
@@ -0,0 +1,33 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
# vim: set tabstop=4 shiftwidth=4 noexpandtab filetype=sh:
|
||||||
|
|
||||||
|
# show_changes - show a2server version differences
|
||||||
|
#
|
||||||
|
# To the extent possible under law, T. Joseph Carter and Ivan Drucker have
|
||||||
|
# waived all copyright and related or neighboring rights to the a2server
|
||||||
|
# scripts themselves. Software used or installed by these scripts is subject
|
||||||
|
# to other licenses. This work is published from the United States.
|
||||||
|
|
||||||
|
# Find the path of our source directory
|
||||||
|
top_src="$( dirname "${BASH_SOURCE[0]}" )/.."
|
||||||
|
pushd $top_src >/dev/null
|
||||||
|
top_src="$PWD"
|
||||||
|
popd >/dev/null
|
||||||
|
if [[ ! -f "$top_src/.a2server_source" ]]; then
|
||||||
|
printf "\na2server: cannot find a2server source directory in $top_src.\n\n"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
newVersion=$(grep '^a2serverVersion' "$top_src/install.sh" | cut -d '"' -f 2)
|
||||||
|
|
||||||
|
if [[ -f /usr/local/etc/A2SERVER-version ]]; then
|
||||||
|
read installedVersion </usr/local/etc/A2SERVER-version
|
||||||
|
if [[ $installedVersion != *.*.* ]]; then
|
||||||
|
# Deal with old three-digit version
|
||||||
|
installedVersion="${installedVersion:0:1}.${installedVersion:1:1}.${installedVersion:2}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo "a2server version available: $newVersion"
|
||||||
|
echo "a2server version installed: ${installedVersion:-None}"
|
||||||
|
|
||||||
|
# FIXME: Do something useful with a changelog perhaps?
|
44
scripts/system_ident
Executable file
44
scripts/system_ident
Executable file
@@ -0,0 +1,44 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
# vim: set tabstop=4 shiftwidth=4 noexpandtab filetype=sh:
|
||||||
|
|
||||||
|
# system_ident - identify your system for raspple2 if needed
|
||||||
|
#
|
||||||
|
# To the extent possible under law, T. Joseph Carter and Ivan Drucker have
|
||||||
|
# waived all copyright and related or neighboring rights to the a2server
|
||||||
|
# scripts themselves. Software used or installed by these scripts is subject
|
||||||
|
# to other licenses. This work is published from the United States.
|
||||||
|
|
||||||
|
if [[ -z $ras2_os || -z $ras2_arch ]]; then
|
||||||
|
ras2_os="unknown"
|
||||||
|
if hash lsb_release 2>/dev/null; then
|
||||||
|
if [[ -f /usr/bin/raspi-config ]]; then
|
||||||
|
ras2_os="rpi-$(lsb_release -cs)"
|
||||||
|
else
|
||||||
|
case "$(lsb_release -is)" in
|
||||||
|
Debian)
|
||||||
|
ras2_os="debian-$(lsb_release -cs)"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
printf "\nUnknown OS with lsb_release\n"
|
||||||
|
lsb_release -a
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
uname_s="$(uname -s)"
|
||||||
|
case "$uname_s" in
|
||||||
|
Darwin)
|
||||||
|
ras2_os="$uname_s"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
printf "\nUnknown OS with uname -s\n$uname_s\n"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
ras2_arch="$(uname -m)"
|
||||||
|
export ras2_os ras2_arch
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $1 != -q ]]; then
|
||||||
|
printf "ras2_os=\"%s\"\nras2_arch=\"%s\"\n" "$ras2_os" "$ras2_arch"
|
||||||
|
fi
|
@@ -12,18 +12,18 @@ a2sBranch="master"
|
|||||||
a2sScriptURL="https://raw.githubusercontent.com/RasppleII/a2server/${a2sBranch}"
|
a2sScriptURL="https://raw.githubusercontent.com/RasppleII/a2server/${a2sBranch}"
|
||||||
a2sTarball="https://github.com/RasppleII/a2server/archive/${a2sBranch}.tar.gz"
|
a2sTarball="https://github.com/RasppleII/a2server/archive/${a2sBranch}.tar.gz"
|
||||||
|
|
||||||
# Set a2sSource to the location of the source tree if we're running in one
|
# Set top_src to the location of the source tree if we're running in one
|
||||||
a2sSource="$( dirname "${BASH_SOURCE[0]}" )/.."
|
top_src="$( dirname "${BASH_SOURCE[0]}" )/.."
|
||||||
if [[ -f "$a2sSource/.a2server_source" ]]; then
|
if [[ -f "$top_src/.a2server_source" ]]; then
|
||||||
pushd $a2sSource >/dev/null
|
pushd $top_src >/dev/null
|
||||||
a2sSource="$PWD"
|
top_src="$PWD"
|
||||||
popd >/dev/null
|
popd >/dev/null
|
||||||
|
|
||||||
cat <<-EOT
|
cat <<-EOT
|
||||||
This script exists solely for backward-compatibility with IvanX's a2server
|
This script exists solely for backward-compatibility with IvanX's a2server
|
||||||
website and aliases installed by older versions. You appear to have an
|
website and aliases installed by older versions. You appear to have an
|
||||||
a2server source directory here:
|
a2server source directory here:
|
||||||
$a2sSource
|
$top_src
|
||||||
|
|
||||||
Please run ./install.sh in that directory. Thanks!
|
Please run ./install.sh in that directory. Thanks!
|
||||||
|
|
||||||
@@ -76,18 +76,18 @@ if [[ ! $autoAnswerYes ]]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
a2sSource=$(mktemp -d /tmp/a2server.XXXXXXXXXXXX)
|
top_src=$(mktemp -d /tmp/a2server.XXXXXXXXXXXX)
|
||||||
|
|
||||||
# Normally tarballs unpack in a subdirectory, but we want it to unpack into
|
# Normally tarballs unpack in a subdirectory, but we want it to unpack into
|
||||||
# $a2sSource directly (even though the directory has the tarball in it.)
|
# $top_src directly (even though the directory has the tarball in it.)
|
||||||
printf "\na2server: Downloading installer to $a2sSource.\n"
|
printf "\na2server: Downloading installer to $top_src.\n"
|
||||||
wget -O "$a2sSource/a2server-$a2sBranch.tar.gz" "$a2sTarball"
|
wget -O "$top_src/a2server-$a2sBranch.tar.gz" "$a2sTarball"
|
||||||
tar -C $a2sSource --strip-components=1 -zxf "$a2sSource/a2server-${a2sBranch}.tar.gz"
|
tar -C $top_src --strip-components=1 -zxf "$top_src/a2server-${a2sBranch}.tar.gz"
|
||||||
|
|
||||||
# Now we actually run the installer as if we were installing it by hand
|
# Now we actually run the installer as if we were installing it by hand
|
||||||
printf "\na2server: Running the installer now.\n"
|
printf "\na2server: Running the installer now.\n"
|
||||||
"${a2sSource}/install.sh" "$@"
|
"${top_src}/install.sh" "$@"
|
||||||
|
|
||||||
# Clean up and delete the installer we downloaded
|
# Clean up and delete the installer we downloaded
|
||||||
printf "\na2server: Finished with installer, now deleting ${a2sSource}.\n"
|
printf "\na2server: Finished with installer, now deleting ${top_src}.\n"
|
||||||
rm -rf "$a2sSource"
|
rm -rf "$top_src"
|
||||||
|
116
setup/ivan.sh
116
setup/ivan.sh
@@ -6,31 +6,23 @@
|
|||||||
# netatalk configured for Apple II use on Debian or Raspbian.
|
# netatalk configured for Apple II use on Debian or Raspbian.
|
||||||
# more info is at http://ivanx.com/a2server
|
# more info is at http://ivanx.com/a2server
|
||||||
|
|
||||||
a2serverVersion="1.9.0"
|
|
||||||
a2sScriptURL="https://raw.githubusercontent.com/RasppleII/a2server/master"
|
|
||||||
|
|
||||||
# Find the path of our source directory
|
# Find the path of our source directory
|
||||||
a2sSource="$( dirname "${BASH_SOURCE[0]}" )/.."
|
top_src="$( dirname "${BASH_SOURCE[0]}" )/.."
|
||||||
pushd $a2sSource >/dev/null
|
pushd $top_src >/dev/null
|
||||||
a2sSource="$PWD"
|
top_src="$PWD"
|
||||||
popd >/dev/null
|
popd >/dev/null
|
||||||
if [[ ! -f "$a2sSource/.a2server_source" ]]; then
|
if [[ ! -f "$top_src/.a2server_source" ]]; then
|
||||||
printf "\na2server: cannot find a2server source directory in $a2sSource.\n\n"
|
printf "\na2server: cannot find a2server source directory in $top_src.\n\n"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
compare_version="$a2sSource/scripts/compare_version"
|
# Make sure ras2_{os,arch} get set
|
||||||
|
. "$top_src/scripts/system_ident" -q
|
||||||
|
|
||||||
isRpi=
|
# This is now in install.sh, get it from there
|
||||||
[[ -f /usr/bin/raspi-config ]] && isRpi=1
|
a2serverVersion=$(grep '^a2serverVersion' "$top_src/install.sh" | cut -d '"' -f 2)
|
||||||
|
|
||||||
isDebian=
|
compare_version="$top_src/scripts/compare_version"
|
||||||
if [[ "$(lsb_release -ds)" = Debian* ]]; then
|
|
||||||
debianVersion="$(lsb_release -rs)"
|
|
||||||
if [[ "$debianVersion" -ge 7 || $debianVersion == [a-z]* ]]; then
|
|
||||||
isDebian=1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -f /usr/local/etc/A2SERVER-version ]]; then
|
if [[ -f /usr/local/etc/A2SERVER-version ]]; then
|
||||||
read installedVersion </usr/local/etc/A2SERVER-version
|
read installedVersion </usr/local/etc/A2SERVER-version
|
||||||
@@ -39,9 +31,7 @@ if [[ -f /usr/local/etc/A2SERVER-version ]]; then
|
|||||||
installedVersion="${installedVersion:0:1}.${installedVersion:1:1}.${installedVersion:2}"
|
installedVersion="${installedVersion:0:1}.${installedVersion:1:1}.${installedVersion:2}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo "A2SERVER version available: $a2serverVersion"
|
if [[ $installedVersion != *.*.* ]]; then
|
||||||
echo "A2SERVER version installed: ${installedVersion:=None}"
|
|
||||||
if [[ $installedVersion == "None" ]]; then
|
|
||||||
installedVersion=0
|
installedVersion=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -113,46 +103,32 @@ fi
|
|||||||
a2server_update=0
|
a2server_update=0
|
||||||
doSetup=1
|
doSetup=1
|
||||||
|
|
||||||
if "$compare_version" $installedVersion lt 1.5.2; then
|
if [[ "$installedVersion" != "0" ]] && "$compare_version" $installedVersion lt 1.5.2; then
|
||||||
a2server_update=1
|
a2server_update=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
unsupportedOS=1
|
unsupportedOS=1
|
||||||
if [[ $isRpi ]]; then #supported Raspbian? (16-Feb-15, 20-Jun-14, 09-Jan-14, etc)
|
if [[ $ras2_os == debian-* || $ras2_os == rpi-* ]]; then
|
||||||
fwhash=$(zcat /usr/share/doc/raspberrypi-bootloader/changelog.Debian.gz | grep -m 1 'as of' | awk '{print $NF}')
|
read debianVersion < /etc/debian_version
|
||||||
fwsupported="-8aca5762- -462f3e3f476f7b6- -c32bc633039cd9- -9d34d0475f9-
|
if [[ $debianVersion == *.* ]]; then
|
||||||
-d4f5315cfac4e- -6f4a90c8cb8817f- -5dd9b4962e- -17c8799375-
|
if (( ${debianVersion%.*} >= 8 && ${debianVersion%.*} < 10 )); then
|
||||||
-960832a6c2590635216c296b6ee0bebf67b21d50-
|
|
||||||
-2a329e0c7d8ea19c085bac5633aa4fccee0f21be-
|
|
||||||
-b2420fc150ae4616f5d9ec24bdaedc630586a529-"
|
|
||||||
if [[ "$fwsupported" == *-$fwhash-* ]]; then
|
|
||||||
unsupportedOS=
|
unsupportedOS=
|
||||||
fi
|
fi
|
||||||
elif [[ $isDebian ]]; then # supported Debian?
|
|
||||||
debianVersion=$(cat /etc/debian_version)
|
|
||||||
debianSupported="-9.2- -8.2- -7.9- -7.8- -7.6- -7.3-"
|
|
||||||
[[ $debianSupported == *-$debianVersion-* ]] && unsupportedOS=
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $unsupportedOS && $isRpi ]]; then
|
|
||||||
echo
|
|
||||||
echo "A2SERVER and its installer scripts have been tested on Raspbian Wheezy,"
|
|
||||||
echo "Jessie, and Stretch though not this specific firmware version"
|
|
||||||
echo "(${fwhash:0:7}). Just FYI."
|
|
||||||
unsupportedOS=
|
|
||||||
elif [[ $unsupportedOS && $isDebian ]]; then
|
|
||||||
echo
|
|
||||||
echo "A2SERVER and its installer scripts have been tested on Debian 7/8/9,"
|
|
||||||
echo "though not this specific point release ($debianVersion). Just FYI."
|
|
||||||
unsupportedOS=
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $unsupportedOS ]]; then
|
if [[ $unsupportedOS ]]; then
|
||||||
echo
|
cat <<-EOF
|
||||||
echo "WARNING: A2SERVER and its installer scripts have only been tested on"
|
|
||||||
echo "Debian and Raspbian. Continuing is probably fine, but might not be."
|
WARNING: A2SERVER and its installer scripts have only been tested on
|
||||||
echo "Theoretical worst case would be your operating system no longer works"
|
Debian and Raspbian wheezy, jessie, and stretch. It may work with later
|
||||||
echo "properly or data is lost, so consider backing up first."
|
versions, but it might not. The theoretical worst case would be an OS
|
||||||
|
image that no longer works correctly or lost data, so you might want to
|
||||||
|
press ctrl-c here. Otherwise press Return.
|
||||||
|
|
||||||
|
Detected system: $ras2_os ($ras2_arch)
|
||||||
|
EOF
|
||||||
|
read
|
||||||
fi
|
fi
|
||||||
|
|
||||||
doSetup=1
|
doSetup=1
|
||||||
@@ -186,42 +162,6 @@ if (( $doSetup )); then
|
|||||||
rm -rf /tmp/a2server-install &>/dev/null
|
rm -rf /tmp/a2server-install &>/dev/null
|
||||||
mkdir -p /tmp/a2server-install
|
mkdir -p /tmp/a2server-install
|
||||||
|
|
||||||
checkPw=1
|
|
||||||
while [[ $checkPw ]] ; do
|
|
||||||
userPw=$(sudo grep "^$USER" /etc/shadow | cut -f 2 -d ':')
|
|
||||||
[[ $userPw == "$(echo 'apple2' | perl -e '$_ = <STDIN>; chomp; print crypt($_, $ARGV[0])' "${userPw%"${userPw#\$*\$*\$}"}")" ]] && isApple2Pw=1 || isApple2Pw=
|
|
||||||
[[ $userPw == "$(echo 'raspberry' | perl -e '$_ = <STDIN>; chomp; print crypt($_, $ARGV[0])' "${userPw%"${userPw#\$*\$*\$}"}")" ]] && isRaspberryPw=1 || isRaspberryPw=
|
|
||||||
|
|
||||||
password="your password"
|
|
||||||
[[ $isApple2Pw ]] && password="'apple2'"
|
|
||||||
[[ $isRaspberryPw ]] && password="'raspberry'"
|
|
||||||
checkPw=
|
|
||||||
|
|
||||||
|
|
||||||
[[ $isRpi ]] && a2server="your Raspberry Pi" || a2server="A2SERVER"
|
|
||||||
if [[ ! $isApple2Pw && ! -f /usr/local/etc/A2SERVER-version ]]; then
|
|
||||||
if [[ ! $autoAnswerYes ]]; then
|
|
||||||
echo
|
|
||||||
echo "To ensure that all client computers are able to connect to"
|
|
||||||
echo "${a2server} using the same password, you probably want"
|
|
||||||
echo "to change your user password to 'apple2'."
|
|
||||||
echo
|
|
||||||
echo -n "Do you want to change the password for user '$USER' to 'apple2' now? "
|
|
||||||
read
|
|
||||||
fi
|
|
||||||
if [[ $autoAnswerYes || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
|
|
||||||
echo "A2SERVER: changing password for user '$USER' to 'apple2'..."
|
|
||||||
echo "$USER:apple2" | sudo chpasswd
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "During this installation, enter ${password} if prompted for passwords."
|
|
||||||
echo
|
|
||||||
|
|
||||||
sudo true
|
|
||||||
|
|
||||||
read -d '' a2sSubScripts <<-EOF
|
read -d '' a2sSubScripts <<-EOF
|
||||||
a2server-1-storage.txt
|
a2server-1-storage.txt
|
||||||
a2server-2-tools.txt
|
a2server-2-tools.txt
|
||||||
@@ -243,7 +183,7 @@ if (( $doSetup )); then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
for _script in $a2sSubScripts; do
|
for _script in $a2sSubScripts; do
|
||||||
"$a2sSource/scripts/$_script"
|
"$top_src/scripts/$_script"
|
||||||
done
|
done
|
||||||
|
|
||||||
rm -f /tmp/a2server-packageReposUpdated
|
rm -f /tmp/a2server-packageReposUpdated
|
||||||
|
@@ -12,14 +12,14 @@ a2sBranch="master"
|
|||||||
a2sScriptURL="https://raw.githubusercontent.com/RasppleII/a2server/${a2sBranch}"
|
a2sScriptURL="https://raw.githubusercontent.com/RasppleII/a2server/${a2sBranch}"
|
||||||
a2sTarball="https://github.com/RasppleII/a2server/archive/${a2sBranch}.tar.gz"
|
a2sTarball="https://github.com/RasppleII/a2server/archive/${a2sBranch}.tar.gz"
|
||||||
|
|
||||||
# Set a2sSource to the location of the source tree if we're running in one
|
# Set top_src to the location of the source tree if we're running in one
|
||||||
a2sSource="$( dirname "${BASH_SOURCE[0]}" )/.."
|
top_src="$( dirname "${BASH_SOURCE[0]}" )/.."
|
||||||
pushd $a2sSource >/dev/null
|
pushd $top_src >/dev/null
|
||||||
a2sSource="$PWD"
|
top_src="$PWD"
|
||||||
popd >/dev/null
|
popd >/dev/null
|
||||||
if [[ ! -f "$a2sSource/.a2server_source" ]]; then
|
if [[ ! -f "$top_src/.a2server_source" ]]; then
|
||||||
a2sWebUpdate=1
|
a2sWebUpdate=1
|
||||||
a2sSource=$(mktemp -d /tmp/a2server.XXXXXXXXXXXX)
|
top_src=$(mktemp -d /tmp/a2server.XXXXXXXXXXXX)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
installedVersion=
|
installedVersion=
|
||||||
@@ -51,7 +51,7 @@ if (( $a2sWebUpdate )); then
|
|||||||
future.
|
future.
|
||||||
EOT
|
EOT
|
||||||
else
|
else
|
||||||
newVersion=$(grep '^a2serverVersion' "$a2sSource/install.sh" | cut -d '"' -f 2)
|
newVersion=$(grep '^a2serverVersion' "$top_src/install.sh" | cut -d '"' -f 2)
|
||||||
cat <<-EOT
|
cat <<-EOT
|
||||||
You've started the single command a2server update script from inside the
|
You've started the single command a2server update script from inside the
|
||||||
a2server source directory for version $newVersion. This script will only
|
a2server source directory for version $newVersion. This script will only
|
||||||
@@ -75,7 +75,7 @@ printf "\nProject history:\n"
|
|||||||
if (( $a2sWebUpdate )); then
|
if (( $a2sWebUpdate )); then
|
||||||
wget -qO- "${a2sScriptURL}/update/versionhistory.txt"
|
wget -qO- "${a2sScriptURL}/update/versionhistory.txt"
|
||||||
else
|
else
|
||||||
cat "$a2sSource/update/versionhistory.txt"
|
cat "$top_src/update/versionhistory.txt"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat <<EOT
|
cat <<EOT
|
||||||
@@ -95,20 +95,20 @@ if [[ ! $autoAnswerYes ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if (( $a2sWebUpdate )); then
|
if (( $a2sWebUpdate )); then
|
||||||
a2sSource=$(mktemp -d /tmp/a2server.XXXXXXXXXXXX)
|
top_src=$(mktemp -d /tmp/a2server.XXXXXXXXXXXX)
|
||||||
|
|
||||||
# Normally tarballs unpack in a subdirectory, but we want it to unpack into
|
# Normally tarballs unpack in a subdirectory, but we want it to unpack into
|
||||||
# $a2sSource directly (even though the directory has the tarball in it.)
|
# $top_src directly (even though the directory has the tarball in it.)
|
||||||
printf "\na2server: Downloading installer to $a2sSource.\n"
|
printf "\na2server: Downloading installer to $top_src.\n"
|
||||||
wget -O "$a2sSource/a2server-$a2sBranch.tar.gz" "$a2sTarball"
|
wget -O "$top_src/a2server-$a2sBranch.tar.gz" "$a2sTarball"
|
||||||
tar -C $a2sSource --strip-components=1 -zxf "$a2sSource/a2server-${a2sBranch}.tar.gz"
|
tar -C $top_src --strip-components=1 -zxf "$top_src/a2server-${a2sBranch}.tar.gz"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Now we actually run the installer as if we were installing it by hand
|
# Now we actually run the installer as if we were installing it by hand
|
||||||
printf "\na2server: Running the update installer now.\n"
|
printf "\na2server: Running the update installer now.\n"
|
||||||
"${a2sSource}/install.sh" -i "$@"
|
"${top_src}/install.sh" -i "$@"
|
||||||
|
|
||||||
if (( $a2sWebUpdate )); then
|
if (( $a2sWebUpdate )); then
|
||||||
printf "\na2server: Finished with installer, now deleting ${a2sSource}.\n"
|
printf "\na2server: Finished with installer, now deleting ${top_src}.\n"
|
||||||
rm -rf "$a2sSource"
|
rm -rf "$top_src"
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user