mirror of
https://github.com/RasppleII/a2server.git
synced 2025-01-17 19:31:38 +00:00
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.
This commit is contained in:
parent
33d1d058ba
commit
16e1306dbb
79
install.sh
79
install.sh
@ -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
|
||||
|
27
scripts/fixup
Executable file
27
scripts/fixup
Executable file
@ -0,0 +1,27 @@
|
||||
#! /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
|
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?
|
@ -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"
|
||||
|
@ -7,19 +7,18 @@
|
||||
# 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"
|
||||
compare_version="$top_src/scripts/compare_version"
|
||||
|
||||
isRpi=
|
||||
[[ -f /usr/bin/raspi-config ]] && isRpi=1
|
||||
@ -39,9 +38,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,7 +110,7 @@ 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
|
||||
|
||||
@ -243,7 +240,7 @@ if (( $doSetup )); then
|
||||
fi
|
||||
|
||||
for _script in $a2sSubScripts; do
|
||||
"$a2sSource/scripts/$_script"
|
||||
"$top_src/scripts/$_script"
|
||||
done
|
||||
|
||||
rm -f /tmp/a2server-packageReposUpdated
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user