summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2023-05-25 00:30:15 -0400
committerAndrew Cady <d@jerkface.net>2023-05-25 10:01:05 -0400
commit3f9e25417cd8eca5260b634bec806bd78d704c04 (patch)
tree799c9fe3cec16c77b12fdf620752232dae832bfc
parent293d79dde8fd6c3006b74b2b5131362bb7cdd82f (diff)
renames
-rw-r--r--Makefile6
-rwxr-xr-xsrc/push-btrfs2
-rw-r--r--src/push-btrfs.service4
-rw-r--r--src/push-btrfs.timer2
-rw-r--r--src/push-btrfs@.service4
5 files changed, 10 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index d812c9b..f177968 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,5 @@
1config_dir = /etc/btrfs-backup/remotes 1config_dir = /etc/btrfs/remotes
2bindir = /usr/local/bin
2main_unit_name = push-btrfs 3main_unit_name = push-btrfs
3remotes = $(notdir $(basename $(wildcard $(config_dir)/*.json))) 4remotes = $(notdir $(basename $(wildcard $(config_dir)/*.json)))
4timers = $(addprefix $(main_unit_name)@, $(addsuffix .timer, $(remotes))) 5timers = $(addprefix $(main_unit_name)@, $(addsuffix .timer, $(remotes)))
@@ -11,12 +12,13 @@ unit_files = $(wildcard src/*.service src/*.timer)
11plain_units = $(enable_unit) $(shell printf '%s\n' $(notdir $(unit_files)) | grep -v '@') 12plain_units = $(enable_unit) $(shell printf '%s\n' $(notdir $(unit_files)) | grep -v '@')
12template_units = $(timers) $(services) 13template_units = $(timers) $(services)
13units = $(plain_units) $(template_units) 14units = $(plain_units) $(template_units)
14 15binaries = $(addprefix src/,push-btrfs retain-snapshots)
15 16
16 17
17 18
18 19
19install: 20install:
21 install -t $(bindir) -- $(binaries)
20 systemctl link $(addprefix ./, $(unit_files)) 22 systemctl link $(addprefix ./, $(unit_files))
21 systemctl reset-failed $(units) 23 systemctl reset-failed $(units)
22 systemctl enable --now $(enable_unit) 24 systemctl enable --now $(enable_unit)
diff --git a/src/push-btrfs b/src/push-btrfs
index 3284b69..a534053 100755
--- a/src/push-btrfs
+++ b/src/push-btrfs
@@ -1,6 +1,6 @@
1#!/bin/bash 1#!/bin/bash
2MIN_AGE_SECONDS=60 2MIN_AGE_SECONDS=60
3CONFIG_DIR=/etc/btrfs-backup/remotes 3CONFIG_DIR=/etc/btrfs/remotes
4 4
5die() 5die()
6{ 6{
diff --git a/src/push-btrfs.service b/src/push-btrfs.service
index c4ab87c..0fd8466 100644
--- a/src/push-btrfs.service
+++ b/src/push-btrfs.service
@@ -1,10 +1,10 @@
1[Unit] 1[Unit]
2Description = Btrfs Backup over SSH 2Description = Btrfs Backup over SSH
3ConditionUser = root 3ConditionUser = root
4ConditionPathExistsGlob = /etc/btrfs-backup/remotes/*.json 4ConditionPathExistsGlob = /etc/btrfs/remotes/*.json
5 5
6[Service] 6[Service]
7WorkingDirectory = /etc/btrfs-backup/remotes 7WorkingDirectory = /etc/btrfs/remotes
8ExecStart = bash -e -c '\ 8ExecStart = bash -e -c '\
9shopt -s failglob; \ 9shopt -s failglob; \
10units=(*.json); \ 10units=(*.json); \
diff --git a/src/push-btrfs.timer b/src/push-btrfs.timer
index 4bfb418..79de8af 100644
--- a/src/push-btrfs.timer
+++ b/src/push-btrfs.timer
@@ -1,6 +1,6 @@
1[Unit] 1[Unit]
2Description = Btrfs Backup over SSH 2Description = Btrfs Backup over SSH
3ConditionPathExistsGlob = /etc/btrfs-backup/remotes/*.json 3ConditionPathExistsGlob = /etc/btrfs/remotes/*.json
4 4
5[Timer] 5[Timer]
6OnUnitInactiveSec=5 6OnUnitInactiveSec=5
diff --git a/src/push-btrfs@.service b/src/push-btrfs@.service
index c62febe..47a82ef 100644
--- a/src/push-btrfs@.service
+++ b/src/push-btrfs@.service
@@ -1,10 +1,10 @@
1[Unit] 1[Unit]
2Description = Btrfs Backup over SSH 2Description = Btrfs Backup over SSH
3ConditionUser = root 3ConditionUser = root
4ConditionFileNotEmpty = /etc/btrfs-backup/remotes/%I.json 4ConditionFileNotEmpty = /etc/btrfs/remotes/%I.json
5 5
6[Service] 6[Service]
7ExecStart = /root/src/local-btrfs-backup/src/push-btrfs %I.json 7ExecStart = push-btrfs %I.json
8 8
9[Install] 9[Install]
10WantedBy=default.target 10WantedBy=default.target