From 86d1c1a7d3086eb979b9d0af2c8413e8c55b722c Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 25 Jun 2017 20:44:00 +0100 Subject: [PATCH] Set database password on koel restore --- src/freedombone-app-koel | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/freedombone-app-koel b/src/freedombone-app-koel index b4841df5..0a0577ea 100755 --- a/src/freedombone-app-koel +++ b/src/freedombone-app-koel @@ -323,7 +323,7 @@ function backup_local_koel { source_directory=/var/www/${KOEL_DOMAIN_NAME}/htdocs if [ -d $source_directory ]; then - systemctl stop koal + systemctl stop koel dest_directory=koel function_check suspend_site @@ -338,7 +338,7 @@ function backup_local_koel { function_check restart_site restart_site - systemctl start koal + systemctl start koel fi } @@ -349,7 +349,7 @@ function restore_local_koel { KOEL_DOMAIN_NAME=$(get_completion_param "koel domain") if [ $KOEL_DOMAIN_NAME ]; then echo $"Restoring koel" - systemctl stop koal + systemctl stop koel temp_restore_dir=/root/tempkoel koel_dir=/var/www/${KOEL_DOMAIN_NAME}/htdocs @@ -361,7 +361,13 @@ function restore_local_koel { if [ -d $temp_restore_dir ]; then rm -rf $temp_restore_dir fi - systemctl start koal + + MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb) + cd /var/www/$KOEL_DOMAIN_NAME/htdocs + sed -i "s|DB_PASSWORD=.*|DB_PASSWORD=$MARIADB_PASSWORD|g" .env + MARIADB_PASSWORD= + + systemctl start koel fi } @@ -370,7 +376,7 @@ function backup_remote_koel { KOEL_DOMAIN_NAME=$(get_completion_param "koel domain") temp_backup_dir=/var/www/${KOEL_DOMAIN_NAME}/htdocs if [ -d $temp_backup_dir ]; then - systemctl stop koal + systemctl stop koel function_check suspend_site suspend_site ${KOEL_DOMAIN_NAME} @@ -386,7 +392,7 @@ function backup_remote_koel { function_check restart_site restart_site - systemctl start koal + systemctl start koel else echo $"koel domain specified but not found in ${temp_backup_dir}" fi @@ -397,7 +403,7 @@ function restore_remote_koel { if grep -q "koel domain" $COMPLETION_FILE; then echo $"Restoring koel" - systemctl stop koal + systemctl stop koel KOEL_DOMAIN_NAME=$(get_completion_param "koel domain") @@ -410,7 +416,12 @@ function restore_remote_koel { rm -rf /root/tempkoel fi - systemctl start koal + MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb) + cd /var/www/$KOEL_DOMAIN_NAME/htdocs + sed -i "s|DB_PASSWORD=.*|DB_PASSWORD=$MARIADB_PASSWORD|g" .env + MARIADB_PASSWORD= + + systemctl start koel echo $"Restore of koel complete" fi