Making use of new api function to manage configuration in user home
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Backup sequence definitions template.
|
# Backup sequence definitions
|
||||||
# Remove ".example" for customization.
|
|
||||||
|
|
||||||
# A running debian needs at least the following runtime directories created to start up successfully:
|
# A running debian needs at least the following runtime directories created to start up successfully:
|
||||||
## dev
|
## dev
|
||||||
@@ -9,6 +8,7 @@
|
|||||||
## sys
|
## sys
|
||||||
## run
|
## run
|
||||||
|
|
||||||
|
BACKUP_TARGET="/backup"
|
||||||
# Exclude notation "directory/*" creates the directory but NOT its content
|
# Exclude notation "directory/*" creates the directory but NOT its content
|
||||||
BACKUP_EXCLUDES=(\
|
BACKUP_EXCLUDES=(\
|
||||||
"backup*"\
|
"backup*"\
|
||||||
|
@@ -6,38 +6,37 @@ toolName=backup
|
|||||||
# (when called from a different directory)
|
# (when called from a different directory)
|
||||||
WDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >>/dev/null 2>&1 && pwd )"
|
WDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >>/dev/null 2>&1 && pwd )"
|
||||||
CONFIG=0
|
CONFIG=0
|
||||||
CONFIG_FILE="$WDIR/${toolName}.cfg"
|
CONFIG_FILE_NAME="${toolName}.cfg"
|
||||||
CONFIG_FILE_DEFAULT="${CONFIG_FILE}.example"
|
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
|
||||||
|
|
||||||
step_config() {
|
step_config() {
|
||||||
if [ -f "$CONFIG_FILE" ] ; then
|
initSeqConfig -t "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
CONFIG=1
|
CONFIG=1
|
||||||
. "$CONFIG_FILE"
|
|
||||||
elif [ -f "$CONFIG_FILE_DEFAULT" ] ; then
|
|
||||||
echoerr " [W] Using default configuration $CONFIG_FILE_DEFAULT"
|
|
||||||
CONFIG=1
|
|
||||||
. "$CONFIG_FILE_DEFAULT"
|
|
||||||
else
|
else
|
||||||
echoerr " [W] No Configuration found."
|
echoerr " [E] Check output for errors"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
step_1_info() {
|
step_1_info() {
|
||||||
echo "Backup root [ADDITIONAL_EXCLUDES...]"
|
echo "Backup root [ADDITIONAL_EXCLUDES...]"
|
||||||
echoinfo "Essential excludes are provided in the configuration template."
|
echoinfo "Essential excludes are provided in the configuration template."
|
||||||
echoinfo "($CONFIG_FILE_DEFAULT)"
|
echoinfo "($CONFIG_FILE_TEMPLATE)"
|
||||||
}
|
}
|
||||||
step_1_alias() { ALIAS="buroot"; }
|
step_1_alias() { ALIAS="buroot"; }
|
||||||
step_1() {
|
step_1() {
|
||||||
|
local buTarget="/backup"
|
||||||
if [ $CONFIG -eq 0 ] ; then
|
if [ $CONFIG -eq 0 ] ; then
|
||||||
echoerr " [E] Cannot backup root without properly configured excludes"
|
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
|
fi
|
||||||
|
|
||||||
# don't use step number
|
# don't use step number
|
||||||
shift
|
shift
|
||||||
|
|
||||||
step budir / /backup "${BACKUP_EXCLUDES[@]}" "$@"
|
step budir / "$buTarget" "${BACKUP_EXCLUDES[@]}" "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
step_3_info() {
|
step_3_info() {
|
||||||
@@ -96,6 +95,6 @@ step_3() {
|
|||||||
exep "mount -o ro,remount '${BACKUP_TARGET}' >>/dev/null 2>&1"
|
exep "mount -o ro,remount '${BACKUP_TARGET}' >>/dev/null 2>&1"
|
||||||
}
|
}
|
||||||
|
|
||||||
VERSION_SEQREV=9
|
VERSION_SEQREV=10
|
||||||
. /usr/local/bin/sequencer.sh
|
. /usr/local/bin/sequencer.sh
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user