Add devel/upload script
authorGuido Trotter <ultrotter@google.com>
Mon, 26 Jan 2009 10:34:30 +0000 (10:34 +0000)
committerGuido Trotter <ultrotter@google.com>
Mon, 26 Jan 2009 10:34:30 +0000 (10:34 +0000)
This eases development/debugging of the os script.
It's mostly copied from its ganeti counterpart.

Reviewed-by: iustinp

devel/upload [new file with mode: 0755]

diff --git a/devel/upload b/devel/upload
new file mode 100755 (executable)
index 0000000..5205840
--- /dev/null
@@ -0,0 +1,64 @@
+#!/bin/bash
+
+# Copyright (C) 2006, 2007 Google Inc.
+#
+# 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; either version 2 of the License, or
+# (at your option) any later version.
+#
+# 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.
+
+# This is a test script to ease development and testing on test clusters.
+# It should not be used to update production environments.
+
+# Usage: upload node-{1,2,3}
+
+set -e
+
+hosts=
+while [ "$#" -gt 0 ]; do
+  opt="$1"
+  case "$opt" in
+    -h|--help)
+      echo "Usage: $0 hosts..."
+      exit 0
+      ;;
+    -*)
+      echo "Unknown option: $opt" >&2
+      exit 1
+    ;;
+    *)
+      hosts="$hosts $opt"
+    ;;
+  esac
+  shift
+done
+
+set ${hosts}
+
+TXD=`mktemp -d`
+trap 'rm -rf $TXD' EXIT
+
+# install the os as a real tree
+make install DESTDIR="$TXD"
+
+echo ---
+
+( cd "$TXD" && find; )
+
+echo ---
+
+for host; do
+  echo Uploading code to ${host}...
+  rsync -v -rlDc ${TXD}/* root@${host}:/ &
+done
+