From dd1d6e62e0d32ec4af35a30fce0244b526b999c2 Mon Sep 17 00:00:00 2001 From: nachoparker Date: Sun, 19 Nov 2017 23:07:30 +0100 Subject: nc-restore: fix restore passwod --- etc/nextcloudpi-config.d/nc-restore.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/etc/nextcloudpi-config.d/nc-restore.sh b/etc/nextcloudpi-config.d/nc-restore.sh index 64c3074a..f43ddf44 100644 --- a/etc/nextcloudpi-config.d/nc-restore.sh +++ b/etc/nextcloudpi-config.d/nc-restore.sh @@ -31,6 +31,8 @@ You can use nc-backup" configure() { + local DBPASSWD=$( grep password /root/.my.cnf | cut -d= -f2 ) + [ -f $BACKUPFILE_ ] || { echo -e "$BACKUPFILE_ not found"; return 1; } [ -d $BASEDIR ] || { echo -e "$BASEDIR not found"; return 1; } [ -d $BASEDIR/nextcloud ] && { echo -e "INFO: overwriting old instance"; } @@ -48,11 +50,10 @@ configure() mv "$TMPDIR"/nextcloud $BASEDIR || { echo -e "Error restoring base files"; return 1; } # update NC database password to this instance - sed -i "s|'dbpassword' =>.*|'dbpassword' => '$DBPASSWD',|" config/config.php + sed -i "s|'dbpassword' =>.*|'dbpassword' => '$DBPASSWD',|" $BASEDIR/nextcloud/config/config.php ## RE-CREATE DATABASE TABLE - local DBPASSWD=$( grep password /root/.my.cnf | cut -d= -f2 ) echo -e "restore database..." mysql -u root <