]> git.sur5r.net Git - bacula/bacula/blobdiff - gui/bweb/install_bweb
bweb: add send_one_cmd that uses Open2 instead of Expect
[bacula/bacula] / gui / bweb / install_bweb
index bc2ccd1fd2728ae962928e3a7c146fbb6b441f47..ec4fbdfb18c3280aa129b69f8c9e8bbc16ebeba1 100755 (executable)
@@ -3,6 +3,13 @@
 # Change the following four environment variables to suit your system
 #   Note, the configuration below works on a stock SuSE 10.2 system
 #
+# You can, in general, execute this file multiple times.  However, if
+#   you edit certain of the installed files, your changes might be lost.
+#   This script will not overwrite any installed /etc/bacula/bweb.conf
+#
+# Configuration directory for bweb
+CONF_DIR=/etc/bacula
+#
 # Root directory of web files       
 #
 WEB_DIR=/srv/www/htdocs 
@@ -35,6 +42,7 @@ fi
 # Normally you should not need to change the following
 #
 # first, copy the bweb perl library into your PERL5 INC path
+sed -i "s!/etc/bacula!${CONF_DIR}!" lib/Bweb.pm
 perl Makefile.PL
 make install
 
@@ -45,17 +53,18 @@ fi
 install -m 755 -o root -g root  cgi/*.pl ${CGI_BIN}/bweb
 
 # get a config file
-if [ ! -d /etc/bacula ] ; then
-   mkdir -m 755 /etc/bacula
-   chown root:bacula /etc/bacula
+if [ ! -d ${CONF_DIR} ] ; then
+   mkdir -m 755 ${CONF_DIR}
+   chown root:bacula ${CONF_DIR}
 fi
 
-# Setup a default /etc/bacula/bweb.conf
-cat > /etc/bacula/bweb.conf <<END_OF_DATA
+# Setup a default ${CONF_DIR}/bweb.conf
+if [ ! -e ${CONF_DIR}/bweb.conf ] ; then
+cat > ${CONF_DIR}/bweb.conf <<END_OF_DATA
 \$VAR1 = bless( {
   'graph_font' => '/usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf',
   'name' => undef,
-  'config_file' => '/etc/bacula/bweb.conf',
+  'config_file' => '${CONF_DIR}/bweb.conf',
   'bconsole' => '/usr/sbin/bconsole -n -c /etc/bacula/bconsole.conf',
   'ach_list' => {
      'S1_L80' => bless( {
@@ -82,6 +91,7 @@ cat > /etc/bacula/bweb.conf <<END_OF_DATA
    },
   'password' => '${DB_PW}',
   'template_dir' => '${SHARE_DIR}/bweb/tpl',
+  'lang' => 'en',
   'dbi' => 'DBI:mysql:database=bacula',
   'error' => '',
   'debug' => 0,
@@ -89,28 +99,36 @@ cat > /etc/bacula/bweb.conf <<END_OF_DATA
   'email_media' => '${EMAIL_ADDR}'
 }, 'Bweb::Config' );
 END_OF_DATA
+fi
 
-chown ${HTTP_USER} /etc/bacula/bweb.conf
+chown ${HTTP_USER} ${CONF_DIR}/bweb.conf
 
 # copy the bweb template file
-if [ ! -d ${SHARE_DIR}/bweb/tpl ] ; then
-   mkdir -p ${SHARE_DIR}/bweb/tpl
+if [ ! -d ${SHARE_DIR}/bweb/tpl/en ] ; then
+   mkdir -p ${SHARE_DIR}/bweb/tpl/{en,fr,es}
 fi
-install -m 644 -o root -g root  tpl/*.tpl ${SHARE_DIR}/bweb/tpl
+install -m 644 -o root -g root  lang/en/tpl/*.tpl ${SHARE_DIR}/bweb/tpl/en
+install -m 644 -o root -g root  lang/es/tpl/*.tpl ${SHARE_DIR}/bweb/tpl/es
+install -m 644 -o root -g root  lang/fr/tpl/*.tpl ${SHARE_DIR}/bweb/tpl/fr
 
 # copy the bweb graphics elements (bweb elements must reside in /bweb)
-if [ ! -d ${WEB_DIR} ] ; then
-   mkdir ${WEB_DIR}/bweb
+if [ ! -d ${WEB_DIR}/bweb ] ; then
+   mkdir -p ${WEB_DIR}/bweb
 fi
 install -m 644 -o root -g root  html/*.{js,png,css,gif,ico,html} ${WEB_DIR}/bweb
 
 echo " "
-echo "Please edit /etc/bweb.conf and ensure that all the paths to"
+echo "Please edit ${CONF_DIR}/bweb.conf and ensure that all the paths to"
 echo "  the various programs and files such as bconsole, bconsole.conf"
 echo "  are correct, and that the DBI driver is correct (default mysql)"
 echo "  and has the right password for your DB"
 echo " "
-
+echo "You have to load sql scripts (in bweb/script) to your database with"
+echo "  something like :"
+echo "   root# mysql bacula < script/bweb-mysql.sql"
+echo "  or"
+echo "   postgres# echo 'CREATE PROCEDURAL LANGUAGE plpgsql;' | psql bacula"
+echo "   postgres# psql -U bacula bacula < script/bweb/bweb-postgresql.sql"
+echo " "
 
 # done !