KVM test: Fix missing commas and unattended install nic mode
[autotest-zwu.git] / utils / release
blobd13b32aa92fdbc21682aa84a75f761812e4dd115
1 #!/bin/sh
3 # steps to take following a release of new code to keep things working.
5 # the following scripts may be created to customize behavior:
6 #
7 # site_utils/site_sync_code
9 # - pull code from a source repository
11 # site_utils/site_install_cli
13 # - install or update client code (new "atest" build?)
15 # site_utils/site_restart_apache
17 # - suid helper or similar?
19 # site_utils/site_restart_final
21 # - any finishing touches you may require.
23 # ---
25 INIT_SCR=/etc/init.d/autotest
27 # ---
29 print_status() {
30 STATUS=$1
32 echo "--- $STATUS"
35 fatal() {
36 echo "*** Fatal error. Giving up."
37 exit 1
40 # ---
42 MY_DIR=`dirname $0`
44 if (! test -f $INIT_SCR)
45 then
46 echo "Error: $INIT_SCR must be installed."
47 exit 1
50 BECOME_USER=`grep ^BECOME_USER= $INIT_SCR`
52 if (test "$BECOME_USER" == "")
53 then
54 echo "Error: BECOME_USER not defined in $INIT_SCR"
55 exit 1
58 BASE_DIR=`grep ^BASE_DIR= $INIT_SCR`
60 if (test "$BASE_DIR" == "")
61 then
62 echo "Error: BASE_DIR not defined in $INIT_SCR"
63 exit 1
66 eval $BECOME_USER
67 eval $BASE_DIR
69 # --- stop autotest persistent code
71 print_status "Stopping autotest persistent code"
72 $INIT_SCR stop
74 # --- sync code (site-specific)
76 if (test -x $BASE_DIR/site_utils/site_sync_code)
77 then
78 print_status "Syncing code"
79 su $BECOME_USER -c $BASE_DIR/site_utils/site_sync_code || exit 1
82 # --- run database migrations
84 # - AFE
86 print_status "Running AFE migrations"
87 ( cd $BASE_DIR/frontend &&
88 su $BECOME_USER -c "python ../database/migrate.py \
89 --database=AUTOTEST_WEB safesync"
90 su $BECOME_USER -c "python manage.py syncdb --noinput"
91 su $BECOME_USER -c "python manage.py syncdb --noinput"
94 # - TKO
96 print_status "Running TKO migrations"
97 ( cd $BASE_DIR/tko &&
98 su $BECOME_USER -c "python ../database/migrate.py \
99 --database=TKO safesync"
102 # - SITE_DB
104 print_status "Running site_db migrations"
105 ( cd $BASE_DIR/site_db &&
106 su $BECOME_USER -c "python ../database/migrate.py \
107 --database=TKO safesync"
110 # - Django syncdb
112 print_status "Running syncdb on Django interface"
113 # Due to the way Django creates permissions objects, we sometimes need
114 # to run syncdb twice.
115 for i in 1 2; do
116 ( cd $BASE_DIR/frontend &&
117 su $BECOME_USER -c "python manage.py syncdb --noinput"
119 done
121 # --- compile GWT
123 print_status "Compiling GWT code."
124 ( cd $BASE_DIR &&
125 su $BECOME_USER -c "$BASE_DIR/utils/compile_gwt_clients.py -a" || fatal
128 # --- fix gwt permissions
130 print_status "Fixing permissions"
131 ( cd $BASE_DIR/frontend/client &&
132 find | xargs chmod o+r &&
133 find -type d | xargs chmod o+rx ) || fatal
135 # --- update cli repository (site-specific)
137 if (test -x $BASE_DIR/site_utils/site_install_cli)
138 then
139 print_status "Updating cli repository"
140 su $BECOME_USER -c $BASE_DIR/site_utils/site_install_cli || fatal
143 # --- restart autotest persistent code
145 print_status "Restarting autotest persistent code"
146 $INIT_SCR start || fatal
148 # --- possibly restart Apache (site-specific)
150 if (test -x $BASE_DIR/site_utils/site_restart_apache)
151 then
152 print_status "Restarting Apache"
153 su $BECOME_USER -c $BASE_DIR/site_utils/site_restart_apache || fatal
156 # --- do any site-specific finalization
158 if (test -x $BASE_DIR/site_utils/site_restart_final)
159 then
160 print_status "Finalizing release"
161 su $BECOME_USER -c $BASE_DIR/site_utils/site_restart_final || fatal