rsync-backup.8: Put the variables in alphabetical order.
[rsync-backup] / rsync-backup.in
index 292c6eb..7519b12 100644 (file)
@@ -130,7 +130,7 @@ hostrun () {
 
 _hostrun () {
   h=$1 cmd=$2
-  ## Like hostrun, but without the complicated logging, but targetted at a
+  ## Like hostrun, but without the complicated logging, and targetted at a
   ## specific host.
 
   if localp $h; then sh -c "$cmd"
@@ -667,10 +667,14 @@ do_backup () {
   $verbose "   commit"
 
   ## Expire old backups.
+  case "${expire_policy+t},${default_policy+t}" in
+    ,t) expire_policy=$default_policy ;;
+  esac
   case "${expire_policy+t},$dryrun" in
     t,nil) run "expiry for $host:$fs" expire_backups ;;
     t,t) expire_backups ;;
   esac
+  clear_policy=t
 
   ## Report success.
   case $dryrun in
@@ -776,13 +780,23 @@ backup () {
 ###--------------------------------------------------------------------------
 ### Configuration functions.
 
-host () { host=$1; like=; $verbose "host $host"; }
+host () {
+  host=$1
+  like=
+  case "${expire_policy+t},${default_policy+t}" in
+    t,) default_policy=$expire_policy ;;
+  esac
+  unset expire_policy
+  $verbose "host $host"
+}
+
 snaptype () { snap=$1; shift; snapargs="$*"; retry=0; }
 rsyncargs () { rsyncargs="$*"; }
 like () { like="$*"; }
 retry () { retry="$*"; }
 
 retain () {
+  case $clear_policy in t) unset expire_policy; clear_policy=nil ;; esac
   expire_policy="${expire_policy+$expire_policy
 }$*"
 }