summaryrefslogtreecommitdiff
path: root/bin/backup
diff options
context:
space:
mode:
authorMarc Vertes <mvertes@free.fr>2020-06-24 14:29:51 +0200
committerMarc Vertes <mvertes@free.fr>2020-06-24 14:29:51 +0200
commitad7f45231cb867990a03830ec09e0cd41959f539 (patch)
treedea3b4efb580e4ccfd71506e86c000e1c83652bc /bin/backup
parentf0bd81aa4e40511825e7d818d267f18a86df2c47 (diff)
update
Diffstat (limited to 'bin/backup')
-rwxr-xr-xbin/backup14
1 files changed, 6 insertions, 8 deletions
diff --git a/bin/backup b/bin/backup
index 059f2dc..4ef83be 100755
--- a/bin/backup
+++ b/bin/backup
@@ -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"