annotate scripts/launcher/launch.sh @ 130:82b148ed4f98

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