Skip to content
Snippets Groups Projects

WIP: Add initial restic support.

Closed Christopher Gervais requested to merge ergonlogic/backupninja:dev/restic into master
2 unresolved threads
+ 11
5
@@ -30,19 +30,19 @@ getconf backup "yes"
@@ -30,19 +30,19 @@ getconf backup "yes"
getconf retention "no"
getconf retention "no"
getconf check "no"
getconf check "no"
 
##############################################
##############################################
# #
# #
# Take snapshots/backups of specified data. #
# Take snapshots/backups of specified data. #
# #
# #
##############################################
##############################################
if [[ "$backup" == "yes" ]]; then
if [[ "$backup" == "yes" ]]; then
setsection backup
setsection backup
getconf include "/etc /home /usr/local"
getconf include "/ /boot /usr /var /home"
getconf exclude "/tmp /proc /dev /sys /net /misc /media /srv /selinux"
getconf exclude "/home/*/.cache **/.Trash-* **/[Cc]ache/* *.vmdk /tmp/* **/build-area/* /var/cache/* /var/tmp/* /var/log/*"
getconf tag
getconf tag
getconf one_file_system "yes"
getconf one_file_system "yes"
@@ -61,11 +61,18 @@ if [[ "$backup" == "yes" ]]; then
@@ -61,11 +61,18 @@ if [[ "$backup" == "yes" ]]; then
debug "No exclusion patterns defined."
debug "No exclusion patterns defined."
else
else
debug "Files matching the following patterns will be excluded from backups:"
debug "Files matching the following patterns will be excluded from backups:"
 
set -f
for e in $exclude
for e in $exclude
do
do
exclude_options="$exclude_options --exclude $e"
exclude_options="$exclude_options --exclude=$e"
debug "==> $e"
debug "==> $e"
done
done
 
if [ -d $repo ]; then
 
# Avoid infinite recursion if we try to backup a local repository.
 
exclude_options="$exclude_options --exclude=$repo"
 
debug "==> $repo"
 
fi
 
set +f
fi
fi
if [ -z "$tag" ]; then
if [ -z "$tag" ]; then
@@ -83,7 +90,6 @@ if [[ "$backup" == "yes" ]]; then
@@ -83,7 +90,6 @@ if [[ "$backup" == "yes" ]]; then
other_options="$other_options --one-file-system"
other_options="$other_options --one-file-system"
fi
fi
info "Taking backup snapshot."
info "Taking backup snapshot."
debug "Running: restic --repo $repo --password-file $password_file backup $other_options $tag_options $exclude_options $include_options"
debug "Running: restic --repo $repo --password-file $password_file backup $other_options $tag_options $exclude_options $include_options"
restic --repo $repo --password-file $password_file backup $other_options $tag_options $exclude_options $include_options
restic --repo $repo --password-file $password_file backup $other_options $tag_options $exclude_options $include_options
Loading