#! /bin/bash # vim: set tabstop=4 shiftwidth=4 noexpandtab filetype=sh: # update/index.txt - upgrade path from Ivan's a2cloud tree # # Ivan's a2cloud installed with a single copy-paste of a command line that # downloaded a script and ran it sight-unseen. It also installed alias # commands that would perform a similar one-liner to upgrade a2cloud to the # latest version. This script provides that interface for upgrades. a2cBranch="master" a2cScriptURL="https://raw.githubusercontent.com/RasppleII/a2cloud/${a2cBranch}" a2cTarball="https://github.com/RasppleII/a2cloud/archive/${a2cBranch}.tar.gz" # 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 "$top_src/.a2cloud_source" ]]; then a2cWebUpdate=1 top_src=$(mktemp -d /tmp/a2cloud.XXXXXXXXXXXX) fi installedVersion= if [[ -f /usr/local/etc/A2CLOUD-version ]]; then read installedVersion < /usr/local/etc/A2CLOUD-version # Convert old three-digit version if needed if [[ $installedVersion != *.*.* ]]; then installedVersion="${installedVersion:0:1}.${installedVersion:1:1}.${installedVersion:2}" fi fi autoAnswerYes= for arg in $@; do if [[ $arg == "-y" ]]; then autoAnswerYes=1 break fi done printf "\na2cloud web install\n\n" if (( $a2cWebUpdate )); then newVersion=$(wget -qO- "${a2cScriptURL}/install.sh" | grep '^a2cloudVersion' | cut -d '"' -f 2) cat <<-EOT You've started the single command a2cloud install script. This script will download things behind the scenes, run them without much verification, and then it will delete what it ran whether the upgrade finished successfully or not. For this reason, we are going to be phasing this script out in the future, but it still does what you expect for now. EOT else newVersion=$(grep '^a2cloudVersion' "$top_src/install.sh" | cut -d '"' -f 2) cat <<-EOT You've started the single command a2cloud install script from inside the a2cloud source directory for version $newVersion. This script will only install or update to that version. EOT fi cat <