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.,
# 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)"
+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';