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
commit42789994f68efffc6d94ec78e51a06be246620ff (patch)
tree4c11842e536b267186c597b8d0648c2de97dcaa2 /bin/backup
parent478fc77adf2a19725bb41f68a21e8700f1cebe23 (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"