]> git.sur5r.net Git - bacula/bacula/blob - gui/bweb/script/starthttp
bweb: update location title
[bacula/bacula] / gui / bweb / script / starthttp
1 #!/bin/sh
2
3 # start bweb with lighttpd
4
5 BASE=$(dirname $0)
6
7 if [ -f $PWD/html/bweb.js ]; then
8    BWEBBASE=$PWD
9
10 elif [ -f $PWD/../html/bweb.js ]; then
11     BWEBBASE=$(dirname $PWD)
12
13 elif [ -f $BASE/html/bweb.js ]; then
14     BWEBBASE=$BASE
15
16 elif [ -f $BASE/../html/bweb.js ]; then
17     BWEBBASE=$(cd $BASE; dirname $(pwd))
18
19 else
20     echo "Can't determine bweb installation directory"
21     exit 1
22 fi
23
24 if [ ! -f $BWEBBASE/bweb.conf ]; then
25     echo "Making configuration template in $BWEBBASE/bweb.conf"
26     cat > $BWEBBASE/bweb.conf <<EOF
27 \$VAR1 = { template_dir => '$BWEBBASE/lang',
28            bconsole => 'bconsole -n',
29            fv_write_path => '/tmp/',
30  };
31 EOF
32 fi
33
34 host=$(awk -F'"' '/bind/ { print $2 }' $BWEBBASE/script/httpd.conf)
35 port=$(awk '/port/ { print $3 }' $BWEBBASE/script/httpd.conf)
36
37 echo "Using bweb on $BWEBBASE,  use firefox http://$host:$port"
38 export BWEBBASE
39 export BWEBCONF=$BWEBBASE/bweb.conf
40
41 if [ x$1 = x -o x$1 = xstart ]; then
42     lighttpd -f $BWEBBASE/script/httpd.conf
43
44     if [ $? -ne 0 ]; then
45         echo "Something is wrong with lighttpd, be sure that it is installed"
46         exit $?
47     fi
48 fi
49
50 if [ x$1 = xstop ]; then
51     killall lighttpd
52 fi