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 9ec6139 commit 96d4529
Showing 1 changed file with 44 additions and 22 deletions.
66 changes: 44 additions & 22 deletions debian/bareos-database-common.config.in
Expand Up @@ -56,27 +56,30 @@ if [ -r @scriptdir@/bareos-config-lib.sh ]; then
# As soon as there is a database version 2003,
# we can always set dbc_first_version="2003"
if dpkg --compare-versions "$param2_orig" lt "14.1.0"; then
bareos_migrate_to_dbconfig="yes"
dbc_first_version="2003"
dbc_load_include="sh:/usr/lib/bareos/scripts/set_dbconfig_vars.sh"
# empty passwords require special treatment, see below
bareos_database_password=`get_database_password` || true
case "`get_database_driver`" in
postgresql)
if [ -z "${bareos_database_password}" ]; then
dbc_authmethod_user="ident"
fi
;;
sqlite3)
# dbconfig expects sqlite files as "dbname.db"
# while Bareos expects them as "dbname".
# A link is created, so that both names maps.
if [ -e "${dbc_basepath}/${dbc_dbname}.db" ]; then
if ! [ -e "${dbc_basepath}/${dbc_dbname}" ]; then
ln -s "${dbc_basepath}/${dbc_dbname}.db" "${dbc_basepath}/${dbc_dbname}"
fi
fi
;;
esac
# case "`get_database_driver`" in
# postgresql)
# if [ -z "${bareos_database_password}" ]; then
# dbc_authmethod_user="ident"
# fi
# ;;
# mysql)
#
# sqlite3)
# # dbconfig expects sqlite files as "dbname.db"
# # while Bareos expects them as "dbname".
# # A link is created, so that both names maps.
# if [ -e "${dbc_basepath}/${dbc_dbname}.db" ]; then
# if ! [ -e "${dbc_basepath}/${dbc_dbname}" ]; then
# ln -s "${dbc_basepath}/${dbc_dbname}.db" "${dbc_basepath}/${dbc_dbname}"
# fi
# fi
# ;;
# esac
fi
;;
*)
Expand All @@ -85,11 +88,30 @@ if [ -r @scriptdir@/bareos-config-lib.sh ]; then
fi

dbc_go bareos-database-common $param1 $param2 $@
# workaround: if an empty mysql password is defined, explicitly set it
if get_database_driver | grep -q mysql; then
if [ -z "${bareos_database_password}" ]; then
db_set bareos-database-common/mysql/app-pass ""
fi
if [ "$bareos_migrate_to_dbconfig" = "yes" ]; then
case "`get_database_driver`" in
postgresql)
if [ -z "${bareos_database_password}" ]; then
db_set bareos-database-common/pgsql/authmethod-user "ident"
fi
;;
mysql)
if [ -z "${bareos_database_password}" ]; then
# workaround: if an empty mysql password is defined, explicitly set it
db_set bareos-database-common/mysql/app-pass ""
fi
;;
sqlite3)
# dbconfig expects sqlite files as "dbname.db"
# while Bareos expects them as "dbname".
# A link is created, so that both names maps.
if [ -e "${dbc_basepath}/${dbc_dbname}.db" ]; then
if ! [ -e "${dbc_basepath}/${dbc_dbname}" ]; then
ln -s "${dbc_basepath}/${dbc_dbname}.db" "${dbc_basepath}/${dbc_dbname}"
fi
fi
;;
esac
fi
fi
fi

0 comments on commit 96d4529

Please sign in to comment.