From b9601cf46a75b373f6b6b902d7ac2be38ab2ffe8 Mon Sep 17 00:00:00 2001 From: Ludovic Pouzenc Date: Tue, 15 Jun 2021 16:45:20 +0200 Subject: borg-family_0.2-1 --- borg-family-0.1/Makefile | 27 -------------- borg-family-0.1/README | 0 borg-family-0.1/debian/borg-family.config | 4 --- borg-family-0.1/debian/borg-family.docs | 1 - borg-family-0.1/debian/borg-family.examples | 1 - borg-family-0.1/debian/borg-family.init | 17 --------- borg-family-0.1/debian/borg-family.manpages | 3 -- borg-family-0.1/debian/borg-family.postinst | 15 -------- borg-family-0.1/debian/borg-family.postrm | 10 ------ borg-family-0.1/debian/borg-family.service | 14 -------- borg-family-0.1/debian/borg-family.substvars | 2 -- borg-family-0.1/debian/borg-family.templates | 8 ----- borg-family-0.1/debian/borg-family.timer | 10 ------ borg-family-0.1/debian/changelog | 5 --- borg-family-0.1/debian/compat | 1 - borg-family-0.1/debian/control | 14 -------- borg-family-0.1/debian/debhelper-build-stamp | 1 - borg-family-0.1/debian/files | 2 -- borg-family-0.1/debian/rules | 3 -- borg-family-0.1/debian/source/format | 1 - borg-family-0.1/doc/examples/envvars | 10 ------ borg-family-0.1/doc/man/bfenv.1 | 1 - borg-family-0.1/doc/man/bfrun.1 | 52 --------------------------- borg-family-0.1/doc/man/bfwhat.1 | 1 - borg-family-0.1/src/etc/bfhooks | 27 -------------- borg-family-0.1/src/etc/confvars | 5 --- borg-family-0.1/src/etc/excludes.d/home | 4 --- borg-family-0.1/src/etc/excludes.d/rootfs | 5 --- borg-family-0.1/src/sbin/bfenv | 31 ---------------- borg-family-0.1/src/sbin/bfrun | 29 --------------- borg-family-0.1/src/sbin/bfwhat | 24 ------------- borg-family-0.2/Makefile | 27 ++++++++++++++ borg-family-0.2/README | 0 borg-family-0.2/debian/borg-family.config | 5 +++ borg-family-0.2/debian/borg-family.cron.daily | 5 +++ borg-family-0.2/debian/borg-family.docs | 1 + borg-family-0.2/debian/borg-family.examples | 1 + borg-family-0.2/debian/borg-family.init | 17 +++++++++ borg-family-0.2/debian/borg-family.manpages | 3 ++ borg-family-0.2/debian/borg-family.postinst | 17 +++++++++ borg-family-0.2/debian/borg-family.postrm | 10 ++++++ borg-family-0.2/debian/borg-family.service | 14 ++++++++ borg-family-0.2/debian/borg-family.substvars | 2 ++ borg-family-0.2/debian/borg-family.templates | 16 +++++++++ borg-family-0.2/debian/changelog | 5 +++ borg-family-0.2/debian/compat | 1 + borg-family-0.2/debian/control | 14 ++++++++ borg-family-0.2/debian/debhelper-build-stamp | 1 + borg-family-0.2/debian/files | 2 ++ borg-family-0.2/debian/rules | 3 ++ borg-family-0.2/debian/source/format | 1 + borg-family-0.2/doc/examples/envvars | 10 ++++++ borg-family-0.2/doc/man/bfenv.1 | 1 + borg-family-0.2/doc/man/bfrun.1 | 52 +++++++++++++++++++++++++++ borg-family-0.2/doc/man/bfwhat.1 | 1 + borg-family-0.2/src/etc/bfhooks | 43 ++++++++++++++++++++++ borg-family-0.2/src/etc/confvars | 4 +++ borg-family-0.2/src/etc/excludes.d/home | 4 +++ borg-family-0.2/src/etc/excludes.d/rootfs | 5 +++ borg-family-0.2/src/sbin/bfenv | 31 ++++++++++++++++ borg-family-0.2/src/sbin/bfenv2 | 31 ++++++++++++++++ borg-family-0.2/src/sbin/bfrun | 32 +++++++++++++++++ borg-family-0.2/src/sbin/bfwhat | 24 +++++++++++++ 63 files changed, 383 insertions(+), 328 deletions(-) delete mode 100644 borg-family-0.1/Makefile delete mode 100644 borg-family-0.1/README delete mode 100644 borg-family-0.1/debian/borg-family.config delete mode 100644 borg-family-0.1/debian/borg-family.docs delete mode 100644 borg-family-0.1/debian/borg-family.examples delete mode 100644 borg-family-0.1/debian/borg-family.init delete mode 100644 borg-family-0.1/debian/borg-family.manpages delete mode 100644 borg-family-0.1/debian/borg-family.postinst delete mode 100644 borg-family-0.1/debian/borg-family.postrm delete mode 100644 borg-family-0.1/debian/borg-family.service delete mode 100644 borg-family-0.1/debian/borg-family.substvars delete mode 100644 borg-family-0.1/debian/borg-family.templates delete mode 100644 borg-family-0.1/debian/borg-family.timer delete mode 100644 borg-family-0.1/debian/changelog delete mode 100644 borg-family-0.1/debian/compat delete mode 100644 borg-family-0.1/debian/control delete mode 100644 borg-family-0.1/debian/debhelper-build-stamp delete mode 100644 borg-family-0.1/debian/files delete mode 100755 borg-family-0.1/debian/rules delete mode 100644 borg-family-0.1/debian/source/format delete mode 100644 borg-family-0.1/doc/examples/envvars delete mode 120000 borg-family-0.1/doc/man/bfenv.1 delete mode 100644 borg-family-0.1/doc/man/bfrun.1 delete mode 120000 borg-family-0.1/doc/man/bfwhat.1 delete mode 100755 borg-family-0.1/src/etc/bfhooks delete mode 100644 borg-family-0.1/src/etc/confvars delete mode 100644 borg-family-0.1/src/etc/excludes.d/home delete mode 100644 borg-family-0.1/src/etc/excludes.d/rootfs delete mode 100755 borg-family-0.1/src/sbin/bfenv delete mode 100755 borg-family-0.1/src/sbin/bfrun delete mode 100755 borg-family-0.1/src/sbin/bfwhat create mode 100644 borg-family-0.2/Makefile create mode 100644 borg-family-0.2/README create mode 100644 borg-family-0.2/debian/borg-family.config create mode 100644 borg-family-0.2/debian/borg-family.cron.daily create mode 100644 borg-family-0.2/debian/borg-family.docs create mode 100644 borg-family-0.2/debian/borg-family.examples create mode 100644 borg-family-0.2/debian/borg-family.init create mode 100644 borg-family-0.2/debian/borg-family.manpages create mode 100644 borg-family-0.2/debian/borg-family.postinst create mode 100644 borg-family-0.2/debian/borg-family.postrm create mode 100644 borg-family-0.2/debian/borg-family.service create mode 100644 borg-family-0.2/debian/borg-family.substvars create mode 100644 borg-family-0.2/debian/borg-family.templates create mode 100644 borg-family-0.2/debian/changelog create mode 100644 borg-family-0.2/debian/compat create mode 100644 borg-family-0.2/debian/control create mode 100644 borg-family-0.2/debian/debhelper-build-stamp create mode 100644 borg-family-0.2/debian/files create mode 100755 borg-family-0.2/debian/rules create mode 100644 borg-family-0.2/debian/source/format create mode 100644 borg-family-0.2/doc/examples/envvars create mode 120000 borg-family-0.2/doc/man/bfenv.1 create mode 100644 borg-family-0.2/doc/man/bfrun.1 create mode 120000 borg-family-0.2/doc/man/bfwhat.1 create mode 100755 borg-family-0.2/src/etc/bfhooks create mode 100644 borg-family-0.2/src/etc/confvars create mode 100644 borg-family-0.2/src/etc/excludes.d/home create mode 100644 borg-family-0.2/src/etc/excludes.d/rootfs create mode 100755 borg-family-0.2/src/sbin/bfenv create mode 100755 borg-family-0.2/src/sbin/bfenv2 create mode 100755 borg-family-0.2/src/sbin/bfrun create mode 100755 borg-family-0.2/src/sbin/bfwhat diff --git a/borg-family-0.1/Makefile b/borg-family-0.1/Makefile deleted file mode 100644 index ff88bdd..0000000 --- a/borg-family-0.1/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -PKGNAME=borg-family -VERSION=0.1 - -INSTALL=install -INSTALL_PROGRAM=$(INSTALL) -INSTALL_DATA=${INSTALL} -m 644 -confdir=/etc/${PKGNAME} -sbindir=/usr/sbin - -all: - -deb: - cd .. && tar -czf ${PKGNAME}_${VERSION}.orig.tar.gz --exclude debian ${PKGNAME}-${VERSION} - debuild -us -uc - -install: - $(INSTALL) -d $(DESTDIR)$(sbindir) - $(INSTALL) -d $(DESTDIR)$(confdir)/excludes.d - $(INSTALL_PROGRAM) src/sbin/bfenv $(DESTDIR)$(sbindir) - $(INSTALL_PROGRAM) src/sbin/bfrun $(DESTDIR)$(sbindir) - $(INSTALL_PROGRAM) src/sbin/bfwhat $(DESTDIR)$(sbindir) - $(INSTALL_PROGRAM) src/etc/bfhooks $(DESTDIR)$(confdir) - $(INSTALL_DATA) src/etc/confvars $(DESTDIR)$(confdir) - $(INSTALL_DATA) src/etc/excludes.d/home $(DESTDIR)$(confdir)/excludes.d - $(INSTALL_DATA) src/etc/excludes.d/rootfs $(DESTDIR)$(confdir)/excludes.d - -.PHONY: all deb install diff --git a/borg-family-0.1/README b/borg-family-0.1/README deleted file mode 100644 index e69de29..0000000 diff --git a/borg-family-0.1/debian/borg-family.config b/borg-family-0.1/debian/borg-family.config deleted file mode 100644 index d0e4f26..0000000 --- a/borg-family-0.1/debian/borg-family.config +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -e -. /usr/share/debconf/confmodule -db_input critical borg-family/borg-repo || true -db_go diff --git a/borg-family-0.1/debian/borg-family.docs b/borg-family-0.1/debian/borg-family.docs deleted file mode 100644 index e845566..0000000 --- a/borg-family-0.1/debian/borg-family.docs +++ /dev/null @@ -1 +0,0 @@ -README diff --git a/borg-family-0.1/debian/borg-family.examples b/borg-family-0.1/debian/borg-family.examples deleted file mode 100644 index e002ac5..0000000 --- a/borg-family-0.1/debian/borg-family.examples +++ /dev/null @@ -1 +0,0 @@ -doc/examples/envvars diff --git a/borg-family-0.1/debian/borg-family.init b/borg-family-0.1/debian/borg-family.init deleted file mode 100644 index 72e9267..0000000 --- a/borg-family-0.1/debian/borg-family.init +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -### BEGIN INIT INFO -# Provides: borg-family -# Required-Start: $network $local_fs $syslog -# Required-Stop: $local_fs $syslog -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: borg-family backup scripts -# Description: Makes Borg running periodically to backup computers to a remote server -### END INIT INFO - -. /lib/lsb/init-functions - -case "$1" in - start|stop|restart|reload|status|force-reload) - log_action_msg "This is a stub, you shuld run bfrun from cron if not using systemd borg-family.timer" ;; -esac diff --git a/borg-family-0.1/debian/borg-family.manpages b/borg-family-0.1/debian/borg-family.manpages deleted file mode 100644 index 160e2fa..0000000 --- a/borg-family-0.1/debian/borg-family.manpages +++ /dev/null @@ -1,3 +0,0 @@ -doc/man/bfenv.1 -doc/man/bfrun.1 -doc/man/bfwhat.1 diff --git a/borg-family-0.1/debian/borg-family.postinst b/borg-family-0.1/debian/borg-family.postinst deleted file mode 100644 index 5bf8c69..0000000 --- a/borg-family-0.1/debian/borg-family.postinst +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -set -e - -EVFILE=/etc/borg-family/envvars - -if [ "$1" = configure ]; then - . /usr/share/debconf/confmodule - unset BORG_REPO - db_get borg-family/borg-repo && BORG_REPO="$RET" - db_stop - [ -f "$EVFILE" ] || install -m 644 /usr/share/doc/borg-family/examples/envvars "$EVFILE" - [ -n "$BORG_REPO" ] && sed --in-place -e 's#^export BORG_REPO=.*$#export BORG_REPO="'$BORG_REPO'"#' -- "$EVFILE" -fi - -#DEBHELPER# diff --git a/borg-family-0.1/debian/borg-family.postrm b/borg-family-0.1/debian/borg-family.postrm deleted file mode 100644 index 5ae54c6..0000000 --- a/borg-family-0.1/debian/borg-family.postrm +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -set -e - -if [ "$1" = "purge" ]; then - . /usr/share/debconf/confmodule - db_purge - rm -f /etc/borg-family/envvars -fi - -#DEBHELPER# diff --git a/borg-family-0.1/debian/borg-family.service b/borg-family-0.1/debian/borg-family.service deleted file mode 100644 index f6aab42..0000000 --- a/borg-family-0.1/debian/borg-family.service +++ /dev/null @@ -1,14 +0,0 @@ -[Unit] -Description=Makes Borg running periodically to backup computers to a remote server -Wants=default.target network-online.target -ConditionACPower=true - -[Service] -ExecStart=/usr/bin/systemd-inhibit --why="Prevent interrupting backup" /usr/sbin/bfrun -Restart=no -# Lower CPU and I/O priority. -Nice=19 -CPUSchedulingPolicy=batch -IOSchedulingClass=best-effort -IOSchedulingPriority=7 -IOWeight=100 diff --git a/borg-family-0.1/debian/borg-family.substvars b/borg-family-0.1/debian/borg-family.substvars deleted file mode 100644 index a595723..0000000 --- a/borg-family-0.1/debian/borg-family.substvars +++ /dev/null @@ -1,2 +0,0 @@ -misc:Depends=debconf (>= 0.5) | debconf-2.0 -misc:Pre-Depends= diff --git a/borg-family-0.1/debian/borg-family.templates b/borg-family-0.1/debian/borg-family.templates deleted file mode 100644 index b17ce60..0000000 --- a/borg-family-0.1/debian/borg-family.templates +++ /dev/null @@ -1,8 +0,0 @@ -Template: borg-family/borg-repo -Type: string -Description: Borg repository URL: - Please set the backup destination. - . - It will be exported to BORG_REPO by bfrun for borg commands. - Could be 'ssh://user@host:port/abspath/to/repo', or 'user@host:relpath/to/repo', see man borg. - diff --git a/borg-family-0.1/debian/borg-family.timer b/borg-family-0.1/debian/borg-family.timer deleted file mode 100644 index 14a848a..0000000 --- a/borg-family-0.1/debian/borg-family.timer +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=Run borg-family backup - -[Timer] -OnCalendar=daily -Persistent=true - -[Install] -WantedBy=timers.target - diff --git a/borg-family-0.1/debian/changelog b/borg-family-0.1/debian/changelog deleted file mode 100644 index e2329ed..0000000 --- a/borg-family-0.1/debian/changelog +++ /dev/null @@ -1,5 +0,0 @@ -borg-family (0.1-1) UNRELEASED; urgency=medium - - * Initial release. - - -- Ludovic Pouzenc Sat, 28 Nov 2020 17:07:53 +0100 diff --git a/borg-family-0.1/debian/compat b/borg-family-0.1/debian/compat deleted file mode 100644 index f599e28..0000000 --- a/borg-family-0.1/debian/compat +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/borg-family-0.1/debian/control b/borg-family-0.1/debian/control deleted file mode 100644 index 3ca323f..0000000 --- a/borg-family-0.1/debian/control +++ /dev/null @@ -1,14 +0,0 @@ -Source: borg-family -Maintainer: Ludovic Pouzenc -Section: admin -Priority: optional -Standards-Version: 4.3.0 -Build-Depends: debhelper (>= 10) - -Package: borg-family -Architecture: all -Depends: bash (>= 2.0), borgbackup (>= 1.0), coreutils (>= 4.0), debconf, gawk, openssh-client, pwgen (>= 2.0), sed (>= 4.0), util-linux (>= 2.0), ${misc:Depends} -Description: Makes Borg running periodically to backup computers to a remote server - borg-family ease the backup automation configuration around Borg - in small environnements, like backuping some computers to a remote - family server. diff --git a/borg-family-0.1/debian/debhelper-build-stamp b/borg-family-0.1/debian/debhelper-build-stamp deleted file mode 100644 index e8dd97e..0000000 --- a/borg-family-0.1/debian/debhelper-build-stamp +++ /dev/null @@ -1 +0,0 @@ -borg-family diff --git a/borg-family-0.1/debian/files b/borg-family-0.1/debian/files deleted file mode 100644 index 225c048..0000000 --- a/borg-family-0.1/debian/files +++ /dev/null @@ -1,2 +0,0 @@ -borg-family_0.1-1_all.deb admin optional -borg-family_0.1-1_amd64.buildinfo admin optional diff --git a/borg-family-0.1/debian/rules b/borg-family-0.1/debian/rules deleted file mode 100755 index cbe925d..0000000 --- a/borg-family-0.1/debian/rules +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/make -f -%: - dh $@ diff --git a/borg-family-0.1/debian/source/format b/borg-family-0.1/debian/source/format deleted file mode 100644 index 163aaf8..0000000 --- a/borg-family-0.1/debian/source/format +++ /dev/null @@ -1 +0,0 @@ -3.0 (quilt) diff --git a/borg-family-0.1/doc/examples/envvars b/borg-family-0.1/doc/examples/envvars deleted file mode 100644 index 99f7139..0000000 --- a/borg-family-0.1/doc/examples/envvars +++ /dev/null @@ -1,10 +0,0 @@ -# To consult or restore backups, just load this file in a root shell environnement variables with: -# source /etc/borg-family/envvars -# Then use commands like: -# borg list -# mkdir /mnt/restore -# borg mount ::somehostname-rootfs-2020-08-15 /mnt/restore -# cp -ai /mnt/restore/rootfs/etc/veryimportantfile /etc/ -export BORG_RSH="ssh -i /etc/borg-family/id_rsa_borg" -export BORG_PASSCOMMAND="cat /etc/borg-family/passphrase" -export BORG_REPO="ssh://user@host:port/path/to/repo" diff --git a/borg-family-0.1/doc/man/bfenv.1 b/borg-family-0.1/doc/man/bfenv.1 deleted file mode 120000 index 080be00..0000000 --- a/borg-family-0.1/doc/man/bfenv.1 +++ /dev/null @@ -1 +0,0 @@ -bfrun.1 \ No newline at end of file diff --git a/borg-family-0.1/doc/man/bfrun.1 b/borg-family-0.1/doc/man/bfrun.1 deleted file mode 100644 index efc42a7..0000000 --- a/borg-family-0.1/doc/man/bfrun.1 +++ /dev/null @@ -1,52 +0,0 @@ -.TH BORG-FAMILY 1 local -.SH NAME -bfrun, bfwhat, bfenv \- scripts to run Borg to backup your computers -.SH SYNOPSIS -.ll +8 -.B bfrun -.ll -8 -.br -.SH DESCRIPTION -.I bfrun -invokes -.I bfenv -then -.I bfwhat -to check repository availability and list local mount points to backup. -.SH OPTIONS -.ll +8 -.B No options. -See /etc/borg-family -.ll -8 -.SH "ENVIRONMENT" -.B bfrun -loads /etc/borg-family/envvars for Borg and /etc/borg-family/confvars for itself. -.SH "SEE ALSO" -borgbackup(1) -.SH CAVEATS -Poor manpage. -.SH BUGS -Reports them to -.BR "" -.SH "COPYRIGHT NOTICE" -Copyright \(co 2020 Ludovic Pouzenc -.PP -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. -.ig -Permission is granted to process this file through troff and print the -results, provided the printed document carries copying permission -notice identical to this one except for the removal of this paragraph -(this paragraph not being relevant to the printed manual). -.. -.PP -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided that the entire -resulting derived work is distributed under the terms of a permission -notice identical to this one. -.PP -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions, -except that this permission notice may be stated in a translation approved -by the Foundation. diff --git a/borg-family-0.1/doc/man/bfwhat.1 b/borg-family-0.1/doc/man/bfwhat.1 deleted file mode 120000 index 080be00..0000000 --- a/borg-family-0.1/doc/man/bfwhat.1 +++ /dev/null @@ -1 +0,0 @@ -bfrun.1 \ No newline at end of file diff --git a/borg-family-0.1/src/etc/bfhooks b/borg-family-0.1/src/etc/bfhooks deleted file mode 100755 index 5b6b204..0000000 --- a/borg-family-0.1/src/etc/bfhooks +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -e -mount_bind_rootfs() { - if ! mount | grep -q /rootfs; then - mkdir -p /rootfs - mount --bind / /rootfs - fi -} - -umount_bind_rootfs() { - if mount | grep -q /rootfs; then - umount /rootfs || lsof -n | grep /rootfs - rmdir /rootfs - fi -} - -case $1 in - before) - case $2 in - rootfs) apt-get clean || true; mount_bind_rootfs;; - esac - ;; - after) - case $2 in - rootfs) umount_bind_rootfs ;; - esac - ;; -esac diff --git a/borg-family-0.1/src/etc/confvars b/borg-family-0.1/src/etc/confvars deleted file mode 100644 index f737648..0000000 --- a/borg-family-0.1/src/etc/confvars +++ /dev/null @@ -1,5 +0,0 @@ -# This file is used by bfenv and bfrun (bash scripts) -borg_init_opts=( -e repokey-blake2 --make-parent-dirs -v ) -borg_check_opts=( --last $((1+$(bfwhat | wc -l) )) -v ) -borg_create_opts=( --one-file-system --compression zstd --exclude-caches --exclude-if-present=NOBACKUPDIR.TAG --keep-exclude-tags --list --filter=AMEi-x --stats --show-rc -v ) -quiet=0 diff --git a/borg-family-0.1/src/etc/excludes.d/home b/borg-family-0.1/src/etc/excludes.d/home deleted file mode 100644 index c7aead3..0000000 --- a/borg-family-0.1/src/etc/excludes.d/home +++ /dev/null @@ -1,4 +0,0 @@ -**/.cache/* -/home/*/.mozilla/**/datareporting -/home/*/.thunderbird/**/global-messages-db.sqlite -/home/*/.thunderbird/**/ImapMail diff --git a/borg-family-0.1/src/etc/excludes.d/rootfs b/borg-family-0.1/src/etc/excludes.d/rootfs deleted file mode 100644 index b61797b..0000000 --- a/borg-family-0.1/src/etc/excludes.d/rootfs +++ /dev/null @@ -1,5 +0,0 @@ -/rootfs/var/cache/apt/* -**/.cache/* -/rootfs/home/*/.mozilla/**/datareporting -/rootfs/home/*/.thunderbird/**/global-messages-db.sqlite -/rootfs/home/*/.thunderbird/**/ImapMail diff --git a/borg-family-0.1/src/sbin/bfenv b/borg-family-0.1/src/sbin/bfenv deleted file mode 100755 index 756ef62..0000000 --- a/borg-family-0.1/src/sbin/bfenv +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -umask 0077 -source /etc/borg-family/confvars -source /etc/borg-family/envvars -PATH="/etc/borg-family:$PATH" - -if [ \! -r /etc/borg-family/passphrase ]; then - echo "No passphrase (repokey) found, creating a new one" >&2 - touch /etc/borg-family/passphrase - chmod 600 /etc/borg-family/passphrase - pwgen 32 1 >> /etc/borg-family/passphrase - ls -l /etc/borg-family/passphrase >&2 - echo "You NEED to store it in a password manager to be able to restore backups" >&2 -fi - -if [ \! -r /etc/borg-family/id_rsa_borg ]; then - echo "No SSH key found, creating a new one" >&2 - ssh-keygen -N "" -C "$(id -un)_borg@$(hostname)" -f /etc/borg-family/id_rsa_borg \ - && cat /etc/borg-family/id_rsa_borg.pub -fi - -borg init "${borg_init_opts[@]}" 2>&1 | grep -vE '^A repository already exists' >&2 - -if ! borg check "${borg_check_opts[@]}"; then - echo "Showing BORG_* env variables (see /etc/borg-family/envvars) :" >&2 - env | grep ^BORG_ >&2 - echo "End of BORG_* env variables" >&2 - echo >&2 - echo "Can't access to or check the borg repository, exiting, no backup made" >&2 - exit 1 -fi diff --git a/borg-family-0.1/src/sbin/bfrun b/borg-family-0.1/src/sbin/bfrun deleted file mode 100755 index c02187a..0000000 --- a/borg-family-0.1/src/sbin/bfrun +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -source bfenv -bfwhat | while IFS=' ' read -r mpe dev; do - mp=$(echo -e "$mpe") # mp: interpret escapings that may be present in /proc/mounts (\040 for space...) - name=${mp// /_}; # name: replace space by underscore - name=${mp//\//-}; name=${name/-/} # name: replace slash by dash, remove the leading one - if [[ "$mp $name $dev" =~ "--" || "$mp $name $dev" =~ ".." || "$mp $name $dev" =~ "[|&;()<>]" ]]; then - echo "Skipping $mpe because of shell unsafe characters" >&2 - continue - fi - - comment=$(blkid -- "$dev") - if [ -r "/etc/borg-family/excludes.d/$name" ]; then - runtime_args=( --comment="$comment" --exclude-from="/etc/borg-family/excludes.d/$name" ) - else - runtime_args=( --comment="$comment" ) - fi - - bfhooks before "$name" && \ - borg create "${runtime_args[@]}" "${borg_create_opts[@]}" "::{hostname}-$name-{now:%Y-%m-%d}" "$mp" - rc1=$? - bfhooks after "$name" - rc2=$? - if [ "$rc1" -ne 0 -o "$rc2" -ne 0 ]; then - echo "Errors during $name backup, return codes $rc1 (bfhook before && borg create) and $rc2 (bfhook after)" >&2 - else - [ "x$quiet" == "x1" ] || echo "Success for $name backup" - fi -done diff --git a/borg-family-0.1/src/sbin/bfwhat b/borg-family-0.1/src/sbin/bfwhat deleted file mode 100755 index bf9cf4d..0000000 --- a/borg-family-0.1/src/sbin/bfwhat +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -what-from-proc-mounts() { - # Special case for "/", show it as /rootfs (see hook_* files). Helps saving initial /dev nodes files behind udev - awk '( $2 == "/" ) { print "/rootfs",$1 }' /proc/mounts - - # Backup all non "/", non-removable, mounted filesystems which device is also shown in /sys/block - tmp=$(mktemp) - grep 0 /sys/block/*/removable | sed -e 's#^/sys/block#^/dev#' -e 's#/removable:0$##' >> "$tmp" - grep -Ef "$tmp" /proc/mounts | awk '( $2 !~ /^\/(rootfs|$)/ ) { print $2,$1 }' - rm -- "$tmp" -} - -if [ -r /etc/borg-family/what.override ]; then - cat /etc/borg-family/what.override -else - if [ -r /etc/borg-family/what.include ]; then - cat /etc/borg-family/what.include - fi - if [ -r /etc/borg-family/what.exclude ]; then - what-from-proc-mounts | grep -vEf /etc/borg-family/what.exclude - else - what-from-proc-mounts - fi -fi diff --git a/borg-family-0.2/Makefile b/borg-family-0.2/Makefile new file mode 100644 index 0000000..2230ee9 --- /dev/null +++ b/borg-family-0.2/Makefile @@ -0,0 +1,27 @@ +PKGNAME=borg-family +VERSION=0.2 + +INSTALL=install +INSTALL_PROGRAM=$(INSTALL) +INSTALL_DATA=${INSTALL} -m 644 +confdir=/etc/${PKGNAME} +sbindir=/usr/sbin + +all: + +deb: + cd .. && tar -czf ${PKGNAME}_${VERSION}.orig.tar.gz --exclude debian ${PKGNAME}-${VERSION} + debuild -us -uc + +install: + $(INSTALL) -d $(DESTDIR)$(sbindir) + $(INSTALL) -d $(DESTDIR)$(confdir)/excludes.d + $(INSTALL_PROGRAM) src/sbin/bfenv $(DESTDIR)$(sbindir) + $(INSTALL_PROGRAM) src/sbin/bfrun $(DESTDIR)$(sbindir) + $(INSTALL_PROGRAM) src/sbin/bfwhat $(DESTDIR)$(sbindir) + $(INSTALL_PROGRAM) src/etc/bfhooks $(DESTDIR)$(confdir) + $(INSTALL_DATA) src/etc/confvars $(DESTDIR)$(confdir) + $(INSTALL_DATA) src/etc/excludes.d/home $(DESTDIR)$(confdir)/excludes.d + $(INSTALL_DATA) src/etc/excludes.d/rootfs $(DESTDIR)$(confdir)/excludes.d + +.PHONY: all deb install diff --git a/borg-family-0.2/README b/borg-family-0.2/README new file mode 100644 index 0000000..e69de29 diff --git a/borg-family-0.2/debian/borg-family.config b/borg-family-0.2/debian/borg-family.config new file mode 100644 index 0000000..7483dd7 --- /dev/null +++ b/borg-family-0.2/debian/borg-family.config @@ -0,0 +1,5 @@ +#!/bin/sh -e +. /usr/share/debconf/confmodule +db_input critical borg-family/borg-repo || true +db_input critical borg-family/borg-repo2 || true +db_go diff --git a/borg-family-0.2/debian/borg-family.cron.daily b/borg-family-0.2/debian/borg-family.cron.daily new file mode 100644 index 0000000..d08f88a --- /dev/null +++ b/borg-family-0.2/debian/borg-family.cron.daily @@ -0,0 +1,5 @@ +#!/bin/sh + +if [ -x /usr/sbin/bfrun ]; then + /usr/bin/systemd-inhibit --why="Prevent interrupting backup" /usr/sbin/bfrun +fi diff --git a/borg-family-0.2/debian/borg-family.docs b/borg-family-0.2/debian/borg-family.docs new file mode 100644 index 0000000..e845566 --- /dev/null +++ b/borg-family-0.2/debian/borg-family.docs @@ -0,0 +1 @@ +README diff --git a/borg-family-0.2/debian/borg-family.examples b/borg-family-0.2/debian/borg-family.examples new file mode 100644 index 0000000..e002ac5 --- /dev/null +++ b/borg-family-0.2/debian/borg-family.examples @@ -0,0 +1 @@ +doc/examples/envvars diff --git a/borg-family-0.2/debian/borg-family.init b/borg-family-0.2/debian/borg-family.init new file mode 100644 index 0000000..3b7b326 --- /dev/null +++ b/borg-family-0.2/debian/borg-family.init @@ -0,0 +1,17 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: borg-family +# Required-Start: $network $local_fs $syslog +# Required-Stop: $local_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: borg-family backup scripts +# Description: Makes Borg running periodically to backup computers to a remote server +### END INIT INFO + +. /lib/lsb/init-functions + +case "$1" in + start|stop|restart|reload|status|force-reload) + log_action_msg "This is a stub, you should run bfrun from cron if not using systemd borg-family.timer" ;; +esac diff --git a/borg-family-0.2/debian/borg-family.manpages b/borg-family-0.2/debian/borg-family.manpages new file mode 100644 index 0000000..160e2fa --- /dev/null +++ b/borg-family-0.2/debian/borg-family.manpages @@ -0,0 +1,3 @@ +doc/man/bfenv.1 +doc/man/bfrun.1 +doc/man/bfwhat.1 diff --git a/borg-family-0.2/debian/borg-family.postinst b/borg-family-0.2/debian/borg-family.postinst new file mode 100644 index 0000000..e900217 --- /dev/null +++ b/borg-family-0.2/debian/borg-family.postinst @@ -0,0 +1,17 @@ +#!/bin/sh +set -e + +if [ "$1" = configure ]; then + . /usr/share/debconf/confmodule + unset BORG_REPO + for i in "" 2 + do + db_get borg-family/borg-repo$i && BORG_REPO="$RET" + ENVFILE=/etc/borg-family/envvars$i + [ -f "$ENVFILE" ] || install -m 644 /usr/share/doc/borg-family/examples/envvars "$ENVFILE" + [ -n "$BORG_REPO" ] && sed --in-place -e 's#^export BORG_REPO=.*$#export BORG_REPO="'$BORG_REPO'"#' -- "$ENVFILE" + done + db_stop +fi + +#DEBHELPER# diff --git a/borg-family-0.2/debian/borg-family.postrm b/borg-family-0.2/debian/borg-family.postrm new file mode 100644 index 0000000..cf11e70 --- /dev/null +++ b/borg-family-0.2/debian/borg-family.postrm @@ -0,0 +1,10 @@ +#!/bin/sh +set -e + +if [ "$1" = "purge" ]; then + . /usr/share/debconf/confmodule + db_purge + rm -f /etc/borg-family/envvars /etc/borg-family/envvars2 +fi + +#DEBHELPER# diff --git a/borg-family-0.2/debian/borg-family.service b/borg-family-0.2/debian/borg-family.service new file mode 100644 index 0000000..f6aab42 --- /dev/null +++ b/borg-family-0.2/debian/borg-family.service @@ -0,0 +1,14 @@ +[Unit] +Description=Makes Borg running periodically to backup computers to a remote server +Wants=default.target network-online.target +ConditionACPower=true + +[Service] +ExecStart=/usr/bin/systemd-inhibit --why="Prevent interrupting backup" /usr/sbin/bfrun +Restart=no +# Lower CPU and I/O priority. +Nice=19 +CPUSchedulingPolicy=batch +IOSchedulingClass=best-effort +IOSchedulingPriority=7 +IOWeight=100 diff --git a/borg-family-0.2/debian/borg-family.substvars b/borg-family-0.2/debian/borg-family.substvars new file mode 100644 index 0000000..a595723 --- /dev/null +++ b/borg-family-0.2/debian/borg-family.substvars @@ -0,0 +1,2 @@ +misc:Depends=debconf (>= 0.5) | debconf-2.0 +misc:Pre-Depends= diff --git a/borg-family-0.2/debian/borg-family.templates b/borg-family-0.2/debian/borg-family.templates new file mode 100644 index 0000000..4c1a6c9 --- /dev/null +++ b/borg-family-0.2/debian/borg-family.templates @@ -0,0 +1,16 @@ +Template: borg-family/borg-repo +Type: string +Description: Borg repository URL: + Please set the backup destination. + . + It will be exported to BORG_REPO by bfrun for borg commands. + Could be 'ssh://user@host:port/abspath/to/repo', or 'user@host:relpath/to/repo', see man borg. + +Template: borg-family/borg-repo2 +Type: string +Description: Second Borg repository URL: + Please set the second backup destination. + . + It will be exported to BORG_REPO by bfrun for borg commands. + Could be 'ssh://user@host:port/abspath/to/repo', or 'user@host:relpath/to/repo', see man borg. + diff --git a/borg-family-0.2/debian/changelog b/borg-family-0.2/debian/changelog new file mode 100644 index 0000000..b88eba1 --- /dev/null +++ b/borg-family-0.2/debian/changelog @@ -0,0 +1,5 @@ +borg-family (0.2-1) UNRELEASED; urgency=medium + + * New upstream release. + + -- Ludovic Pouzenc Tue, 15 Jun 2021 15:59:45 +0200 diff --git a/borg-family-0.2/debian/compat b/borg-family-0.2/debian/compat new file mode 100644 index 0000000..f599e28 --- /dev/null +++ b/borg-family-0.2/debian/compat @@ -0,0 +1 @@ +10 diff --git a/borg-family-0.2/debian/control b/borg-family-0.2/debian/control new file mode 100644 index 0000000..3ca323f --- /dev/null +++ b/borg-family-0.2/debian/control @@ -0,0 +1,14 @@ +Source: borg-family +Maintainer: Ludovic Pouzenc +Section: admin +Priority: optional +Standards-Version: 4.3.0 +Build-Depends: debhelper (>= 10) + +Package: borg-family +Architecture: all +Depends: bash (>= 2.0), borgbackup (>= 1.0), coreutils (>= 4.0), debconf, gawk, openssh-client, pwgen (>= 2.0), sed (>= 4.0), util-linux (>= 2.0), ${misc:Depends} +Description: Makes Borg running periodically to backup computers to a remote server + borg-family ease the backup automation configuration around Borg + in small environnements, like backuping some computers to a remote + family server. diff --git a/borg-family-0.2/debian/debhelper-build-stamp b/borg-family-0.2/debian/debhelper-build-stamp new file mode 100644 index 0000000..e8dd97e --- /dev/null +++ b/borg-family-0.2/debian/debhelper-build-stamp @@ -0,0 +1 @@ +borg-family diff --git a/borg-family-0.2/debian/files b/borg-family-0.2/debian/files new file mode 100644 index 0000000..120b6c0 --- /dev/null +++ b/borg-family-0.2/debian/files @@ -0,0 +1,2 @@ +borg-family_0.2-1_all.deb admin optional +borg-family_0.2-1_amd64.buildinfo admin optional diff --git a/borg-family-0.2/debian/rules b/borg-family-0.2/debian/rules new file mode 100755 index 0000000..cbe925d --- /dev/null +++ b/borg-family-0.2/debian/rules @@ -0,0 +1,3 @@ +#!/usr/bin/make -f +%: + dh $@ diff --git a/borg-family-0.2/debian/source/format b/borg-family-0.2/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/borg-family-0.2/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/borg-family-0.2/doc/examples/envvars b/borg-family-0.2/doc/examples/envvars new file mode 100644 index 0000000..99f7139 --- /dev/null +++ b/borg-family-0.2/doc/examples/envvars @@ -0,0 +1,10 @@ +# To consult or restore backups, just load this file in a root shell environnement variables with: +# source /etc/borg-family/envvars +# Then use commands like: +# borg list +# mkdir /mnt/restore +# borg mount ::somehostname-rootfs-2020-08-15 /mnt/restore +# cp -ai /mnt/restore/rootfs/etc/veryimportantfile /etc/ +export BORG_RSH="ssh -i /etc/borg-family/id_rsa_borg" +export BORG_PASSCOMMAND="cat /etc/borg-family/passphrase" +export BORG_REPO="ssh://user@host:port/path/to/repo" diff --git a/borg-family-0.2/doc/man/bfenv.1 b/borg-family-0.2/doc/man/bfenv.1 new file mode 120000 index 0000000..080be00 --- /dev/null +++ b/borg-family-0.2/doc/man/bfenv.1 @@ -0,0 +1 @@ +bfrun.1 \ No newline at end of file diff --git a/borg-family-0.2/doc/man/bfrun.1 b/borg-family-0.2/doc/man/bfrun.1 new file mode 100644 index 0000000..efc42a7 --- /dev/null +++ b/borg-family-0.2/doc/man/bfrun.1 @@ -0,0 +1,52 @@ +.TH BORG-FAMILY 1 local +.SH NAME +bfrun, bfwhat, bfenv \- scripts to run Borg to backup your computers +.SH SYNOPSIS +.ll +8 +.B bfrun +.ll -8 +.br +.SH DESCRIPTION +.I bfrun +invokes +.I bfenv +then +.I bfwhat +to check repository availability and list local mount points to backup. +.SH OPTIONS +.ll +8 +.B No options. +See /etc/borg-family +.ll -8 +.SH "ENVIRONMENT" +.B bfrun +loads /etc/borg-family/envvars for Borg and /etc/borg-family/confvars for itself. +.SH "SEE ALSO" +borgbackup(1) +.SH CAVEATS +Poor manpage. +.SH BUGS +Reports them to +.BR "" +.SH "COPYRIGHT NOTICE" +Copyright \(co 2020 Ludovic Pouzenc +.PP +Permission is granted to make and distribute verbatim copies of +this manual provided the copyright notice and this permission notice +are preserved on all copies. +.ig +Permission is granted to process this file through troff and print the +results, provided the printed document carries copying permission +notice identical to this one except for the removal of this paragraph +(this paragraph not being relevant to the printed manual). +.. +.PP +Permission is granted to copy and distribute modified versions of this +manual under the conditions for verbatim copying, provided that the entire +resulting derived work is distributed under the terms of a permission +notice identical to this one. +.PP +Permission is granted to copy and distribute translations of this manual +into another language, under the above conditions for modified versions, +except that this permission notice may be stated in a translation approved +by the Foundation. diff --git a/borg-family-0.2/doc/man/bfwhat.1 b/borg-family-0.2/doc/man/bfwhat.1 new file mode 120000 index 0000000..080be00 --- /dev/null +++ b/borg-family-0.2/doc/man/bfwhat.1 @@ -0,0 +1 @@ +bfrun.1 \ No newline at end of file diff --git a/borg-family-0.2/src/etc/bfhooks b/borg-family-0.2/src/etc/bfhooks new file mode 100755 index 0000000..c7ce378 --- /dev/null +++ b/borg-family-0.2/src/etc/bfhooks @@ -0,0 +1,43 @@ +#!/bin/bash -e +mount_bind_rootfs() { + if ! mount | grep -q /rootfs; then + mkdir -p /rootfs + mount --bind / /rootfs + fi +} + +mount_efi() { + if ! mount | grep -q /boot/efi; then + mount /boot/efi + fi +} + +umount_bind_rootfs() { + if mount | grep -q /rootfs; then + umount /rootfs || lsof -n | grep /rootfs + rmdir /rootfs + fi +} + +umount_efi() { + if mount | grep -q /boot/efi; then + umount /boot/efi || lsof -n | grep /boot/efi + fi +} + +case $1 in + before) + echo "Start of backup: $2 to $BORG_REPO" + case $2 in + rootfs) apt-get clean || true; mount_bind_rootfs;; + boot-efi) mount_efi ;; + esac + ;; + after) + case $2 in + rootfs) umount_bind_rootfs ;; + boot-efi) umount_efi ;; + esac + echo "End of backup: $2 to $BORG_REPO" + ;; +esac diff --git a/borg-family-0.2/src/etc/confvars b/borg-family-0.2/src/etc/confvars new file mode 100644 index 0000000..4737195 --- /dev/null +++ b/borg-family-0.2/src/etc/confvars @@ -0,0 +1,4 @@ +# This file is used by bfenv and bfrun (bash scripts) +borg_init_opts=( -e repokey-blake2 --make-parent-dirs -v ) +borg_create_opts=( --one-file-system --compression zstd --exclude-caches --exclude-if-present=NOBACKUPDIR.TAG --keep-exclude-tags --list --filter=AMEi-x --stats --show-rc -v ) +quiet=0 diff --git a/borg-family-0.2/src/etc/excludes.d/home b/borg-family-0.2/src/etc/excludes.d/home new file mode 100644 index 0000000..c7aead3 --- /dev/null +++ b/borg-family-0.2/src/etc/excludes.d/home @@ -0,0 +1,4 @@ +**/.cache/* +/home/*/.mozilla/**/datareporting +/home/*/.thunderbird/**/global-messages-db.sqlite +/home/*/.thunderbird/**/ImapMail diff --git a/borg-family-0.2/src/etc/excludes.d/rootfs b/borg-family-0.2/src/etc/excludes.d/rootfs new file mode 100644 index 0000000..b61797b --- /dev/null +++ b/borg-family-0.2/src/etc/excludes.d/rootfs @@ -0,0 +1,5 @@ +/rootfs/var/cache/apt/* +**/.cache/* +/rootfs/home/*/.mozilla/**/datareporting +/rootfs/home/*/.thunderbird/**/global-messages-db.sqlite +/rootfs/home/*/.thunderbird/**/ImapMail diff --git a/borg-family-0.2/src/sbin/bfenv b/borg-family-0.2/src/sbin/bfenv new file mode 100755 index 0000000..756ef62 --- /dev/null +++ b/borg-family-0.2/src/sbin/bfenv @@ -0,0 +1,31 @@ +#!/bin/bash +umask 0077 +source /etc/borg-family/confvars +source /etc/borg-family/envvars +PATH="/etc/borg-family:$PATH" + +if [ \! -r /etc/borg-family/passphrase ]; then + echo "No passphrase (repokey) found, creating a new one" >&2 + touch /etc/borg-family/passphrase + chmod 600 /etc/borg-family/passphrase + pwgen 32 1 >> /etc/borg-family/passphrase + ls -l /etc/borg-family/passphrase >&2 + echo "You NEED to store it in a password manager to be able to restore backups" >&2 +fi + +if [ \! -r /etc/borg-family/id_rsa_borg ]; then + echo "No SSH key found, creating a new one" >&2 + ssh-keygen -N "" -C "$(id -un)_borg@$(hostname)" -f /etc/borg-family/id_rsa_borg \ + && cat /etc/borg-family/id_rsa_borg.pub +fi + +borg init "${borg_init_opts[@]}" 2>&1 | grep -vE '^A repository already exists' >&2 + +if ! borg check "${borg_check_opts[@]}"; then + echo "Showing BORG_* env variables (see /etc/borg-family/envvars) :" >&2 + env | grep ^BORG_ >&2 + echo "End of BORG_* env variables" >&2 + echo >&2 + echo "Can't access to or check the borg repository, exiting, no backup made" >&2 + exit 1 +fi diff --git a/borg-family-0.2/src/sbin/bfenv2 b/borg-family-0.2/src/sbin/bfenv2 new file mode 100755 index 0000000..6e5adeb --- /dev/null +++ b/borg-family-0.2/src/sbin/bfenv2 @@ -0,0 +1,31 @@ +#!/bin/bash +umask 0077 +source /etc/borg-family/confvars +source /etc/borg-family/envvars2 +PATH="/etc/borg-family:$PATH" + +if [ \! -r /etc/borg-family/passphrase2 ]; then + echo "No passphrase2 (repokey) found, creating a new one" >&2 + touch /etc/borg-family/passphrase2 + chmod 600 /etc/borg-family/passphrase2 + pwgen 32 1 >> /etc/borg-family/passphrase2 + ls -l /etc/borg-family/passphrase2 >&2 + echo "You NEED to store it in a password manager to be able to restore backups" >&2 +fi + +if [ \! -r /etc/borg-family/id_rsa_borg ]; then + echo "No SSH key found, creating a new one" >&2 + ssh-keygen -N "" -C "$(id -un)_borg@$(hostname)" -f /etc/borg-family/id_rsa_borg \ + && cat /etc/borg-family/id_rsa_borg.pub +fi + +LANG=C borg init "${borg_init_opts[@]}" 2>&1 | grep -vE '^A repository already exists' >&2 + +if ! borg list > /dev/null; then + echo "Showing BORG_* env variables (see /etc/borg-family/envvars) :" >&2 + env | grep ^BORG_ >&2 + echo "End of BORG_* env variables" >&2 + echo >&2 + echo "Can't access to or check the borg repository, exiting, no backup made" >&2 + exit 1 +fi diff --git a/borg-family-0.2/src/sbin/bfrun b/borg-family-0.2/src/sbin/bfrun new file mode 100755 index 0000000..b0f80dd --- /dev/null +++ b/borg-family-0.2/src/sbin/bfrun @@ -0,0 +1,32 @@ +#!/bin/bash +for e in bfenv bfenv2 +do + source $e + bfwhat | while IFS=' ' read -r mpe dev; do + mp=$(echo -e "$mpe") # mp: interpret escapings that may be present in /proc/mounts (\040 for space...) + name=${mp// /_}; # name: replace space by underscore + name=${mp//\//-}; name=${name/-/} # name: replace slash by dash, remove the leading one + if [[ "$mp $name $dev" =~ "--" || "$mp $name $dev" =~ ".." || "$mp $name $dev" =~ "[|&;()<>]" ]]; then + echo "Skipping $mpe because of shell unsafe characters" >&2 + continue + fi + + comment=$(blkid -- "$dev") + if [ -r "/etc/borg-family/excludes.d/$name" ]; then + runtime_args=( --comment="$comment" --exclude-from="/etc/borg-family/excludes.d/$name" ) + else + runtime_args=( --comment="$comment" ) + fi + + bfhooks before "$name" && \ + borg create "${runtime_args[@]}" "${borg_create_opts[@]}" "::{hostname}-$name-{now:%Y-%m-%d}" "$mp" + rc1=$? + bfhooks after "$name" + rc2=$? + if [ "$rc1" -ne 0 -o "$rc2" -ne 0 ]; then + echo "Errors during $name backup, return codes $rc1 (bfhook before && borg create) and $rc2 (bfhook after)" >&2 + else + [ "x$quiet" == "x1" ] || echo "Success for $name backup" + fi + done +done diff --git a/borg-family-0.2/src/sbin/bfwhat b/borg-family-0.2/src/sbin/bfwhat new file mode 100755 index 0000000..bf9cf4d --- /dev/null +++ b/borg-family-0.2/src/sbin/bfwhat @@ -0,0 +1,24 @@ +#!/bin/bash +what-from-proc-mounts() { + # Special case for "/", show it as /rootfs (see hook_* files). Helps saving initial /dev nodes files behind udev + awk '( $2 == "/" ) { print "/rootfs",$1 }' /proc/mounts + + # Backup all non "/", non-removable, mounted filesystems which device is also shown in /sys/block + tmp=$(mktemp) + grep 0 /sys/block/*/removable | sed -e 's#^/sys/block#^/dev#' -e 's#/removable:0$##' >> "$tmp" + grep -Ef "$tmp" /proc/mounts | awk '( $2 !~ /^\/(rootfs|$)/ ) { print $2,$1 }' + rm -- "$tmp" +} + +if [ -r /etc/borg-family/what.override ]; then + cat /etc/borg-family/what.override +else + if [ -r /etc/borg-family/what.include ]; then + cat /etc/borg-family/what.include + fi + if [ -r /etc/borg-family/what.exclude ]; then + what-from-proc-mounts | grep -vEf /etc/borg-family/what.exclude + else + what-from-proc-mounts + fi +fi -- cgit v1.2.3