summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorPaul Sherwood <paul.sherwood@codethink.co.uk>2014-10-02 05:52:08 (GMT)
committerPaul Sherwood <paul.sherwood@codethink.co.uk>2014-10-02 16:26:53 (GMT)
commit7b92b773375ba8225c99b6c1566bcd44b3e5ea9b (patch)
treefcd1bc97daa7c9453aa377c86ddab4c4f1c6785d /scripts
parentf1da7ace54bed18c5c7eac5242ec84d4ca81c55d (diff)
downloaddefinitions-7b92b773375ba8225c99b6c1566bcd44b3e5ea9b.tar.gz
Add cycle script for build+deploy to self
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/cycle.sh43
1 files changed, 43 insertions, 0 deletions
diff --git a/scripts/cycle.sh b/scripts/cycle.sh
new file mode 100755
index 0000000..8fab43b
--- /dev/null
+++ b/scripts/cycle.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+# Copyright (C) 2014 Codethink Limited
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+usage() {
+ echo "Usage: cycle.sh some-system some-cluster"
+ echo
+ echo "This builds and deploys the current checked out version of"
+ echo "some-system, applying it as a self-upgrade to the system you"
+ echo "are working in, using configuration from some-cluster."
+ echo "The upgrade is labelled TEST, and is set to be the default for"
+ echo "next boot."
+}
+
+if [ -z "$1" ] || [ -z "$2" ] ; then
+ usage
+ exit 1
+fi
+
+set -e
+set -v
+
+morph gc
+morph build $1
+system-version-manager set-default factory
+if [ `system-version-manager list | grep ^TEST$` ]; then
+ system-version-manager remove TEST
+fi
+
+sed -i "s|^- morph: .*$|- morph: $1|" $2
+morph deploy --upgrade $2 self.HOSTNAME=$(hostname) self.VERSION_LABEL=TEST