From 3fdeadf1f19f08995d610d0dc4cf7fb2893bd8f1 Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Mon, 17 Oct 2022 12:45:47 +0200 Subject: Update backup subcommand to use new config_subkeys semantics --- lib/subcommands/backup.bash | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'lib/subcommands/backup.bash') diff --git a/lib/subcommands/backup.bash b/lib/subcommands/backup.bash index 9a23ede..0d3f22d 100644 --- a/lib/subcommands/backup.bash +++ b/lib/subcommands/backup.bash @@ -22,9 +22,9 @@ subcommand() { then debug "$BASHTARD_NAME/backup" "Retrieving elements from config" - while read -r element + while read -r key do - set -- "$@" "$(config "$element")" + set -- "$@" "$(config "bashtard.backup.elements.$key")" done < <(config_subkeys "bashtard.backup.elements") fi @@ -39,14 +39,12 @@ subcommand() { # Loop over all repositories, and run backup functions for each of them while read -r key do - index="$(awk -F. '{ print $NF }' <<< "$key")" - for element in "$@" do - "backup_$element" "$index" + "backup_$element" "$key" done - info "$BASHTARD_NAME/backup/$index" "Backups completed" + info "$BASHTARD_NAME/backup/$key" "Backups completed" done < <(config_subkeys "bashtard.backup.repositories") } @@ -93,9 +91,9 @@ backup_filesystem() { ) # Add all paths to the command - while read -r path + while read -r key do - cmd_create+=("$(config "$path")") + cmd_create+=("$(config "bashtard.backup.fs.paths.$key")") done < <(config_subkeys "bashtard.backup.fs.paths") notice "$BASHTARD_NAME/backup/$index" "> ${cmd_create[*]}" -- cgit v1.1