Compare commits

..

No commits in common. "6390f3f284c427f6d47bfb8d821599911aa9423f" and "74b94e4c644745c02c57da3dcac9c57cdee61bdb" have entirely different histories.

View File

@ -140,14 +140,6 @@ echo_wait(){
fi
}
## - Check if a given array (parameter 2) contains a given string (parameter 1)
## -
containsElement () {
local e
for e in "${@:2}"; do [[ "$e" == "$1" ]] && return 0; done
return 1
}
trim() {
local var="$*"
var="${var#"${var%%[![:space:]]*}"}" # remove leading whitespace characters
@ -320,28 +312,14 @@ BORG_LOG_FILE="${BORG_LOG_DIR}/borg-backup.log"
if [[ -z "${DB_TYPE}" ]] ; then
DB_TYPE="${DEFAULT_DB_TYPE}"
else
# replace comma by blank sign
DB_TYPE=${DB_TYPE/,/ }
fi
declare -a db_type_arr=()
for _db_type in ${DB_TYPE}; do
if [[ "${DB_TYPE,,}" = "psql" ]] || [[ "${DB_TYPE,,}" = "postgresql" ]] || [[ "${DB_TYPE,,}" = "postgres" ]] ; then
db_type_arr+=("postgresql")
else
db_type_arr+=("${_db_type,,}")
fi
done
if containsElement "mysql" "${db_type_arr[@]}" ; then
elif [[ "${DB_TYPE,,}" = "mysql" ]] ; then
[[ -z "${MYSQL_CREDENTIALS}" ]] && MYSQL_CREDENTIALS="${DEFAULT_MYSQL_CREDENTIALS}"
elif [[ "${DB_TYPE,,}" = "psql" ]] || [[ "${DB_TYPE,,}" = "postgresql" ]] || [[ "${DB_TYPE,,}" = "postgres" ]] ; then
[[ -z "${PSQL_SYSTEM_USER}" ]] && PSQL_SYSTEM_USER="${DEFAULT_PSQL_SYSTEM_USER}"
else
fatal "Unknown DB_TYPE '${DB_TYPE}'."
fi
if containsElement "postgresql" "${db_type_arr[@]}" ; then
[[ -z "${PSQL_SYSTEM_USER}" ]] && PSQL_SYSTEM_USER="${DEFAULT_PSQL_SYSTEM_USER}"
fi
[[ -z "${BACKUP_DIRECTORIES}" ]] && BACKUP_DIRECTORIES="${DEFAULT_BACKUP_DIRECTORIES}"
@ -450,9 +428,7 @@ if [[ -n "${DB_TYPE}" ]] && [[ "${DB_TYPE,,}" = "!none" ]]; then
blank_line
fi
if containsElement "mysql" "${db_type_arr[@]}" ; then
blank_line
if [[ "${DB_TYPE,,}" = "mysql" ]] ; then
echononl "Create an array of MySQL databases."
@ -514,11 +490,8 @@ EOF
fi
done
fi
if containsElement "postgresql" "${db_type_arr[@]}" ; then
blank_line
elif [[ "${DB_TYPE,,}" = "psql" ]] || [[ "${DB_TYPE,,}" = "postgresql" ]] || [[ "${DB_TYPE,,}" = "postgres" ]] ; then
echononl "Create an array of PostgreSQL databases."
@ -578,8 +551,6 @@ EOF
fi
blank_line
echononl "Create borg backup.."