From 7fb56fab683c32df362d2e8a66c86e06f701fb89 Mon Sep 17 00:00:00 2001 From: snaki Date: Thu, 7 Jul 2022 14:48:24 +0200 Subject: [PATCH] minor fixes --- btrbk | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/btrbk b/btrbk index eec8609..f9e203d 100755 --- a/btrbk +++ b/btrbk @@ -10,7 +10,7 @@ function bkRun { for i in ${!SUBVOLS[@]}; do snapName=${VOLNAME[$i]}.$date getSnap "$i" - if [[ -d "$SNAPDIR$snapName" && $force = 0 ]] ; then + if [[ -d "$SNAPDIR$snapName" ]] && ! $force; then echo "backup already run today" continue else @@ -115,9 +115,9 @@ function testConf { fi if rclone ls $RCLONEDIR > /dev/null 2>&1; then if gpg --list-key $PUBKEY > /dev/null 2>&1; then - if [ $restore=1 ]; then + if $restore; then runRestore - elif [ $backup=1 ]; then + elif $backup; then testDate fi else @@ -161,19 +161,19 @@ eval set -- "$options" while true; do case $1 in - -b|--backup) backup=1; shift;; - -f|--force) force=1; shift;; + -b|--backup) backup=true; shift;; + -f|--force) force=true; shift;; -d|--date) rDate="$2"; shift;; - -r|--restore) restore=1; restoreVol=$2; shift;; - -x|--full-restore) fullRestore=1; restoreDir=$2; shift;; + -r|--restore) restore=true; restoreVol=$2; shift;; + -x|--full-restore) fullRestore=true; restoreDir=$2; shift;; -h|--help) Help; shift; break;; --) shift; break;; \?) echo "error"; exit 1;; esac shift done -if [ $fullRestore = "1" ]; then +if $fullRestore; then runFullRestore -else +elif $backup testConf fi