]> git.sur5r.net Git - bacula/bacula/blob - gui/bweb/install_bweb
63b5892118b789815f8c1202b0927fa61c0a14b8
[bacula/bacula] / gui / bweb / install_bweb
1 #!/bin/sh
2 #
3 # Change the following four environment variables to suit your system
4 #   Note, the configuration below works on a stock SuSE 10.2 system
5 #
6 # You can, in general, execute this file multiple times.  However, if
7 #   you edit certain of the installed files, your changes might be lost.
8 #   This script will not overwrite any installed /etc/bacula/bweb.conf
9 #
10 # Root directory of web files       
11 #
12 WEB_DIR=/srv/www/htdocs 
13 #
14 # share directory for programs
15 #
16 SHARE_DIR=/usr/share
17 #
18 # cgi_bin location for web server
19 #
20 CGI_BIN=/srv/www/cgi-bin
21 #
22 # Userid the web server is running under
23 #
24 HTTP_USER=wwwrun
25 HTTP_GROUP=www
26
27 # Bacula database name and password
28 DB=bacula
29 DB_PW=""
30 EMAIL_ADDR="xxx@localhost"
31 MTX="/sbin/mtx"
32
33 if [ `whoami` != "root" ] ; then
34   echo "You must be root to run this script."
35   exit 1
36 fi
37
38 #
39 # Normally you should not need to change the following
40 #
41 # first, copy the bweb perl library into your PERL5 INC path
42 perl Makefile.PL
43 make install
44
45 # copy the bweb perl program to your cgi location
46 if [ ! -d ${CGI_BIN}/bweb ] ; then
47    mkdir -m 755 ${CGI_BIN}/bweb
48 fi
49 install -m 755 -o root -g root  cgi/*.pl ${CGI_BIN}/bweb
50
51 # get a config file
52 if [ ! -d /etc/bacula ] ; then
53    mkdir -m 755 /etc/bacula
54    chown root:bacula /etc/bacula
55 fi
56
57 # Setup a default /etc/bacula/bweb.conf
58 if [ ! -e /etc/bacula/bweb.conf ] ; then
59 cat > /etc/bacula/bweb.conf <<END_OF_DATA
60 \$VAR1 = bless( {
61   'graph_font' => '/usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf',
62   'name' => undef,
63   'config_file' => '/etc/bacula/bweb.conf',
64   'bconsole' => '/usr/sbin/bconsole -n -c /etc/bacula/bconsole.conf',
65   'ach_list' => {
66      'S1_L80' => bless( {
67          'info' => {
68                      'drive' => 0,
69                      'io' => 0,
70                      'slot' => 0
71                    },
72          'name' => 'S1_L80',
73          'bweb' => undef,
74          'device' => '/dev/changer',
75          'drive' => [],
76          'debug' => 0,
77          'label' => {},
78          'precmd' => 'sudo',
79          'io' => [],
80          'mtxcmd' => '${MTX}',
81          'drive_name' => [
82                            'S1_L80_SDLT0',
83                            'S1_L80_SDLT1'
84                          ],
85          'slot' => []
86        }, 'Bweb::Autochanger' )
87    },
88   'password' => '${DB_PW}',
89   'template_dir' => '${SHARE_DIR}/bweb/tpl',
90   'dbi' => 'DBI:mysql:database=bacula',
91   'error' => '',
92   'debug' => 0,
93   'user' => '${DB}',
94   'email_media' => '${EMAIL_ADDR}'
95 }, 'Bweb::Config' );
96 END_OF_DATA
97 fi
98
99 chown ${HTTP_USER} /etc/bacula/bweb.conf
100
101 # copy the bweb template file
102 if [ ! -d ${SHARE_DIR}/bweb/tpl ] ; then
103    mkdir -p ${SHARE_DIR}/bweb/tpl
104 fi
105 install -m 644 -o root -g root  tpl/*.tpl ${SHARE_DIR}/bweb/tpl
106
107 # copy the bweb graphics elements (bweb elements must reside in /bweb)
108 if [ ! -d ${WEB_DIR} ] ; then
109    mkdir ${WEB_DIR}/bweb
110 fi
111 install -m 644 -o root -g root  html/*.{js,png,css,gif,ico,html} ${WEB_DIR}/bweb
112
113 echo " "
114 echo "Please edit /etc/bweb.conf and ensure that all the paths to"
115 echo "  the various programs and files such as bconsole, bconsole.conf"
116 echo "  are correct, and that the DBI driver is correct (default mysql)"
117 echo "  and has the right password for your DB"
118 echo " "
119  
120
121
122 # done !