-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nfpms config for linux packages (apk,deb,rpm)
- Loading branch information
Showing
3 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,3 +125,41 @@ brews: | |
system "#{bin}/resticprofile", "backup", "testfile" | ||
system "#{bin}/resticprofile", "restore", "latest", "-t", "#{testpath}/restore" | ||
assert compare_file "testfile", "#{testpath}/restore/testfile" | ||
nfpms: | ||
- | ||
builds: | ||
- resticprofile_targz | ||
formats: | ||
- apk | ||
- deb | ||
- rpm | ||
vendor: "creativeprojects" | ||
homepage: "https://github.com/creativeprojects" | ||
maintainer: "[email protected]" | ||
description: "Configuration profiles for restic backup" | ||
license: "GPL-3.0-only" | ||
file_name_template: "{{.ProjectName}}_{{.Version}}-{{.Arch}}" | ||
replacements: | ||
amd64: 64bit | ||
386: 32bit | ||
arm: ARM | ||
arm64: ARM64 | ||
linux: Linux | ||
dependencies: | ||
- restic | ||
bindir: "/usr/local/bin" | ||
scripts: | ||
postinstall: "contrib/posix/post-install.sh" | ||
contents: | ||
- { type: config, src: contrib/posix/profiles.conf, dst: /etc/resticprofile/profiles.conf.dist } | ||
- { type: config, src: contrib/posix/conf.d/check.conf, dst: /etc/resticprofile/conf.d/check.conf.dist } | ||
- { type: config, src: contrib/posix/conf.d/hooks.conf, dst: /etc/resticprofile/conf.d/hooks.conf.dist } | ||
- { type: config, src: contrib/posix/conf.d/metrics.conf, dst: /etc/resticprofile/conf.d/metrics.conf.dist } | ||
- { type: config, src: contrib/posix/conf.d/prune.conf, dst: /etc/resticprofile/conf.d/prune.conf.dist } | ||
- { type: config, src: contrib/posix/conf.d/repository.conf, dst: /etc/resticprofile/conf.d/repository.conf.dist } | ||
- { type: config, src: contrib/posix/profiles.d/fs-snapshot.yaml.sample, dst: /etc/resticprofile/profiles.d/fs-snapshot.yaml.sample } | ||
- { type: config, src: contrib/posix/profiles.d/system.toml, dst: /etc/resticprofile/profiles.d/system.toml.dist } | ||
- src: contrib/systemd/resticprofile-send-error.sh | ||
dst: /usr/local/bin/resticprofile-send-error | ||
file_info: { mode: 0640, owner: root, group: root } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env sh | ||
set -e | ||
|
||
CONFIG_PATH="/etc/resticprofile" | ||
SECRET_FILE="${CONFIG_PATH}/conf.d/default-repository.secret" | ||
|
||
# Fix permissions (only root may edit and read since password | ||
# & tokens can be in any of the files) | ||
if [ -d "${CONFIG_PATH}" ] ; then | ||
chown -R root:root "${CONFIG_PATH}" | ||
chmod -R 0640 "${CONFIG_PATH}" | ||
else | ||
echo "config path (${CONFIG_PATH}) not found" | ||
exit 1 | ||
fi | ||
|
||
# Check installation | ||
if [ ! -e "$(which resticprofile)" ] || ! resticprofile version ; then | ||
echo "resticprofile not found or not executable" | ||
exit 1 | ||
fi | ||
|
||
# Generate default-repo secret (if missing) | ||
if [ ! -f "${SECRET_FILE}" ] ; then | ||
echo "Generating ${SECRET_FILE}" | ||
resticprofile random-key > "${SECRET_FILE}" | ||
fi | ||
|
||
# Unwrap dist files (if target is missing) | ||
cd "${CONFIG_PATH}" | ||
for file in conf.d/*.dist profiles.d/*.dist ; do | ||
target_file="$(dirname "${file}")/$(basename -s ".dist" "${file}")" | ||
if [ -e "${target_file}" ] ; then | ||
echo "Skipping ${target_file}. File already exists" | ||
else | ||
mv -f "${file}" "${target_file}" | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters