diff options
Diffstat (limited to 'bin/backup')
| -rwxr-xr-x | bin/backup | 14 |
1 files changed, 6 insertions, 8 deletions
@@ -3,23 +3,21 @@ [ "$USER" = root ] || exec sudo "$0" "$@" -while getopts :Fv opt; do +while getopts :v opt; do case $opt in - (F|v) eval "opt$opt=$opt" ;; - (*) echo "Usage: $0 [-Fv] [[host:]dir]"; exit 1 ;; + (v) eval "opt$opt=$opt" ;; + (*) echo "Usage: $0 [-v] [[host:]dir]"; exit 1 ;; esac done shift $((OPTIND - 1)) dest=${1:-/.history} date=$(date +%Y%m%d_%H%M%S) -last=$(rsync --list-only $dest/ 2>/dev/null | cut -b 47- | tail -1) +last=$(rsync --list-only "$dest/" 2>/dev/null | cut -b 47- | tail -1) case $last in -(2*) opt_link=--link-dest=../$last;; +([12]*) opt_link=--link-dest=../$last;; (*) opt_link=;; esac -[ "$optF" ] && fsfreeze -f / && trap 'fsfreeze -u /' EXIT - -rsync -HSxa$optv --exclude-from=/etc/backup/ignore $opt_link / /boot $dest/$date +rsync -HSxa$optv --exclude-from=/etc/backup/ignore $opt_link / /boot "$dest/$date" |
