annotate scripts/launcher/launch.sh @ 74:8807a553e5bf

xep (jid mention): fixed mention author
author Goffi <goffi@goffi.org>
date Sat, 16 Jan 2016 17:43:54 +0100
parents fe116a11199b
children 4cd5475623eb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
50
fe116a11199b fixes launching script
souliane <souliane@mailoo.org>
parents: 49
diff changeset
1 #!/bin/bash
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
3 # This is a helping script to do some tasks like installing, cleaning, starting sat and/or libervia.
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
4
49
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
5 # Python and resources paths
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
6 PACKAGES=/usr/local/lib/python2.7/dist-packages
49
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
7 SHARE=/usr/local/share
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
8 TMP=~/workspace/tmp_packages
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
9
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
10 # Paths to the projects
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
11 WORKSPACE=~/workspace
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
12 SAT=$WORKSPACE/sat
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
13 PYJS=$WORKSPACE/pyjamas
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
14 LIBERVIA=$WORKSPACE/libervia
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
15 PROSODY=$WORKSPACE/prosody-hg
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
16 SATPUBSUB=$WORKSPACE/sat_pubsub
7
b01ee1b28680 launching script handles "salut" component
souliane <souliane@mailoo.org>
parents: 6
diff changeset
17 SALUT=$WORKSPACE/salut
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
18 URWID_SATEXT=$WORKSPACE/urwid_satext
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
19
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
20 # PIDs of the processes
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
21 LOCAL_DIR=~/.local/share/sat
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
22 SAT_PID=$LOCAL_DIR/sat.pid
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
23 LIB_PID=$LOCAL_DIR/libervia.pid
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
24 SER_PID=$PROSODY/prosody.pid
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
25 SPS_PID=$SATPUBSUB/twistd.pid
7
b01ee1b28680 launching script handles "salut" component
souliane <souliane@mailoo.org>
parents: 6
diff changeset
26 SALUT_PID=$SALUT/twistd.pid
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
27
7
b01ee1b28680 launching script handles "salut" component
souliane <souliane@mailoo.org>
parents: 6
diff changeset
28 # Connection information for Prosody components
6
19448ad3a7d9 add big picture schema + fix launching script
souliane <souliane@mailoo.org>
parents: 3
diff changeset
29 SPS_JID=sat-pubsub.tazar.int
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
30 SPS_PWD=password
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
31
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
32 # Informations for a concurrent sat instance
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
33 # For this to work, you have to follow the instructions in:
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
34 # http://wiki.goffi.org/wiki/Howto_launch_several_S%C3%A0T_instances
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
35 # Also:
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
36 # - modify const_INT_PREFIX in the two DBus.py files
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
37 # - set DAEMON="" in the sat.sh to launch sat as a daemon
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
38 SAT_MAIN=$WORKSPACE/sat_main
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
39 SAT_MAIN_PID=~/.sat_main/sat.pid
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
40
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
41 # 4 Firefox profiles names for testing
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
42 FF_PROFILES=(test1 test2 test3 test4)
6
19448ad3a7d9 add big picture schema + fix launching script
souliane <souliane@mailoo.org>
parents: 3
diff changeset
43 # 4 SàT profiles names for testing
19448ad3a7d9 add big picture schema + fix launching script
souliane <souliane@mailoo.org>
parents: 3
diff changeset
44 SAT_PROFILES=(pierre elisee louise buenaventura)
40
1eb3ec190ea1 add test_accounts to create a batch of testing profiles
souliane <souliane@mailoo.org>
parents: 18
diff changeset
45 # Common profile password for these profiles
49
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
46 SAT_PROFILES_PASSWD=xxxxxx
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
47
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
48 # Launch sat in debug mode?
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
49 SAT_DEBUG=1
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
50 # Launch sat pubsub in debug mode?
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
51 SPS_DEBUG=0
49
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
52 # Launch salut in debug mode?
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
53 SALUT_DEBUG=0
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
54 # Launch libervia in debug mode?
49
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
55 LIB_DEBUG=1
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
56 # Force killing processes?
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
57 KILL_FORCE=1
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
58
49
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
59
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
60 kill_process() {
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
61 # $1 is the file containing the PID to kill
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
62 if [ -f $1 ]; then
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
63 PID=`cat $1`
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
64 if ps -p $PID > /dev/null; then
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
65 if [[ $KILL_FORCE = 1 ]]; then
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
66 kill -9 $PID
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
67 else
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
68 kill -INT $PID
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
69 fi
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
70 fi
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
71 rm -f $1
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
72 fi
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
73 }
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
74
49
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
75 debug_console() {
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
76 PYTHONPATH=$TMP:$PYTHONPATH x-terminal-emulator -e "$@" &
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
77 }
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
78
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
79 install() {
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
80 echo "########## Compiling prosody ##########"
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
81 cd $PROSODY && make
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
82 echo "########## Installing sat_pubsub ##########"
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
83 cd $SATPUBSUB && sudo python setup.py install
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
84 echo "############## Installing sat #############"
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
85 cd $SAT && sudo python setup.py install
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
86 echo "########### Installing libervia ###########"
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
87 cd $LIBERVIA && sudo python setup.py install
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
88 }
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
89
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
90 stop_lib() {
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
91 echo "############ Stopping libervia ############"
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
92 libervia stop
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
93 kill_process $LIB_PID
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
94 }
49
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
95
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
96 stop_sat() {
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
97 echo "############### Stopping sat ##############"
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
98 sat stop
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
99 kill_process $SAT_PID
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
100 }
49
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
101
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
102 stop_sps() {
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
103 kill_process $SPS_PID
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
104 }
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
105
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
106 stop_salut() {
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
107 kill_process $SALUT_PID
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
108 }
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
109
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
110 stop_ser() {
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
111 echo "############# Stopping Prosody ############"
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
112 cd $PROSODY && if [[ -f $SER_PID ]]; then ./prosodyctl stop; fi
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
113 kill_process $SER_PID
7
b01ee1b28680 launching script handles "salut" component
souliane <souliane@mailoo.org>
parents: 6
diff changeset
114 echo "####### Stopping Prosody components #######"
49
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
115 stop_sps
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
116 stop_salut
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
117 echo "####### Stopping bind9 #######"
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
118 sudo /etc/init.d/bind9 stop
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
119
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
120 }
49
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
121
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
122 start_sps() {
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
123 echo "########### Starting sat-pubsub ###########"
49
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
124 cd $SATPUBSUB
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
125 if [[ $SPS_DEBUG = 1 ]]; then
49
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
126 debug_console twistd -n -b sat_pubsub --jid=$SPS_JID --secret=$SPS_PWD
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
127 else
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
128 twistd sat_pubsub --jid=$SPS_JID --secret=$SPS_PWD
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
129 fi
49
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
130 }
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
131
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
132 start_salut() {
7
b01ee1b28680 launching script handles "salut" component
souliane <souliane@mailoo.org>
parents: 6
diff changeset
133 echo "############## Starting salut #############"
49
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
134 cd $SALUT
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
135 if [[ $SALUT_DEBUG = 1 ]]; then
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
136 debug_console twistd -b -y salut.tac
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
137 else
49
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
138 twistd -y salut.tac
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
139 fi
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
140 }
49
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
141
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
142 start_ser() {
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
143 echo "############# Starting Prosody ############"
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
144 cd $PROSODY && ./prosodyctl start &
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
145 start_sps
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
146 start_salut
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
147 echo "############## Starting bind9 #############"
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
148 sudo /etc/init.d/bind9 restart
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
149 }
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
150
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
151 start_sat() {
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
152 echo "############### Starting sat ##############"
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
153 cd $SAT/src
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
154 if [[ $SAT_DEBUG = 1 ]]; then
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
155 debug_console ./sat.sh debug
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
156 else
49
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
157 ./sat.sh
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
158 fi
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
159 }
49
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
160
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
161 start_lib() {
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
162 echo "############ Starting libervia ############"
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
163 cd $LIBERVIA/src/browser
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
164 pyjsbuild libervia_main -d --no-compile-inplace --platforms=mozilla -I $TMP -o $LIBERVIA/html
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
165 cd $LIBERVIA/src
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
166 if [[ $LIB_DEBUG = 1 ]]; then
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
167 debug_console ./libervia.sh debug
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
168 else
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
169 ./libervia.sh
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
170 fi
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
171 }
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
172
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
173 4foxes() {
6
19448ad3a7d9 add big picture schema + fix launching script
souliane <souliane@mailoo.org>
parents: 3
diff changeset
174 # Starts 4 instances of firefox and connect SàT profiles with Libervia
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
175 # Assumes the HTTPS port for local server is 8443
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
176 echo "####### Starting 4 libervia clients #######"
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
177 for I in `seq 0 3`; do
40
1eb3ec190ea1 add test_accounts to create a batch of testing profiles
souliane <souliane@mailoo.org>
parents: 18
diff changeset
178 URL="https://localhost:8443/libervia.html?login=${SAT_PROFILES[$I]}&passwd=${SAT_PROFILES_PASSWD}"
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
179 firefox -no-remote -P ${FF_PROFILES[$I]} "$URL" &
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
180 done
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
181 }
49
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
182
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
183 clean() {
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
184 echo "############ Cleaning log files ###########"
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
185 rm -f $LOCAL_DIR/*.log*
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
186 rm -f $SATPUBSUB/twistd.log*
49
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
187 rm -f $SALUT/twistd.log*
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
188 rm -f $PROSODY/prosody.log* $PROSODY/prosody.err*
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
189 }
49
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
190
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
191 purge() {
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
192 echo "######## Purging installed packages #######"
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
193 rm -rf $PACKAGES/sat
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
194 rm -rf $PACKAGES/sat_frontends
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
195 rm -rf $PACKAGES/libervia
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
196 rm -rf $PACKAGES/libervia_server
49
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
197 rm -rf $SHARE/libervia
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
198 }
49
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
199
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
200 sat_main() {
6
19448ad3a7d9 add big picture schema + fix launching script
souliane <souliane@mailoo.org>
parents: 3
diff changeset
201 echo "######## Starting SàT main instance #######"
49
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
202 cd $SAT_MAIN/lib/sat && hg pull -u && PYTHONPATH=$SAT_MAIN/lib:$PYTHONPATH ./sat.sh
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
203 echo "#### Starting primitivus main instance ####"
49
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
204 cd $SAT_MAIN/lib/sat_frontends/primitivus && PYTHONPATH=$SAT_MAIN/lib:$PYTHONPATH ./primitivus -p souliane
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
205 }
49
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
206
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
207 primitivus_main() {
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
208 echo "#### Starting primitivus main instance ####"
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
209 cd $SAT_MAIN/lib/sat_frontends/primitivus && PYTHONPATH=$SAT_MAIN/lib:$PYTHONPATH ./primitivus
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
210 }
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
211
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
212 bridge() {
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
213 echo "######### Generating DBus.py files ########"
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
214 cd $SAT/src/bridge/bridge_constructor
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
215 ./bridge_constructor.py --force && cp generated/DBus.py ../DBus.py
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
216 ./bridge_constructor.py -s frontend --force && cp generated/DBus.py ../../../frontends/src/bridge/DBus.py
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
217 cd $SAT_MAIN/src/bridge/bridge_constructor
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
218 SAT_BRIDGE_CONST_INT_PREFIX='"org.goffi.sat_main"' ./bridge_constructor.py --force && cp generated/DBus.py ../DBus.py
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
219 SAT_BRIDGE_CONST_INT_PREFIX='"org.goffi.sat_main"' ./bridge_constructor.py -s frontend --force && cp generated/DBus.py ../../../frontends/src/bridge/DBus.py
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
220 }
49
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
221
18
7b337be4052d updated launcher helping script
souliane <souliane@mailoo.org>
parents: 7
diff changeset
222 monitor_core() {
7b337be4052d updated launcher helping script
souliane <souliane@mailoo.org>
parents: 7
diff changeset
223 echo "## Monitoring DBus for SàT dev instance - core ##"
7b337be4052d updated launcher helping script
souliane <souliane@mailoo.org>
parents: 7
diff changeset
224 dbus-monitor "sender='org.goffi.SAT', interface='org.goffi.SAT.core'"
7b337be4052d updated launcher helping script
souliane <souliane@mailoo.org>
parents: 7
diff changeset
225 }
49
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
226
18
7b337be4052d updated launcher helping script
souliane <souliane@mailoo.org>
parents: 7
diff changeset
227 monitor_plugin() {
7b337be4052d updated launcher helping script
souliane <souliane@mailoo.org>
parents: 7
diff changeset
228 echo "## Monitoring DBus for SàT dev instance - plugin ##"
7b337be4052d updated launcher helping script
souliane <souliane@mailoo.org>
parents: 7
diff changeset
229 dbus-monitor "sender='org.goffi.SAT', interface='org.goffi.SAT.plugin'"
7b337be4052d updated launcher helping script
souliane <souliane@mailoo.org>
parents: 7
diff changeset
230 }
49
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
231
18
7b337be4052d updated launcher helping script
souliane <souliane@mailoo.org>
parents: 7
diff changeset
232 monitor_main() {
7b337be4052d updated launcher helping script
souliane <souliane@mailoo.org>
parents: 7
diff changeset
233 echo "## Monitoring DBus for SàT main instance (redirected to /tmp/...) ##"
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
234 killall -q dbus-monitor
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
235 nohup dbus-monitor "sender='org.goffi.sat_main', interface='org.goffi.sat_main.core'" >> /tmp/sat_xml_core_`date +%y.%m.%d`&
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
236 nohup dbus-monitor "sender='org.goffi.sat_main', interface='org.goffi.sat_main.plugin'" >> /tmp/sat_xml_plugin_`date +%y.%m.%d`&
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
237 }
49
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
238
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
239 link_pkgs() {
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
240 echo "## Linking temporary packages directory ##"
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
241 rm -f $TMP/* # avoid to create symlinks like $TMP/sat/src
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
242 mkdir -p $TMP
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
243 ln -s $SAT/src $TMP/sat
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
244 ln -s $SAT/frontends/src $TMP/sat_frontends
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
245 ln -s $LIBERVIA/src $TMP/libervia
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
246 ln -s $WORKSPACE/urwid_satext/urwid_satext $TMP/urwid_satext
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
247 }
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
248
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
249 echo "using temporary directory $TMP"
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
250 export PYTHONPATH=$TMP:$PYTHONPATH
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
251
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
252 case "$1" in
49
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
253 install) install ;;
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
254 stop_lib) stop_lib ;;
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
255 stop_sat) stop_sat ;;
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
256 stop_ser) stop_ser ;;
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
257 start_ser) start_ser ;;
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
258 start_sat) start_sat ;;
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
259 start_lib) start_lib ;;
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
260 stop) stop_lib && stop_sat && stop_ser ;;
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
261 start) start_ser && start_sat && start_lib;;
49
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
262 restart_ser) stop_ser && start_ser ;;
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
263 restart_sat) stop_sat && start_sat ;;
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
264 restart_lib) stop_lib && start_lib ;;
49
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
265 restart_all)
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
266 stop_lib && stop_sat && stop_ser && clean
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
267 start_ser && start_sat && start_lib;;
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
268 restart_sps) stop_sps && start_sps;;
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
269 restart_salut) stop_salut && start_salut ;;
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
270 4foxes) 4foxes ;;
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
271 clean) clean ;;
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
272 purge) clean && purge;;
49
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
273 main) sat_main ;;
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
274 primitivus_main) primitivus_main ;;
18
7b337be4052d updated launcher helping script
souliane <souliane@mailoo.org>
parents: 7
diff changeset
275 bridge) bridge ;;
7b337be4052d updated launcher helping script
souliane <souliane@mailoo.org>
parents: 7
diff changeset
276 monitor_core) monitor_core ;;
7b337be4052d updated launcher helping script
souliane <souliane@mailoo.org>
parents: 7
diff changeset
277 monitor_plugin) monitor_plugin ;;
7b337be4052d updated launcher helping script
souliane <souliane@mailoo.org>
parents: 7
diff changeset
278 monitor_main) monitor_main ;;
49
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
279 link_pkgs) link_pkgs ;;
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
280 *)
49
068252a37689 update launching script
souliane <souliane@mailoo.org>
parents: 40
diff changeset
281 echo "Please specify a valid command."
2
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
282 esac
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
283
3ec5808e3b53 added screenshots + launching script
souliane <souliane@mailoo.org>
parents:
diff changeset
284 echo "Done."