fix behaviour with UTF-8 file names; make mysql backup source depend on uberspace version

This commit is contained in:
2020-11-06 15:13:37 +01:00
parent 31105d3875
commit 4c8127c388
2 changed files with 14 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
# SPDX-FileCopyrightText: 2019 Max Mehl <mail [at] mehl [dot] mx>
# SPDX-License-Identifier: CC0-1.0
# Username@Hostname; Path1 | Path2 | Path3
# Username@Hostname; Path1 | Path2 | Path3; Uberspace version (default = 7)
root@server; /home
user@host.uberspace.de; %virtual | %mysql | /home/user/service

View File

@@ -9,6 +9,9 @@
#
########################################################################
# Set correct UTF-8 encoding (for FreeBSD jail)
export LC_ALL=en_US.UTF-8
CURDIR=$(dirname "$(readlink -f "$0")")
if [ ! -e "$CURDIR"/config.cfg ]; then echo "Missing config.cfg file. Edit and rename config.cfg.sample"; exit 1; fi
source "$CURDIR"/config.cfg
@@ -41,12 +44,13 @@ function logecho {
}
while read line; do
# if line is a comment, go to next line
if $(echo "$line" | grep -qE "^\s*#"); then continue; fi
# if line is a comment or blank, go to next line
if $(echo "$line" | grep -qE "^\s*(#|$)"); then continue; fi
RHOST=$(echo "$line" | cut -d";" -f1 | trim)
RUSER=$(echo "$RHOST" | cut -d"@" -f1)
ALLRDIR=$(echo "$line" | cut -d";" -f2 | trim)
US_VERSION=$(echo "$line" | cut -d";" -f3 | trim)
logecho "${RHOST}: Starting backups"
@@ -80,7 +84,13 @@ while read line; do
# Set Source directory, and make exception for %mysql
SOURCE="${RDIR}"
if [ "${RDIR}" == "mysql" ]; then SOURCE=/mysqlbackup/latest/${RUSER}; fi
if [ "${RDIR}" == "mysql" ]; then
if [[ $US_VERSION == 6 ]]; then
SOURCE=/mysqlbackup/latest/${RUSER}
else
SOURCE=/mysql_backup/current/${RUSER}
fi
fi
# Create backup destination if necessary
if [ ! -e "${DEST}" ]; then mkdir -p "${DEST}"; fi