root / devel / upload.in @ 8b3fd458
History | View | Annotate | Download (2.2 kB)
1 | 94f3875d | Michael Hanselmann | #!/bin/bash |
---|---|---|---|
2 | 6e5e91a1 | Guido Trotter | |
3 | 6e5e91a1 | Guido Trotter | # Copyright (C) 2006, 2007 Google Inc. |
4 | 6e5e91a1 | Guido Trotter | # |
5 | 6e5e91a1 | Guido Trotter | # This program is free software; you can redistribute it and/or modify |
6 | 6e5e91a1 | Guido Trotter | # it under the terms of the GNU General Public License as published by |
7 | 6e5e91a1 | Guido Trotter | # the Free Software Foundation; either version 2 of the License, or |
8 | 6e5e91a1 | Guido Trotter | # (at your option) any later version. |
9 | 6e5e91a1 | Guido Trotter | # |
10 | 6e5e91a1 | Guido Trotter | # This program is distributed in the hope that it will be useful, but |
11 | 6e5e91a1 | Guido Trotter | # WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | 6e5e91a1 | Guido Trotter | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | 6e5e91a1 | Guido Trotter | # General Public License for more details. |
14 | 6e5e91a1 | Guido Trotter | # |
15 | 6e5e91a1 | Guido Trotter | # You should have received a copy of the GNU General Public License |
16 | 6e5e91a1 | Guido Trotter | # along with this program; if not, write to the Free Software |
17 | 6e5e91a1 | Guido Trotter | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 | 6e5e91a1 | Guido Trotter | # 02110-1301, USA. |
19 | 6e5e91a1 | Guido Trotter | |
20 | 6e5e91a1 | Guido Trotter | # This is a test script to ease development and testing on test clusters. |
21 | 6e5e91a1 | Guido Trotter | # It should not be used to update production environments. |
22 | 6e5e91a1 | Guido Trotter | |
23 | 6e5e91a1 | Guido Trotter | # Usage: upload.sh node-{1,2,3} |
24 | 6e5e91a1 | Guido Trotter | # it will upload the python libraries to |
25 | 6e5e91a1 | Guido Trotter | # $prefix/lib/python2.4/site-packages/ganeti and the command line utils to |
26 | 4a160927 | Guido Trotter | # $prefix/sbin. It needs passwordless root login to the nodes. |
27 | 6e5e91a1 | Guido Trotter | |
28 | 6e5e91a1 | Guido Trotter | set -e |
29 | f63eed35 | Michael Hanselmann | |
30 | f63eed35 | Michael Hanselmann | NO_RESTART= |
31 | f63eed35 | Michael Hanselmann | hosts= |
32 | f63eed35 | Michael Hanselmann | while [ "$#" -gt 0 ]; do |
33 | f63eed35 | Michael Hanselmann | opt="$1" |
34 | f63eed35 | Michael Hanselmann | case "$opt" in |
35 | f63eed35 | Michael Hanselmann | --no-restart) |
36 | f63eed35 | Michael Hanselmann | NO_RESTART=1 |
37 | f63eed35 | Michael Hanselmann | ;; |
38 | f63eed35 | Michael Hanselmann | -*) |
39 | f63eed35 | Michael Hanselmann | echo "Unknown option: $opt" >&2 |
40 | f63eed35 | Michael Hanselmann | exit 1 |
41 | f63eed35 | Michael Hanselmann | ;; |
42 | f63eed35 | Michael Hanselmann | *) |
43 | f63eed35 | Michael Hanselmann | hosts="$hosts $opt" |
44 | f63eed35 | Michael Hanselmann | ;; |
45 | f63eed35 | Michael Hanselmann | esac |
46 | f63eed35 | Michael Hanselmann | shift |
47 | f63eed35 | Michael Hanselmann | done |
48 | f63eed35 | Michael Hanselmann | |
49 | f63eed35 | Michael Hanselmann | set ${hosts} |
50 | f63eed35 | Michael Hanselmann | |
51 | 6e5e91a1 | Guido Trotter | TXD=`mktemp -d` |
52 | 6e5e91a1 | Guido Trotter | trap 'rm -rf $TXD' EXIT |
53 | 6e5e91a1 | Guido Trotter | |
54 | 6e5e91a1 | Guido Trotter | # install ganeti as a real tree |
55 | 6e5e91a1 | Guido Trotter | make install DESTDIR="$TXD" |
56 | 6e5e91a1 | Guido Trotter | |
57 | 6e5e91a1 | Guido Trotter | echo --- |
58 | 6e5e91a1 | Guido Trotter | |
59 | 6e5e91a1 | Guido Trotter | ( cd "$TXD" && find; ) |
60 | 6e5e91a1 | Guido Trotter | |
61 | 6e5e91a1 | Guido Trotter | echo --- |
62 | 6e5e91a1 | Guido Trotter | |
63 | 94f3875d | Michael Hanselmann | PREFIX='@PREFIX@' |
64 | 6e5e91a1 | Guido Trotter | |
65 | 6e5e91a1 | Guido Trotter | # and now put it under $prefix on the target node(s) |
66 | 6e5e91a1 | Guido Trotter | for host; do |
67 | 6e5e91a1 | Guido Trotter | echo Uploading code to ${host}... |
68 | 6e5e91a1 | Guido Trotter | rsync -v -rlDc --exclude="*.py[oc]" --exclude="*.pdf" --exclude="*.html" \ |
69 | 6e5e91a1 | Guido Trotter | "$TXD/$PREFIX/" \ |
70 | 6e5e91a1 | Guido Trotter | root@${host}:$PREFIX/ & |
71 | 6e5e91a1 | Guido Trotter | done |
72 | 6e5e91a1 | Guido Trotter | wait |
73 | 6e5e91a1 | Guido Trotter | |
74 | 6e5e91a1 | Guido Trotter | for host; do |
75 | 6e5e91a1 | Guido Trotter | echo Uploading init script to ${host}... |
76 | 6e5e91a1 | Guido Trotter | scp doc/examples/ganeti.initd root@${host}:/etc/init.d/ganeti & |
77 | 6e5e91a1 | Guido Trotter | done |
78 | 6e5e91a1 | Guido Trotter | wait |
79 | 6e5e91a1 | Guido Trotter | |
80 | 6e5e91a1 | Guido Trotter | if [ -f ganeti-master-cron ]; then |
81 | 6e5e91a1 | Guido Trotter | for host; do |
82 | 6e5e91a1 | Guido Trotter | echo Uploading cron files to ${host}... |
83 | 6e5e91a1 | Guido Trotter | scp ganeti-master-cron root@${host}:/etc/ganeti/master-cron & |
84 | 6e5e91a1 | Guido Trotter | done |
85 | 6e5e91a1 | Guido Trotter | fi |
86 | 6e5e91a1 | Guido Trotter | wait |
87 | 6e5e91a1 | Guido Trotter | |
88 | f63eed35 | Michael Hanselmann | if test -z "${NO_RESTART}"; then |
89 | f63eed35 | Michael Hanselmann | for host; do |
90 | f63eed35 | Michael Hanselmann | echo Restarting ganeti-noded on ${host}... |
91 | f63eed35 | Michael Hanselmann | ssh root@${host} /etc/init.d/ganeti restart & |
92 | f63eed35 | Michael Hanselmann | done |
93 | f63eed35 | Michael Hanselmann | wait |
94 | f63eed35 | Michael Hanselmann | fi |