Making use of new api function to manage configuration in user home

This commit is contained in:
2020-01-13 11:49:37 +01:00
parent 4b4df3132a
commit e883306fc9
2 changed files with 14 additions and 15 deletions

View File

@@ -1,7 +1,6 @@
#!/bin/bash
# Backup sequence definitions template.
# Remove ".example" for customization.
# Backup sequence definitions
# A running debian needs at least the following runtime directories created to start up successfully:
## dev
@@ -9,6 +8,7 @@
## sys
## run
BACKUP_TARGET="/backup"
# Exclude notation "directory/*" creates the directory but NOT its content
BACKUP_EXCLUDES=(\
"backup*"\

View File

@@ -6,38 +6,37 @@ toolName=backup
# (when called from a different directory)
WDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >>/dev/null 2>&1 && pwd )"
CONFIG=0
CONFIG_FILE="$WDIR/${toolName}.cfg"
CONFIG_FILE_DEFAULT="${CONFIG_FILE}.example"
CONFIG_FILE_NAME="${toolName}.cfg"
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
step_config() {
if [ -f "$CONFIG_FILE" ] ; then
initSeqConfig -t "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
if [ $? -eq 0 ] ; then
CONFIG=1
. "$CONFIG_FILE"
elif [ -f "$CONFIG_FILE_DEFAULT" ] ; then
echoerr " [W] Using default configuration $CONFIG_FILE_DEFAULT"
CONFIG=1
. "$CONFIG_FILE_DEFAULT"
else
echoerr " [W] No Configuration found."
echoerr " [E] Check output for errors"
fi
}
step_1_info() {
echo "Backup root [ADDITIONAL_EXCLUDES...]"
echoinfo "Essential excludes are provided in the configuration template."
echoinfo "($CONFIG_FILE_DEFAULT)"
echoinfo "($CONFIG_FILE_TEMPLATE)"
}
step_1_alias() { ALIAS="buroot"; }
step_1() {
local buTarget="/backup"
if [ $CONFIG -eq 0 ] ; then
echoerr " [E] Cannot backup root without properly configured excludes"
echoerr " (expected template: $CONFIG_FILE_DEFAULT)"
echoerr " (expected config: $SEQ_CONFIG_HOME/$CONFIG_FILE_NAME)"
else
buTarget="$BACKUP_TARGET"
fi
# don't use step number
shift
step budir / /backup "${BACKUP_EXCLUDES[@]}" "$@"
step budir / "$buTarget" "${BACKUP_EXCLUDES[@]}" "$@"
}
step_3_info() {
@@ -96,6 +95,6 @@ step_3() {
exep "mount -o ro,remount '${BACKUP_TARGET}' >>/dev/null 2>&1"
}
VERSION_SEQREV=9
VERSION_SEQREV=10
. /usr/local/bin/sequencer.sh