diff --git a/backup.sh b/backup.sh index d14b545..d0d39ad 100755 --- a/backup.sh +++ b/backup.sh @@ -55,7 +55,7 @@ run_snapshot() { if [ $ZB_TEST_MODE = "TRUE" ]; then echo zfs snapshot $ZFS_SNAPSHOT_OPTS $dset@$snapid - else + else zfs snapshot $ZFS_SNAPSHOT_OPTS $dset@$snapid fi } @@ -96,7 +96,7 @@ populate_datasets() snapshot_dataset="yes" send_dataset="yes" for option in $dataset_options; do - case $option in + case $option in "nosnap"* ) snapshot_dataset="" ;; @@ -133,7 +133,7 @@ list_remote_datasets() { while read addr user port zroot speed; do echo "=== $user@$addr $zroot ===" if [ $zroot ]; then - case $zroot in + case $zroot in *"/") ;; *) zroot="$zroot/" ;; esac @@ -156,7 +156,7 @@ get_latest_snapshot() get_latest_remote_snapshot() { if [ $zroot ]; then - case $zroot in + case $zroot in *"/") ;; *) zroot="$zroot/" ;; esac @@ -164,7 +164,6 @@ get_latest_remote_snapshot() list_cmd="zfs list -t snapshot $zroot$dset" remote_cmd="$list_cmd|tail -n1|cut -d'@' -f2|cut -d' ' -f 1" run_remote - } zfs_allow_origin() @@ -180,7 +179,7 @@ zfs_allow_mirrors() while read addr user port zroot speed; do echo "=== $user@$addr $zroot ===" if [ $zroot ]; then - case $zroot in + case $zroot in *"/") ;; *) zroot="$zroot/" ;; esac @@ -209,7 +208,7 @@ send_latest() while read addr user port zroot speed; do echo "=== $user@$addr $zroot ===" if [ $zroot ]; then - case $zroot in + case $zroot in *"/") ;; *) zroot="$zroot/" ;; esac @@ -232,7 +231,7 @@ send_increment() while read addr user port zroot speed; do echo "=== $user@$addr $zroot ===" if [ $zroot ]; then - case $zroot in + case $zroot in *"/") ;; *) zroot="$zroot/" ;; esac @@ -253,12 +252,11 @@ send_increment() ################################### MAIN #################################### -### Options set -- `getopt "tvl:" "$@"` || { echo "Usage: `basename $0` [-tvl] [command]" 1>&2 exit 1 } -ZB_TEST_MODE=FALSE + while :; do case "$1" in -t)