From a53d252d695058f102451e521e74f3c306ab08aa Mon Sep 17 00:00:00 2001 From: Christoph Date: Sun, 5 Nov 2017 04:39:08 +0100 Subject: [PATCH] Fix errors accesseing Mysql database for installation/upgrading roundcube webmailer. --- install_roundcube.sh | 26 ++++++++++++++++++++------ upgrade_roundcube.sh | 6 +++--- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/install_roundcube.sh b/install_roundcube.sh index f36fc22..1d92063 100755 --- a/install_roundcube.sh +++ b/install_roundcube.sh @@ -624,6 +624,20 @@ else fi +echononl "\tChange ownership of ${HTTP_USER}'s home directory" +if [[ "$(stat -c "%U" "/var/www")" != "$HTTP_USER" ]]; then + chown $HTTP_USER:${HTTP_GROUP} "/var/www" > $log_file 2>&1 + if [[ "$?" = "0" ]]; then + echo_ok + else + echo_failed + error "$(cat $log_file)" + fi +else + echo_skipped +fi + + echononl "\tInstall PHP dependencies.." #/usr/local/php-${php_latest_ver}/bin/php /usr/local/bin/composer install --no-dev su www-data -c"cd ${WEBSITE_BASEDIR}/roundcubemail-${ROUNDCUBE_VERSION} @@ -1816,7 +1830,7 @@ echononl "\tBackup existing Database '$DB_NAME'" if $database_exists ; then if [[ "$DB_TYPE" = "mysql" ]]; then echo -n " (MySQL).." - mysqldump -u$_mysql_rootuser -p$_mysql_rootpass --opt $DB_NAME > ${WEBSITE_BASEDIR}/${DB_NAME}.$backup_date 2> $log_file + mysqldump $MYSQL_CREDENTIALS --opt $DB_NAME > ${WEBSITE_BASEDIR}/${DB_NAME}.$backup_date 2> $log_file if [[ $? -eq 0 ]]; then echo_ok else @@ -2165,7 +2179,7 @@ else echo_failed error "$(cat $log_file)" fi -echononl "\tCeate Symlink '$_pligin' in plugin folder.." +echononl "\tCeate Symlink '$_plugin' in plugin folder.." ln -s Roundcube-Plugin-Context-Menu-master \ ${WEBSITE_BASEDIR}/roundcubemail-${ROUNDCUBE_VERSION}/plugins/${_plugin} > $log_file 2>&1 if [[ $? -eq 0 ]] ; then @@ -2221,7 +2235,7 @@ else error "$(cat $log_file)" fi -echononl "\tCeate Symlink '$_pligin' in plugin folder.." +echononl "\tCeate Symlink '$_plugin' in plugin folder.." ln -s roundcube-login-language-master \ ${WEBSITE_BASEDIR}/roundcubemail-${ROUNDCUBE_VERSION}/plugins/${_plugin} > $log_file 2>&1 if [[ $? -eq 0 ]] ; then @@ -2334,7 +2348,7 @@ else echo_failed error "$(cat $log_file)" fi -echononl "\tCeate Symlink '$_pligin' in plugin folder.." +echononl "\tCeate Symlink '$_plugin' in plugin folder.." ln -s Roundcube-Plugin-Mark-as-Junk-2-master \ ${WEBSITE_BASEDIR}/roundcubemail-${ROUNDCUBE_VERSION}/plugins/${_plugin} > $log_file 2>&1 if [[ $? -eq 0 ]] ; then @@ -2514,7 +2528,7 @@ else error "$(cat $log_file)" fi -echononl "\tCeate Symlink '$_pligin' in plugin folder.." +echononl "\tCeate Symlink '$_plugin' in plugin folder.." ln -s rc-vacation-master \ ${WEBSITE_BASEDIR}/roundcubemail-${ROUNDCUBE_VERSION}/plugins/${_plugin} > $log_file 2>&1 if [[ $? -eq 0 ]] ; then @@ -3269,7 +3283,7 @@ else echononl "\tCreate function 'FORWARDERS_IN'" echo_skipped - warn "Create fubctions 'FORWARDERS_OUT' and 'FORWARDERS_IN' not yet implemented" + warn "Create functions 'FORWARDERS_OUT' and 'FORWARDERS_IN' not yet implemented" fi diff --git a/upgrade_roundcube.sh b/upgrade_roundcube.sh index 3565588..386b719 100755 --- a/upgrade_roundcube.sh +++ b/upgrade_roundcube.sh @@ -233,7 +233,7 @@ echo -e "\n\n \033[37m\033[1mCreate some Backups..\033[m\n" echononl " Backup existing Database '$DB_NAME'" if [[ "$DB_TYPE" = "mysql" ]]; then echo -n " (MySQL).." - mysqldump -u$_mysql_rootuser -p$_mysql_rootpass --opt $DB_NAME > ${WEBSITE_BASEDIR}/${DB_NAME}.$backup_date 2> $log_file + mysqldump $MYSQL_CREDENTIALS --opt $DB_NAME > ${WEBSITE_BASEDIR}/${DB_NAME}.$backup_date.sql 2> $log_file if [[ $? -eq 0 ]]; then echo_ok else @@ -332,7 +332,7 @@ fi echononl " Stop Apache Webserver.." if $SYSTEMD_EXISTS ; then - systemctl stop apache2 + systemctl stop apache2 > $log_file 2>&1 if [[ $? -eq 0 ]]; then echo_ok else @@ -340,7 +340,7 @@ if $SYSTEMD_EXISTS ; then fatal "$(cat $log_file)" fi else - /etc/init.d/apache2 stop + /etc/init.d/apache2 stop > ${logdir}/main.log 2>&1 if [[ $? -eq 0 ]]; then echo_ok else