Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3a7251d84e |
@@ -34,16 +34,23 @@ Example file is `stanza.sample.cfg`
|
||||
|
||||
This files holds the stanzas to backup
|
||||
|
||||
`stanza:repo number:path to config file`
|
||||
`stanza:repo number:path to config file:super user`
|
||||
|
||||
If the stanza has several repo settings as in "repo1-...", "repo2-..." then the repo to target can be listed in here by ":repo number"
|
||||
|
||||
The third optional parameter is a config file path
|
||||
|
||||
The forth optional parameter is the super user to use
|
||||
|
||||
If parameters are not used but laters are, the empties need to be set with just the ":"
|
||||
|
||||
`stanza::/conifg`
|
||||
|
||||
```ini
|
||||
[stanzas]
|
||||
stanza_a
|
||||
stanza_b:1
|
||||
stanza_b:2
|
||||
stanza_c::/etc/to/config
|
||||
stanza_d:::super user
|
||||
```
|
||||
|
||||
@@ -185,6 +185,8 @@ while read -r stanza; do
|
||||
stanza_repo=$(echo "${stanza}" | awk -F':' '{print (NF>1) ? $2 : ""}');
|
||||
# if we have a config
|
||||
stanza_config=$(echo "${stanza}" | awk -F':' '{print (NF>1) ? $3 : ""}');
|
||||
# for possible override super user
|
||||
stanza_super_user=$(echo "${stanza}" | awk -F':' '{print (NF>3) ? $4 : ""}');
|
||||
# override stanza check
|
||||
if [ -n "${OVERRIDE_STANZA}" ]; then
|
||||
# skip if not matching name
|
||||
@@ -198,6 +200,7 @@ while read -r stanza; do
|
||||
fi;
|
||||
# set repo from override
|
||||
stanza_repo="${OVERRIDE_STANZA_REPO}";
|
||||
# config
|
||||
OVERRIDE_STANZA_CONFIG=$(echo "${OVERRIDE_STANZA}" | awk -F':' '{print (NF>2) ? $3 : ""}');
|
||||
# if we have a config set in the stanza config, but none in the override, use the one from the stanza config
|
||||
if [ -z "${OVERRIDE_STANZA_CONFIG}" ] && [ -n "${stanza_config}" ]; then
|
||||
@@ -205,6 +208,17 @@ while read -r stanza; do
|
||||
else
|
||||
stanza_config="${OVERRIDE_STANZA_CONFIG}";
|
||||
fi;
|
||||
# super user
|
||||
OVERRIDE_STANZA_SUPER_USER=$(echo "${OVERRIDE_STANZA}" | awk -F':' '{print (NF>3) ? $4 : ""}');
|
||||
if [ -z "${OVERRIDE_STANZA_SUPER_USER}" ] && [ -n "${stanza_super_user}" ]; then
|
||||
OVERRIDE_STANZA_SUPER_USER="${stanza_super_user}";
|
||||
else
|
||||
stanza_super_user="${OVERRIDE_STANZA_SUPER_USER}";
|
||||
fi;
|
||||
fi;
|
||||
# set override sudo user
|
||||
if [ -n "${stanza_super_user}" ]; then
|
||||
sudo_user="${stanza_super_user}";
|
||||
fi;
|
||||
# build the call command
|
||||
CALL=(
|
||||
|
||||
@@ -3,3 +3,4 @@ stanza_a
|
||||
stanza_b:1
|
||||
stanza_b:2
|
||||
stanca_c::/path/to/config/file
|
||||
stanza_d:::super_user
|
||||
|
||||
Reference in New Issue
Block a user