a2server/update/index.txt

59 lines
1.6 KiB
Plaintext
Raw Normal View History

#! /bin/bash
# vim: set tabstop=4 shiftwidth=4 noexpandtab filetype=sh:
a2server_devel="$( dirname "${BASH_SOURCE[0]}" )/.."
if [[ -f "$a2server_devel/.a2server_source" ]]; then
pushd $a2server_devel >/dev/null
a2server_devel="$PWD"
popd >/dev/null
else
a2server_devel=
fi
2015-12-10 01:39:09 +00:00
# Ensure URL we'll use ends in a /
case "$A2SERVER_SCRIPT_URL" in
*/) scriptURL="$A2SERVER_SCRIPT_URL" ;;
*) scriptURL="${A2SERVER_SCRIPT_URL:-https://raw.githubusercontent.com/RasppleII/a2server/current}/" ;;
2015-12-10 01:39:09 +00:00
esac
currentVersion=$(wget -qO- "${scriptURL}setup/index.txt" | grep '^a2serverVersion' | 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
else
installedVersion="1.0.0"
fi
autoAnswerYes=
for arg in $@; do
if [[ $arg == "-y" ]]; then
autoAnswerYes=1
break
fi
done
echo
echo "Update history:"
wget -qO- "${scriptURL}update/versionhistory.txt"
echo
echo "installed version: ${installedVersion:0:1}.${installedVersion:1:1}.${installedVersion:2:1}"
echo "current version: ${currentVersion:0:1}.${currentVersion:1:1}.${currentVersion:2:1}"
echo
if [[ $autoAnswerYes ]]; then
REPLY="y"
else
echo -n "Do you want to update (or reinstall) A2SERVER? "
read
fi
if [[ ${REPLY:0:1} == "y" || ${REPLY:0:1} == "Y" ]]; then
# sudo rm /usr/local/etc/netatalk/a2boot/* &> /dev/null
wget -q -O /tmp/setup "${scriptURL}setup/index.txt"; source /tmp/setup -i "$@"
fi
unset currentVersion 2> /dev/null
unset installedVersion 2> /dev/null