updated release notes for 3.14.0 beta
[koha.git] / debian / scripts / koha-restore
index 6e15fd0..caf4c7d 100755 (executable)
@@ -54,7 +54,7 @@ name=$(tar tf "$configdump" |
        sed -n '/^etc\/koha\/sites\/\([^/]*\)\/$/s//\1/p')
 username="$name-koha"
 adduser --no-create-home --disabled-login --gecos "Koha instance $username" \
-    --quiet "$username"
+    --home "/var/lib/koha/$name" --quiet "$username"
 
 
 # Create dirs. Some of them will be in the tarball, but not all, e.g.,
@@ -69,12 +69,12 @@ tar -C / -xf "$configdump"
 # Re-create database and database user.
 mysqldb="koha_$name"
 mysqluser="koha_$name"
-mysqlpwd="$(sed -n '/.*<pass>\(.*\)<\/pass>.*/s//\1/p' /etc/koha/sites/$name/koha-conf.xml)"
-zcat "$sqldump" | mysql --defaults-extra-file=/etc/mysql/debian.cnf
-mysql --defaults-extra-file=/etc/mysql/debian.cnf <<eof || true
+mysqlpwd="$( xmlstarlet sel -t -v 'yazgfs/config/pass' /etc/koha/sites/$name/koha-conf.xml )"
+zcat "$sqldump" | mysql --defaults-extra-file=/etc/mysql/koha-common.cnf
+mysql --defaults-extra-file=/etc/mysql/koha-common.cnf <<eof || true
 DROP USER '$mysqluser';
 eof
-mysql --defaults-extra-file=/etc/mysql/debian.cnf << eof || true
+mysql --defaults-extra-file=/etc/mysql/koha-common.cnf << eof || true
 CREATE USER '$mysqluser' IDENTIFIED BY '$mysqlpwd';
 GRANT ALL PRIVILEGES ON $mysqldb.* TO '$mysqluser';
 FLUSH PRIVILEGES;