Commit a0599010 authored by ale's avatar ale

Use /etc/roundcube/my.cnf for mysql config, if present

parent 8f9b7f0c
Pipeline #849 passed with stages
in 3 minutes and 33 seconds
......@@ -13,6 +13,12 @@ TARGET_DIR=/var/www/webmail
# Name of the MySQL database to use.
MYSQL_DB="ai_roundcube"
# If ${CONFIG_DIR}/my.cnf exists, use it as a defaults file for mysql.
MYSQL=mysql
if [ -e "${CONFIG_DIR}/my.cnf" ]; then
MYSQL="${MYSQL} --defaults-file=${CONFIG_DIR}/my.cnf"
fi
die() {
echo "ERROR: $*" >&2
exit 1
......@@ -46,9 +52,9 @@ cur_version=$(mysql -NBe 'select version from rc_version' ${MYSQL_DB} 2>/dev/nul
# If cur_version is empty, it means that the database has not been
# initialized yet.
if [ -z "${cur_version}" ]; then
mysql ${MYSQL_DB} < ${TARGET_DIR}/SQL/mysql.initial.sql \
${MYSQL} ${MYSQL_DB} < ${TARGET_DIR}/SQL/mysql.initial.sql \
|| die "could not load initial SQL schema to ${MYSQL_DB}"
mysql -e "create table rc_version (version text); insert into rc_version (version) values ('unknown')" ${MYSQL_DB} \
${MYSQL} -e "create table rc_version (version text); insert into rc_version (version) values ('unknown')" ${MYSQL_DB} \
|| die "could not create rc_version table in ${MYSQL_DB}"
fi
......@@ -56,6 +62,6 @@ fi
${TARGET_DIR}/bin/update.sh -v ${cur_version} -y \
|| die "Roundcube update script failed"
mysql -e "update rc_version set version='${RC_VERSION}'" ${MYSQL_DB}
${MYSQL} -e "update rc_version set version='${RC_VERSION}'" ${MYSQL_DB}
exit 0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment