From 867df0cf3d06a789a92c0c7a012393a5e1a89369 Mon Sep 17 00:00:00 2001 From: Robert Alessi Date: Sun, 15 Dec 2019 15:22:34 +0100 Subject: optionally use rsnapshot to have incremental backups --- x200-my.initd | 50 ++++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 24 deletions(-) (limited to 'x200-my.initd') diff --git a/x200-my.initd b/x200-my.initd index b026b5b..de88ff0 100644 --- a/x200-my.initd +++ b/x200-my.initd @@ -14,31 +14,46 @@ extra_started_commands="initbackup" autobackup="${conf_autobackup}" backup_path="${conf_backup_path}" control_file="${conf_control_file}" -backup_cmd="/usr/bin/rsync" -backup_args="-aAX --relative --delete --quiet" +if [ $use_rsnapshot = "true" ] +then + backup_cmd="/usr/bin/rsnapshot" + backup_args="${rsnapshot_args}" +else + backup_cmd="/usr/bin/rsync" + backup_args="-aAX --relative --delete --quiet" +fi do_listofpackages() { /usr/bin/pacman -Qqetn > "$backup_path"/pkglist.txt /usr/bin/pacman -Qqem > "$backup_path"/foreignpkglist.txt } -initbackup() { +do_backup () { if [ $autobackup = "true" ] then if [ -e "$backup_path"/"$control_file" ] then do_listofpackages - for dir in "${conf_backup_dirs[@]}" - do - if [ -d "$dir" ] - then - $backup_cmd $backup_args "$dir" "$backup_path" - fi - done + if [ $use_rsnapshot = "true" ] + then + $backup_cmd $backup_args + else + for dir in "${conf_backup_dirs[@]}" + do + if [ -d "$dir" ] + then + $backup_cmd $backup_args "$dir" "$backup_path" + fi + done + fi fi fi } +initbackup() { + do_backup +} + start() { if [ "${RC_CMD}" = "restart" ]; then @@ -50,18 +65,5 @@ start() { stop() { /usr/bin/nmcli radio all off - if [ $autobackup = "true" ] - then - if [ -e "$backup_path"/"$control_file" ] - then - do_listofpackages - for dir in "${conf_backup_dirs[@]}" - do - if [ -d "$dir" ] - then - $backup_cmd $backup_args "$dir" "$backup_path" - fi - done - fi - fi + do_backup } -- cgit v1.2.3