summaryrefslogtreecommitdiff
path: root/borg-family-0.1/src/sbin
diff options
context:
space:
mode:
Diffstat (limited to 'borg-family-0.1/src/sbin')
-rwxr-xr-xborg-family-0.1/src/sbin/bfenv31
-rwxr-xr-xborg-family-0.1/src/sbin/bfrun29
-rwxr-xr-xborg-family-0.1/src/sbin/bfwhat24
3 files changed, 0 insertions, 84 deletions
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