summaryrefslogtreecommitdiff
path: root/scripts/cycle.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/cycle.sh')
-rwxr-xr-xscripts/cycle.sh27
1 files changed, 16 insertions, 11 deletions
diff --git a/scripts/cycle.sh b/scripts/cycle.sh
index c0e2aa67..ca6983eb 100755
--- a/scripts/cycle.sh
+++ b/scripts/cycle.sh
@@ -14,6 +14,8 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+set -e
+
usage() {
echo "Usage: cycle.sh some-system some-cluster [newversion]"
echo
@@ -38,24 +40,27 @@ if [ ! -z "$3" ] ; then
fi
fi
-if system-version-manager get-running | grep -q "^$newversion$"; then
- echo "You are currently running the $newversion system."
+location=`cat $2 | grep location | sed 's/ \+//g' | cut -d":" -f2`
+svm="ssh $location system-version-manager"
+runningversion=`$svm get-running'`
+
+if [ $runningversion = $newversion ]; then
+ echo "$newversion is currently running at $location"
echo "Maybe you want to boot into a different system version?"
exit 1
fi
-set -e
-set -v
-
-runningversion=`system-version-manager get-running`
-system-version-manager set-default $runningversion
-if system-version-manager list | grep -q "^$newversion$"; then
- system-version-manager remove $newversion
+$svm "set-default $runningversion"
+if $svm "list" | grep -q "^$newversion$"; then
+ $svm "remove $newversion"
fi
+echo $(date +%Y-%m-%d\ %T) "Cyclng $location from $runningversion to $newversion"
+
morph gc
morph build "$1"
sed -i "s|^- morph: .*$|- morph: $1|" "$2"
-morph deploy --upgrade "$2" self.HOSTNAME=$(hostname) self.VERSION_LABEL=$newversion
-system-version-manager list
+host=`ssh $location hostname`
+morph deploy --upgrade "$2" self.HOSTNAME=$host self.VERSION_LABEL=$newversion
+$svm "list"