Skip to content

Commit

Permalink
dbconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
joergsteffens committed May 7, 2014
1 parent 96d4529 commit ae2f13c
Showing 1 changed file with 26 additions and 13 deletions.
39 changes: 26 additions & 13 deletions scripts/bareos-config-lib.sh.in
Expand Up @@ -573,23 +573,36 @@ apply_dbconfig_settings()
# check if dbconfig is enabled
[ $dbc_upgrade = 'true' ] || return 0

case "$dbc_dbtype" in
pgsql)
set_config_param "${CFG_DIR}" "Catalog" "MyCatalog" "dbdriver" "postgresql"
;;
mysql)
set_config_param "${CFG_DIR}" "Catalog" "MyCatalog" "dbdriver" "mysql"
;;
sqlite3)
set_config_param "${CFG_DIR}" "Catalog" "MyCatalog" "dbdriver" "sqlite3"
# dbconfig creates the db file as ${dbc_basepath}/${dbc_dbname}
# while bareos expects the sqlite3 db file
# as ${dbc_basepath}/${dbc_dbname}.db
# Therefore a link is created.
if [ -r "${dbc_basepath}/${dbc_dbname}" ]; then
BAREOS_SQLITE_DB="`get_working_dir`/`get_database_name`.db"
if ! [ -e $BAREOS_SQLITE_DB ]; then
ln -s "${dbc_basepath}/${dbc_dbname}" "$BAREOS_SQLITE_DB"
ls -a `get_working_dir`/bareos* || true
fi
fi
;;
*)
error "unknown database type $dbc_dbtype in /etc/dbconfig-common/bareos-database-common.conf"
return 1
esac

if [ "$dbc_authmethod_user" != "ident" ] && [ "$dbc_dbpass" ]; then
set_config_param "${CFG_DIR}" "Catalog" "MyCatalog" "dbpassword" "$dbc_dbpass"
fi

if [ "$dbc_dbtype" = "sqlite3" ]; then
# dbconfig creates the db file as ${dbc_basepath}/${dbc_dbname}
# while bareos expects the sqlite3 db file
# as ${dbc_basepath}/${dbc_dbname}.db
# Therefore a link is created.
if [ -r "${dbc_basepath}/${dbc_dbname}" ]; then
BAREOS_SQLITE_DB="`get_working_dir`/`get_database_name`.db"
if ! [ -e $BAREOS_SQLITE_DB ]; then
ln -s "${dbc_basepath}/${dbc_dbname}" "$BAREOS_SQLITE_DB"
ls -a `get_working_dir`/bareos* || true
fi
fi
fi
}

get_local_hostname()
Expand Down

0 comments on commit ae2f13c

Please sign in to comment.