]> git.sur5r.net Git - bacula/bacula/blob - gui/bweb/script/starthttp
document bweb+lighttpd
[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 else
17     echo "Can't determine bweb installation directory"
18     exit 1
19 fi
20
21 grep /etc/bacula/bweb.conf $BASE/lib/Bweb.pm > /dev/null
22 if [ $? -eq 0 ]; then
23     echo "Adjusting bweb.conf path"
24     sed -i~ "s:/etc/bacula/bweb.conf:$BASE/bweb.conf:" $BASE/lib/Bweb.pm
25 fi
26
27 if [ ! -f $BASE/bweb.conf ]; then
28     echo "Making configuration template in $BASE/bweb.conf"
29     cat > $BASE/bweb.conf <<EOF
30 \$VAR1 = { template_dir => '$PWD/lang',
31            fv_write_path => '/tmp/',
32  };
33 EOF
34 fi
35
36 host=$(awk -F'"' '/bind/ { print $2 }' $BWEBBASE/script/httpd.conf)
37 port=$(awk '/port/ { print $3 }' $BWEBBASE/script/httpd.conf)
38
39 echo "Using bweb on $BWEBBASE,  use firefox http://$host:$port"
40 export BWEBBASE
41
42 if [ x$1 = x -o x$1 = xstart ]; then
43     lighttpd -f $BWEBBASE/script/httpd.conf
44
45     if [ $? -ne 0 ]; then
46         echo "Something is wrong with lighttpd, be sure that it is installed"
47         exit $?
48     fi
49 fi