2021-11-07 03:05:53 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# Backup root filesystem with borg
|
2021-11-09 04:37:07 +00:00
|
|
|
case "$1" in
|
|
|
|
(-*) name="${1#-}"; shift;;
|
|
|
|
(*) test $# -gt 0 || cd /;;
|
|
|
|
esac
|
|
|
|
name="/mnt/backup/borg::$(test -n "$name" && echo "$name" || cat /etc/hostname)-${1:-system}-$(date -u +"%y%m%d")"
|
|
|
|
echo "Backing up as $name"
|
2021-11-07 03:05:53 +00:00
|
|
|
sudo borg create --progress --stats \
|
2021-11-07 03:19:01 +00:00
|
|
|
$(echo $IGNOREDIRS_PURE -x 'software-challenge/*/build' -x 'emacs/.local' | sed 's|-x \([^ ]\+\)|-e "*/\1" -e \1|g') \
|
2021-11-09 04:37:07 +00:00
|
|
|
"$name" $(test $# -eq 0 && echo etc home root || test $# -eq 1 && echo $1) "${@:2}"
|