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