X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=debian%2Fscripts%2Fkoha-dump;h=bf4bd5f3318bcc34fc62db6a42318c766ea124eb;hb=c7082e4fee931328a1aa83f950de9d259fa12719;hp=2fe9edddeb757f3b9e96d1cf5d837b624db955f4;hpb=98a207ef955effae8d6b26a1c74bddd9a3c9a801;p=koha.git diff --git a/debian/scripts/koha-dump b/debian/scripts/koha-dump index 2fe9edddeb..bf4bd5f331 100755 --- a/debian/scripts/koha-dump +++ b/debian/scripts/koha-dump @@ -19,17 +19,17 @@ set -e +# include helper functions +if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then + . "/usr/share/koha/bin/koha-functions.sh" +else + echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2 + exit 1 +fi # Make sure the files we create are not accessible by anyone else. umask 0077 - -die() { - echo "$@" 1>&2 - exit 1 -} - - # Parse command line. [ "$#" = 1 ] || die "Usage: $0 instancename" name="$1" @@ -44,7 +44,7 @@ mysqlhost="$( xmlstarlet sel -t -v 'yazgfs/config/hostname' $kohaconfig )" mysqldb="$( xmlstarlet sel -t -v 'yazgfs/config/database' $kohaconfig )" mysqluser="$( xmlstarlet sel -t -v 'yazgfs/config/user' $kohaconfig )" mysqlpass="$( xmlstarlet sel -t -v 'yazgfs/config/pass' $kohaconfig )" -backupdir="$( xmlstarlet sel -t -v 'yazgfs/config/backupdir' $kohaconfig )" +backupdir="$( xmlstarlet sel -t -v 'yazgfs/config/backupdir' $kohaconfig || true )" [ -z "$backupdir" ] && backupdir="/var/spool/koha/$name" dbdump="$backupdir/$name-$date.sql.gz" echo "* DB to $dbdump" @@ -54,14 +54,15 @@ mysqldump --databases --host="$mysqlhost" \ chown "root:$name-koha" "$dbdump" chmod g+r "$dbdump" +instancefile="$name.conf" # Dump configs, logs, etc. metadump="$backupdir/$name-$date.tar.gz" echo "* configs, logs to $metadump" tar -C / -czf "$metadump" \ "etc/koha/sites/$name" \ - "etc/apache2/sites-available/$name" \ - "etc/apache2/sites-enabled/$name" \ + "etc/apache2/sites-available/$instancefile" \ + "etc/apache2/sites-enabled/$instancefile" \ "var/lib/koha/$name" \ "var/log/koha/$name"