Move show version code to its own script

…why?  Because show_changes will become the "do you want to install
this?" confirmation at some point.  That's not what it does now, it just
shows you the version for now.  But eventually it will tell you the
version you have installed, compare to the version you are going to
install, show you the changes between here and there, and ask you if you
actually want to proceed with installation.  When that happens it'll be
appropriate to rename the script, but for now it's a placeholder.
This commit is contained in:
T. Joseph Carter 2018-05-07 01:49:43 -07:00
parent 42ac9cc6ef
commit f6555c024c
3 changed files with 37 additions and 10 deletions

View File

@ -8,7 +8,7 @@
# scripts themselves. Software used or installed by these scripts is subject
# to other licenses. This work is published from the United States.
a2cloudVersion="2.9.0"
a2cloudVersion="2.9.0" # Leave this quoted!
# Find the path of our source directory
a2cSource="$( dirname "${BASH_SOURCE[0]}" )"
@ -20,6 +20,8 @@ if [[ ! -f "$a2cSource/.a2cloud_source" ]]; then
exit 1
fi
"$a2cSource/scripts/show_changes"
# Run the legacy setup script for anything not yet ported
if [[ -e "${a2cSource}/setup/ivan.sh" ]]; then
"${a2cSource}/setup/ivan.sh" "$@"

32
scripts/show_changes Executable file
View File

@ -0,0 +1,32 @@
#! /bin/bash
# vim: set tabstop=4 shiftwidth=4 noexpandtab filetype=sh:
# show_changes - show a2cloud 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 a2cloud
# 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
a2cSource="$( dirname "${BASH_SOURCE[0]}" )/.."
pushd $a2cSource >/dev/null
a2cSource="$PWD"
popd >/dev/null
if [[ ! -f "$a2cSource/.a2cloud_source" ]]; then
printf "\na2cloud: cannot find a2cloud source directory in $a2cSource.\n\n"
exit 1
fi
newVersion=$(grep '^a2cloudVersion' "$a2cSource/install.sh" | cut -d '"' -f 2)
if [[ -f /usr/local/etc/A2CLOUD-version ]]; then
installedVersion="$(cat /usr/local/etc/A2CLOUD-version)"
if [[ $installedVersion != *.*.* ]]; then
installedVersion="${installedVersion:0:1}.${installedVersion:1:1}.${installedVersion:2}"
fi
fi
echo "a2cloud version available: $newVersion"
echo "a2cloud version installed: ${installedVersion:-None}"
# FIXME: Do something useful with a changelog perhaps?

View File

@ -1,7 +1,9 @@
#! /bin/bash
# vim: set tabstop=4 shiftwidth=4 noexpandtab filetype=sh:
# FIXME: Remove this when convenient.
version="2.9.0"
adtProVersion="2.0.1"
a2cBinaryURL="http://blocksfree.com/downloads"
@ -40,15 +42,6 @@ elif [[ -f /etc/inittab ]]; then
isSysVInit=1
fi
if [[ -f /usr/local/etc/A2CLOUD-version ]]; then
installedVersion="$(cat /usr/local/etc/A2CLOUD-version)"
if [[ $installedVersion != *.*.* ]]; then
installedVersion="${installedVersion:0:1}.${installedVersion:1:1}.${installedVersion:2}"
fi
fi
echo "A2CLOUD version available: $version"
echo "A2CLOUD version installed: ${installedVersion:-None}"
### A2CLOUD: Process command line args
buildA2CloudDisk=
noPicoPkg=