Browse Source

update restic to v0.13.1 and add backup scripts

main
Nicolas Massé 4 years ago
parent
commit
d2b3ffaab9
  1. 9
      SOURCES/restic-excludes.txt
  2. 13
      SOURCES/restic-itix-backup
  3. 8
      SOURCES/restic.conf
  4. 5
      SOURCES/restic.service
  5. 9
      SOURCES/restic.timer
  6. 34
      SPECS/restic.spec

9
SOURCES/restic-excludes.txt

@ -0,0 +1,9 @@
lost+found
.DS_Store
thumbs.db
/var/restic
/proc
/sys
/dev
/run
/tmp

13
SOURCES/restic-itix-backup

@ -0,0 +1,13 @@
#!/bin/bash
set -Eeuo pipefail
export PATH="/opt/restic/bin:$PATH"
. /opt/restic/etc/restic.conf
if [ -f /opt/restic/etc/excludes.txt ]; then
RESTIC_OPTIONS+=("--exclude-file=/opt/restic/etc/excludes.txt")
fi
echo "Starting a backup..."
restic backup "${RESTIC_OPTIONS[@]}" "${RESTIC_TARGETS[@]}" "$@"

8
SOURCES/restic.conf

@ -0,0 +1,8 @@
export B2_ACCOUNT_ID='backblaze key id'
export B2_ACCOUNT_KEY='backblaze key secret'
export RESTIC_REPOSITORY='backblaze repo'
export RESTIC_PASSWORD_FILE=/opt/restic/etc/restic.key
export RESTIC_CACHE_DIR=/srv/restic/cache/
export TMPDIR=/srv/restic/tmp/
RESTIC_TARGETS=("/")
RESTIC_OPTIONS=()

5
SOURCES/restic.service

@ -0,0 +1,5 @@
[Unit]
Description=Run a backup
[Service]
ExecStart=/opt/restic/bin/itix-backup

9
SOURCES/restic.timer

@ -0,0 +1,9 @@
[Unit]
Description=Schedule a periodic backup
[Timer]
OnBootSec=1h
OnUnitActiveSec=1d
[Install]
WantedBy=timers.target

34
SPECS/restic.spec

@ -1,9 +1,15 @@
Name: restic
Version: 0.12.0
Version: 0.13.1
Release: itix1
Summary: Fast, secure, efficient backup program
License: BSD
Source0: https://github.com/restic/%{name}/releases/download/v%{version}/%{name}_%{version}_linux_amd64.bz2
Source1: restic-excludes.txt
Source2: restic.conf
Source3: restic.service
Source4: restic.timer
Source5: restic-itix-backup
BuildRequires: systemd
ExclusiveArch: x86_64
%description
@ -20,16 +26,36 @@ three major operating systems (Linux, macOS, Windows) and a few smaller ones
%prep
%setup -q -c -T
bunzip2 -c %{S:0} > restic
cp %{S:1} excludes.txt
cp %{S:2} restic.conf
cp %{S:3} restic.service
cp %{S:4} restic.timer
cp %{S:5} itix-backup
%build
%install
install -D restic %{buildroot}/opt/restic/bin/restic
install -m 0755 -D restic %{buildroot}/opt/restic/bin/restic
install -m 0600 -D restic.conf %{buildroot}/opt/restic/etc/restic.conf
install -m 0644 -D excludes.txt %{buildroot}/opt/restic/etc/excludes.txt
install -m 0755 -D itix-backup %{buildroot}/opt/restic/bin/itix-backup
install -m 0700 -d %{buildroot}/srv/restic
install -m 0700 -d %{buildroot}/srv/restic/tmp
install -m 0700 -d %{buildroot}/srv/restic/cache
install -m 0644 -D restic.service %{buildroot}/%{_unitdir}/restic.service
install -m 0644 -D restic.timer %{buildroot}/%{_unitdir}/restic.timer
%files
%defattr(0644, root, root, 0755)
%attr(0755, root, root) /opt/restic/bin/restic
%attr(0755, root, root) /opt/restic/bin/itix-backup
/opt/restic/etc
%config(noreplace) %attr(0600, root, root) /opt/restic/etc/restic.conf
%config(noreplace) /opt/restic/etc/excludes.txt
%attr(0700, root, root) /srv/restic
%attr(0700, root, root) /srv/restic/tmp
%attr(0700, root, root) /srv/restic/cache
%{_unitdir}/restic.service
%{_unitdir}/restic.timer
%changelog
* Mon Feb 22 2021 Nicolas MASSE <nicolas.masse@itix.fr> - 0.12.0-itix1
- First release

Loading…
Cancel
Save