11 Commits

Author SHA1 Message Date
T. Joseph Carter
e499a3db46 I thought I already fixed a2serverVersion 2018-09-09 16:01:54 -07:00
T. Joseph Carter
5010a496e6 Simplify OS support checks
This branch of a2server only supports jessie and above, either Raspbian
or Debian.  While I was at it, I simplified the tests for what is and is
not a supported OS.  If there are bad kernels or firmwares we need to
work around those should be fixes.  This also means giving the user an
option to interrupt the installation if they are trying to install on a
Debian(ish) system that is too old or (more likely) too new.

At least ivan.sh is now using a2cloud's system_ident script.
2018-09-09 11:10:00 -07:00
T. Joseph Carter
a033151c66 Merge branch 'master' of https://github.com/RasppleII/a2server 2018-09-09 10:50:49 -07:00
T. Joseph Carter
f9b11b6dde Change a2sSource to top_src in subscripts 2018-09-08 19:09:15 -07:00
T. Joseph Carter
98ed939e9f Have ivan.sh get version from install.sh 2018-09-08 19:08:24 -07:00
T. Joseph Carter
f1b141bd9c Move 1-storage fixup code to fixup
1-storage included a block that moved /media/A2SHARED (which was a nono
for us to use under FHS) to /srv/A2SERVER.  This has now been moved to
fixup.
2018-09-08 18:49:52 -07:00
T. Joseph Carter
d71b2a4048 Merge branch 'refactor' 2018-09-07 15:07:40 -07:00
T. Joseph Carter
16e1306dbb Cleanups for consistency with a2cloud mostly
- Added bash check to install.sh
- Switched to using top_src instead of a2sSource (not yet in ivan.sh
  subscripts)
- Added processing of -y and -c flags to install.sh ala a2cloud
- Put the intro blurb and continue question in install.sh (didn't remove
  the one from ivan.sh yet as it serves as a useful way to test things
  about to be in progress and stop after them…)
- Added the fixup script, currently empty for a2server, but ohh will
  that be changing!
- Added the show_changes script. It doesn't do a whole lot for a2server
  just like it doesn't for a2cloud yet.  To be addressed.  Higher
  priorities right now.
- Fixed a bug where fresh installs would say that upgrading from your
  version of a2server wasn't supported anymore.
2018-09-06 13:35:01 -07:00
T. Joseph Carter
7d3ae1d200 Stop changing people's passwords!
We really, really, really should not be changing people's passwords.
It's a no-no.  And certainly we shouldn't be changing them to something
obvious and unsafe.  So stop doing it!
2018-09-01 16:57:40 -07:00
T. Joseph Carter
6229dba43f Fix stupid logic error bug
We need a more robust way to detect whether netatalk is installed or
needs to be installed, the current check by a2server version isn't very
reliable anyway, assuming that netatalk will always be hand-compiled and
never upgraded.  But for now at least, let's fix my idiot mistake.
2018-09-01 16:03:42 -07:00
T. Joseph Carter
f3ae970d37 Make creating /srv/A2SERVER more robust 2018-09-01 15:37:44 -07:00
11 changed files with 290 additions and 165 deletions

View File

@@ -8,21 +8,74 @@
# scripts themselves. Software used or installed by these scripts is subject
# to other licenses. This work is published from the United States.
a2serverVersion="1.9.0"
a2sScriptURL="https://raw.githubusercontent.com/RasppleII/a2server/master"
a2serverVersion="1.9.0" # Leave this quoted!
# Find the path of our source directory
a2sSource="$( dirname "${BASH_SOURCE[0]}" )"
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"
if test "x$BASH" = "x"; then
printf "This script requires bash. Please run\nit as ./install.sh from the source\ndirectory.\n"
exit 1
fi
# Run the legacy setup script for anything not yet ported
if [[ -e "${a2sSource}/setup/ivan.sh" ]]; then
"${a2sSource}/setup/ivan.sh" "$@"
# 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
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

View File

@@ -2,24 +2,10 @@
# vim: set tabstop=4 shiftwidth=4 noexpandtab filetype=sh:
# --- 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
echo "A2SERVER: Preparing the shared files volume..."
sudo mkdir -p /srv/A2SERVER
sudo chown $USER:$USER /srv/A2SERVER
mygroup="$(id -ng)"
sudo install -d -m 755 -u "$USER" -g "$mygroup" "/srv/A2SERVER"
else
echo "A2SERVER: Shared volume is already prepared for use."
fi

View File

@@ -8,12 +8,12 @@ a2sScriptURL="https://raw.githubusercontent.com/RasppleII/a2server/master"
a2sBinaryURL="http://blocksfree.com/downloads"
# Find the path of our source directory
a2sSource="$( dirname "${BASH_SOURCE[0]}" )/.."
pushd $a2sSource >/dev/null
a2sSource="$PWD"
top_src="$( dirname "${BASH_SOURCE[0]}" )/.."
pushd $top_src >/dev/null
top_src="$PWD"
popd >/dev/null
if [[ ! -f "$a2sSource/.a2server_source" ]]; then
printf "\na2server: cannot find a2server source directory in $a2sSource.\n\n"
if [[ ! -f "$top_src/.a2server_source" ]]; then
printf "\na2server: cannot find a2server source directory in $top_src.\n\n"
exit 1
fi
@@ -184,13 +184,13 @@ a2sTools="afpsync afptype mkatinit mkvolinfo cppo debupdate"
a2sHelp="a2server-help.txt"
a2sConfScripts="a2server-aliases a2serverrc"
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
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
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
# 1.3.0: a2serverrc is now called from /etc/bash.bashrc,

View File

@@ -48,7 +48,7 @@ if [[ -f /usr/local/etc/A2SERVER-version ]]; then
read a2sVersion </usr/local/etc/A2SERVER-version
fi
# 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)..."
# stop Netatalk and samba if running (during upgrade)
if [[ $(ps --no-headers -C afpd) ]]; then

View File

@@ -11,12 +11,12 @@ a2sScriptURL="https://raw.githubusercontent.com/RasppleII/a2server/master"
a2sBinaryURL="http://blocksfree.com/downloads"
# Find the path of our source directory
a2sSource="$( dirname "${BASH_SOURCE[0]}" )/.."
pushd $a2sSource >/dev/null
a2sSource="$PWD"
top_src="$( dirname "${BASH_SOURCE[0]}" )/.."
pushd $top_src >/dev/null
top_src="$PWD"
popd >/dev/null
if [[ ! -f "$a2sSource/.a2server_source" ]]; then
printf "\na2server: cannot find a2server source directory in $a2sSource.\n\n"
if [[ ! -f "$top_src/.a2server_source" ]]; then
printf "\na2server: cannot find a2server source directory in $top_src.\n\n"
exit 1
fi
@@ -263,7 +263,7 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
|| [[ ! -f /usr/local/bin/mkvolinfo ]] \
|| [[ ! -f /usr/local/bin/afpsync ]] \
|| [[ ! -f /usr/local/bin/cppo ]]; then
"$a2sSource/scripts/a2server-2-tools.txt"
"$top_src/scripts/a2server-2-tools.txt"
fi
# 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..."
mkdir -p /tmp/netboot
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"))
gsosInstalled=""

69
scripts/fixup Executable file
View 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
View 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
View 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

View File

@@ -12,18 +12,18 @@ a2sBranch="master"
a2sScriptURL="https://raw.githubusercontent.com/RasppleII/a2server/${a2sBranch}"
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
a2sSource="$( dirname "${BASH_SOURCE[0]}" )/.."
if [[ -f "$a2sSource/.a2server_source" ]]; then
pushd $a2sSource >/dev/null
a2sSource="$PWD"
# Set top_src to the location of the source tree if we're running in one
top_src="$( dirname "${BASH_SOURCE[0]}" )/.."
if [[ -f "$top_src/.a2server_source" ]]; then
pushd $top_src >/dev/null
top_src="$PWD"
popd >/dev/null
cat <<-EOT
This script exists solely for backward-compatibility with IvanX's a2server
website and aliases installed by older versions. You appear to have an
a2server source directory here:
$a2sSource
$top_src
Please run ./install.sh in that directory. Thanks!
@@ -76,18 +76,18 @@ if [[ ! $autoAnswerYes ]]; then
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
# $a2sSource directly (even though the directory has the tarball in it.)
printf "\na2server: Downloading installer to $a2sSource.\n"
wget -O "$a2sSource/a2server-$a2sBranch.tar.gz" "$a2sTarball"
tar -C $a2sSource --strip-components=1 -zxf "$a2sSource/a2server-${a2sBranch}.tar.gz"
# $top_src directly (even though the directory has the tarball in it.)
printf "\na2server: Downloading installer to $top_src.\n"
wget -O "$top_src/a2server-$a2sBranch.tar.gz" "$a2sTarball"
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
printf "\na2server: Running the installer now.\n"
"${a2sSource}/install.sh" "$@"
"${top_src}/install.sh" "$@"
# Clean up and delete the installer we downloaded
printf "\na2server: Finished with installer, now deleting ${a2sSource}.\n"
rm -rf "$a2sSource"
printf "\na2server: Finished with installer, now deleting ${top_src}.\n"
rm -rf "$top_src"

View File

@@ -6,31 +6,23 @@
# netatalk configured for Apple II use on Debian or Raspbian.
# 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
a2sSource="$( dirname "${BASH_SOURCE[0]}" )/.."
pushd $a2sSource >/dev/null
a2sSource="$PWD"
top_src="$( dirname "${BASH_SOURCE[0]}" )/.."
pushd $top_src >/dev/null
top_src="$PWD"
popd >/dev/null
if [[ ! -f "$a2sSource/.a2server_source" ]]; then
printf "\na2server: cannot find a2server source directory in $a2sSource.\n\n"
if [[ ! -f "$top_src/.a2server_source" ]]; then
printf "\na2server: cannot find a2server source directory in $top_src.\n\n"
exit 1
fi
compare_version="$a2sSource/scripts/compare_version"
# Make sure ras2_{os,arch} get set
. "$top_src/scripts/system_ident" -q
isRpi=
[[ -f /usr/bin/raspi-config ]] && isRpi=1
# This is now in install.sh, get it from there
a2serverVersion=$(grep '^a2serverVersion' "$top_src/install.sh" | cut -d '"' -f 2)
isDebian=
if [[ "$(lsb_release -ds)" = Debian* ]]; then
debianVersion="$(lsb_release -rs)"
if [[ "$debianVersion" -ge 7 || $debianVersion == [a-z]* ]]; then
isDebian=1
fi
fi
compare_version="$top_src/scripts/compare_version"
if [[ -f /usr/local/etc/A2SERVER-version ]]; then
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}"
fi
fi
echo "A2SERVER version available: $a2serverVersion"
echo "A2SERVER version installed: ${installedVersion:=None}"
if [[ $installedVersion == "None" ]]; then
if [[ $installedVersion != *.*.* ]]; then
installedVersion=0
fi
@@ -113,46 +103,32 @@ fi
a2server_update=0
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
fi
unsupportedOS=1
if [[ $isRpi ]]; then #supported Raspbian? (16-Feb-15, 20-Jun-14, 09-Jan-14, etc)
fwhash=$(zcat /usr/share/doc/raspberrypi-bootloader/changelog.Debian.gz | grep -m 1 'as of' | awk '{print $NF}')
fwsupported="-8aca5762- -462f3e3f476f7b6- -c32bc633039cd9- -9d34d0475f9-
-d4f5315cfac4e- -6f4a90c8cb8817f- -5dd9b4962e- -17c8799375-
-960832a6c2590635216c296b6ee0bebf67b21d50-
-2a329e0c7d8ea19c085bac5633aa4fccee0f21be-
-b2420fc150ae4616f5d9ec24bdaedc630586a529-"
if [[ "$fwsupported" == *-$fwhash-* ]]; then
unsupportedOS=
if [[ $ras2_os == debian-* || $ras2_os == rpi-* ]]; then
read debianVersion < /etc/debian_version
if [[ $debianVersion == *.* ]]; then
if (( ${debianVersion%.*} >= 8 && ${debianVersion%.*} < 10 )); then
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
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
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 "Theoretical worst case would be your operating system no longer works"
echo "properly or data is lost, so consider backing up first."
cat <<-EOF
WARNING: A2SERVER and its installer scripts have only been tested on
Debian and Raspbian wheezy, jessie, and stretch. It may work with later
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
doSetup=1
@@ -186,42 +162,6 @@ if (( $doSetup )); then
rm -rf /tmp/a2server-install &>/dev/null
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
a2server-1-storage.txt
a2server-2-tools.txt
@@ -243,7 +183,7 @@ if (( $doSetup )); then
fi
for _script in $a2sSubScripts; do
"$a2sSource/scripts/$_script"
"$top_src/scripts/$_script"
done
rm -f /tmp/a2server-packageReposUpdated

View File

@@ -12,14 +12,14 @@ a2sBranch="master"
a2sScriptURL="https://raw.githubusercontent.com/RasppleII/a2server/${a2sBranch}"
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
a2sSource="$( dirname "${BASH_SOURCE[0]}" )/.."
pushd $a2sSource >/dev/null
a2sSource="$PWD"
# Set top_src to the location of the source tree if we're running in one
top_src="$( dirname "${BASH_SOURCE[0]}" )/.."
pushd $top_src >/dev/null
top_src="$PWD"
popd >/dev/null
if [[ ! -f "$a2sSource/.a2server_source" ]]; then
if [[ ! -f "$top_src/.a2server_source" ]]; then
a2sWebUpdate=1
a2sSource=$(mktemp -d /tmp/a2server.XXXXXXXXXXXX)
top_src=$(mktemp -d /tmp/a2server.XXXXXXXXXXXX)
fi
installedVersion=
@@ -51,7 +51,7 @@ if (( $a2sWebUpdate )); then
future.
EOT
else
newVersion=$(grep '^a2serverVersion' "$a2sSource/install.sh" | cut -d '"' -f 2)
newVersion=$(grep '^a2serverVersion' "$top_src/install.sh" | cut -d '"' -f 2)
cat <<-EOT
You've started the single command a2server update script from inside the
a2server source directory for version $newVersion. This script will only
@@ -75,7 +75,7 @@ printf "\nProject history:\n"
if (( $a2sWebUpdate )); then
wget -qO- "${a2sScriptURL}/update/versionhistory.txt"
else
cat "$a2sSource/update/versionhistory.txt"
cat "$top_src/update/versionhistory.txt"
fi
cat <<EOT
@@ -95,20 +95,20 @@ if [[ ! $autoAnswerYes ]]; then
fi
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
# $a2sSource directly (even though the directory has the tarball in it.)
printf "\na2server: Downloading installer to $a2sSource.\n"
wget -O "$a2sSource/a2server-$a2sBranch.tar.gz" "$a2sTarball"
tar -C $a2sSource --strip-components=1 -zxf "$a2sSource/a2server-${a2sBranch}.tar.gz"
# $top_src directly (even though the directory has the tarball in it.)
printf "\na2server: Downloading installer to $top_src.\n"
wget -O "$top_src/a2server-$a2sBranch.tar.gz" "$a2sTarball"
tar -C $top_src --strip-components=1 -zxf "$top_src/a2server-${a2sBranch}.tar.gz"
fi
# Now we actually run the installer as if we were installing it by hand
printf "\na2server: Running the update installer now.\n"
"${a2sSource}/install.sh" -i "$@"
"${top_src}/install.sh" -i "$@"
if (( $a2sWebUpdate )); then
printf "\na2server: Finished with installer, now deleting ${a2sSource}.\n"
rm -rf "$a2sSource"
printf "\na2server: Finished with installer, now deleting ${top_src}.\n"
rm -rf "$top_src"
fi