Make index.txt use a2sSource convention

Redefining a2sSource to be the top source directory throughout, and I
just wrote this index.txt that doesn't follow that convention.  Fixed
that and removed some unnecessary directory switching in the shell
script since the closest we need to get to being in a particular
directory is when we extract the tarball, and tar takes arguments for
that.

Also made the temp dir we create actually be a2sSource for simplicity.
This commit is contained in:
T. Joseph Carter 2018-04-11 04:32:01 -07:00
parent 2b52ad8429
commit e9c53fae66

View File

@ -12,32 +12,28 @@ 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"
origDir="$PWD" # Set a2sSource to the location of the source tree if we're running in one
a2sSource="$( dirname "${BASH_SOURCE[0]}" )/.."
# Set a2sDevel to the location of the source tree if we're running in one if [[ -f "$a2sSource/.a2server_source" ]]; then
a2sDevel="$( dirname "${BASH_SOURCE[0]}" )/.." pushd $a2sSource >/dev/null
if [[ -f "$a2sDevel/.a2server_source" ]]; then a2sSource="$PWD"
pushd $a2sDevel >/dev/null
a2sDevel="$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:
$a2sDevel $a2sSource
Please run ./install.sh in that directory. Thanks! Please run ./install.sh in that directory. Thanks!
EOT EOT
exit 1 exit 1
fi fi
a2sDevel=
# Find the version in the install script # Find the version in the install script
newVersion=$(wget -qO- "${a2sScriptURL}/install.sh" | grep '^a2serverVersion' | cut -d '"' -f 2) newVersion=$(wget -qO- "${a2sScriptURL}/install.sh" | grep '^a2serverVersion' | cut -d '"' -f 2)
# It almost never is, but this script could be run with command line arguments, # It almost never is, but this script could be run with command line arguments,
# of which -y we can use, so we should check for it. We'll pass them all to # of which -y we can use, so we should check for it. We'll pass them all to
# the install script later # the install script later
@ -49,8 +45,6 @@ for arg in $@; do
fi fi
done done
cat <<EOT cat <<EOT
Hello, you've reached the single wget command version of the a2server install Hello, you've reached the single wget command version of the a2server install
@ -82,19 +76,18 @@ if [[ ! $autoAnswerYes ]]; then
fi fi
fi fi
a2sInstall=$(mktemp -d /tmp/a2server.XXXXXXXXXXXX) a2sSource=$(mktemp -d /tmp/a2server.XXXXXXXXXXXX)
cd "$a2sInstall"
# We rename the tarball we download for consistency # Normally tarballs unpack in a subdirectory, but we want it to unpack into
printf "\na2server: Downloading installer to ${a2sInstall}.\n" # $a2sSource directly (even though the directory has the tarball in it.)
wget -O "a2server-${a2sBranch}.tar.gz" "$a2sTarball" printf "\na2server: Downloading installer to $a2sSource.\n"
tar zxf "a2server-${a2sBranch}.tar.gz" wget -O "$a2sSource/a2server-$a2sBranch.tar.gz" "$a2sTarball"
tar -C $a2sSource --strip-components=1 -zxf "$a2sSource/a2server-${a2sBranch}.tar.gz"
# Now we actually run the installer # 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"
"a2server-${a2sBranch}/install.sh" "$@" "${a2sSource}/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 ${a2sInstall}.\n" printf "\na2server: Finished with installer, now deleting ${a2sSource}.\n"
cd "$origDir" rm -rf "$a2sSource"
rm -rf "$a2sInstall"