From 3f9e25417cd8eca5260b634bec806bd78d704c04 Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Thu, 25 May 2023 00:30:15 -0400 Subject: renames --- Makefile | 6 ++++-- src/push-btrfs | 2 +- src/push-btrfs.service | 4 ++-- src/push-btrfs.timer | 2 +- src/push-btrfs@.service | 4 ++-- 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 @@ -config_dir = /etc/btrfs-backup/remotes +config_dir = /etc/btrfs/remotes +bindir = /usr/local/bin main_unit_name = push-btrfs remotes = $(notdir $(basename $(wildcard $(config_dir)/*.json))) timers = $(addprefix $(main_unit_name)@, $(addsuffix .timer, $(remotes))) @@ -11,12 +12,13 @@ unit_files = $(wildcard src/*.service src/*.timer) plain_units = $(enable_unit) $(shell printf '%s\n' $(notdir $(unit_files)) | grep -v '@') template_units = $(timers) $(services) units = $(plain_units) $(template_units) - +binaries = $(addprefix src/,push-btrfs retain-snapshots) install: + install -t $(bindir) -- $(binaries) systemctl link $(addprefix ./, $(unit_files)) systemctl reset-failed $(units) 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 @@ #!/bin/bash MIN_AGE_SECONDS=60 -CONFIG_DIR=/etc/btrfs-backup/remotes +CONFIG_DIR=/etc/btrfs/remotes die() { 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 @@ [Unit] Description = Btrfs Backup over SSH ConditionUser = root -ConditionPathExistsGlob = /etc/btrfs-backup/remotes/*.json +ConditionPathExistsGlob = /etc/btrfs/remotes/*.json [Service] -WorkingDirectory = /etc/btrfs-backup/remotes +WorkingDirectory = /etc/btrfs/remotes ExecStart = bash -e -c '\ shopt -s failglob; \ units=(*.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 @@ [Unit] Description = Btrfs Backup over SSH -ConditionPathExistsGlob = /etc/btrfs-backup/remotes/*.json +ConditionPathExistsGlob = /etc/btrfs/remotes/*.json [Timer] OnUnitInactiveSec=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 @@ [Unit] Description = Btrfs Backup over SSH ConditionUser = root -ConditionFileNotEmpty = /etc/btrfs-backup/remotes/%I.json +ConditionFileNotEmpty = /etc/btrfs/remotes/%I.json [Service] -ExecStart = /root/src/local-btrfs-backup/src/push-btrfs %I.json +ExecStart = push-btrfs %I.json [Install] WantedBy=default.target -- cgit v1.2.3