blob: 4e3a6f3660ac78724e73ae7954c218cab89ec7cf [file] [log] [blame]
mbligh88e12a12009-03-09 21:48:33 +00001#!/bin/sh
2
3# steps to take following a release of new code to keep things working.
4#
5# the following scripts may be created to customize behavior:
6#
7# site_utils/site_sync_code
8#
9# - pull code from a source repository
10#
11# site_utils/site_install_cli
12#
13# - install or update client code (new "atest" build?)
14#
15# site_utils/site_restart_apache
16#
17# - suid helper or similar?
18#
19# site_utils/site_restart_final
20#
21# - any finishing touches you may require.
22
23# ---
24
25INIT_SCR=/etc/init.d/autotest
26
27# ---
28
29print_status() {
30 STATUS=$1
31
32 echo "--- $STATUS"
33}
34
35fatal() {
36 echo "*** Fatal error. Giving up."
37 exit 1
38}
39
40# ---
41
42MY_DIR=`dirname $0`
43
44if (! test -f $INIT_SCR)
45then
46 echo "Error: $INIT_SCR must be installed."
47 exit 1
48fi
49
50BECOME_USER=`grep ^BECOME_USER= $INIT_SCR`
51
52if (test "$BECOME_USER" == "")
53then
54 echo "Error: BECOME_USER not defined in $INIT_SCR"
55 exit 1
56fi
57
58BASE_DIR=`grep ^BASE_DIR= $INIT_SCR`
59
60if (test "$BASE_DIR" == "")
61then
62 echo "Error: BASE_DIR not defined in $INIT_SCR"
63 exit 1
64fi
65
66eval $BECOME_USER
67eval $BASE_DIR
68
69# --- stop autotest persistent code
70
71print_status "Stopping autotest persistent code"
72$INIT_SCR stop
73
74# --- sync code (site-specific)
75
76if (test -x $BASE_DIR/site_utils/site_sync_code)
77then
78 print_status "Syncing code"
79 su $BECOME_USER -c $BASE_DIR/site_utils/site_sync_code || exit 1
80fi
81
82# --- compile AfeClient
83
84print_status "Compiling AfeClient"
85( cd $BASE_DIR/frontend/client &&
86 su $BECOME_USER -c ./AfeClient-compile ) || fatal
87
88# --- compile TkoClient
89
90print_status "Compiling TkoClient"
91( cd $BASE_DIR/frontend/client &&
92 su $BECOME_USER -c ./TkoClient-compile ) || fatal
93
94# --- fix gwt permissions
95
96print_status "Fixing permissions"
97( cd $BASE_DIR/frontend/client &&
98 find | xargs chmod o+r &&
99 find -type d | xargs chmod o+rx ) || fatal
100
101# --- update cli repository (site-specific)
102
103if (test -x $BASE_DIR/site_utils/site_install_cli)
104then
105 print_status "Updating cli repository"
106 su $BECOME_USER -c $BASE_DIR/site_utils/site_install_cli || fatal
107fi
108
109# --- restart autotest persistent code
110
111print_status "Restarting autotest persistent code"
112$INIT_SCR start || fatal
113
114# --- possibly restart Apache (site-specific)
115
116if (test -x $BASE_DIR/site_utils/site_restart_apache)
117then
118 print_status "Restarting Apache"
119 su $BECOME_USER -c $BASE_DIR/site_utils/site_restart_apache || fatal
120fi
121
122# --- do any site-specific finalization
123
124if (test -x $BASE_DIR/site_utils/site_restart_final)
125then
126 print_status "Finalizing release"
127 su $BECOME_USER -c $BASE_DIR/site_utils/site_restart_final || fatal
128fi
129