# See the License for the specific language governing permissions and
# limitations under the License.
+
+# todo: remove old leaf subvols, like keep up to 1 month or something.
+
set -eE -o pipefail
trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
# set default targets
if [[ ! -v targets ]]; then
case $HOSTNAME in
- x2)
+ x2|fz)
if [[ $HOSTNAME == "$MAIL_HOST" ]]; then
targets=($HOME_DOMAIN)
fi
fi
done
else # set default mountpoints
- if [[ $HOSTNAME == frodo ]]; then
- prospective_mps=(/i)
- else
- prospective_mps=(/a /q)
- if [[ $HOSTNAME == "$MAIL_HOST" ]]; then
- prospective_mps+=(/o)
- fi
- fi
+ case $HOSTNAME in
+ frodo)
+ prospective_mps=(/i)
+ ;;
+ *)
+ prospective_mps=(/a /q)
+ if [[ $HOSTNAME == "$MAIL_HOST" ]]; then
+ prospective_mps+=(/o)
+ fi
+ ;;
+ esac
+ case ${targets[0]} in
+ kw|kww)
+ prospective_mps=(/a)
+ ;;
+ esac
+
for mp in ${prospective_mps[@]}; do # default mountpoints to sync
if [[ -e /nocow/btrfs-stale/$mp ]]; then
echo "$0: warning: $mp stale, not adding to default mountpoints"
fi
cat >/etc/btrbk.conf <<EOF
-ssh_identity /root/.ssh/id_rsa
+ssh_identity /root/.ssh/home
# Just a guess that local7 is a good facility to pick.
# It's a bit odd that the transaction log has to be logged to
# a file or syslog, while other output is sent to std out.