look for config files in standard location on installation
This commit is contained in:
2
Makefile
2
Makefile
@@ -25,6 +25,6 @@ SYSTEMD_DIR = $(DESTDIR)$(PREFIX)/lib/systemd/system
|
||||
.PHONY: install
|
||||
|
||||
install:
|
||||
@sed -i 's@^SNAPPER_CONFIG.*@SNAPPER_CONFIG='$(SNAPPER_CONFIG)'@g' bin/$(PKGNAME)
|
||||
@./find_snapper_config || sed -i 's@^SNAPPER_CONFIG.*@SNAPPER_CONFIG='$(SNAPPER_CONFIG)'@g' bin/$(PKGNAME)
|
||||
@install -Dm755 bin/* -t $(BIN_DIR)/
|
||||
@install -Dm644 systemd/* -t $(SYSTEMD_DIR)/
|
||||
|
||||
13
README.md
13
README.md
@@ -22,21 +22,8 @@ snapper is required.
|
||||
|
||||
## Installation
|
||||
|
||||
Run:
|
||||
|
||||
# make install
|
||||
|
||||
By default it will look for the snapper configuration file at
|
||||
`/etc/sysconfig/snapper`. To change this pass `SNAPPER_CONFIG` to make
|
||||
with the location of the configuration file. For example, with Ubuntu
|
||||
you will want to install:
|
||||
|
||||
# make SNAPPER_CONFIG=/etc/default/snapper install
|
||||
|
||||
For Arch Linux it would be:
|
||||
|
||||
# make SNAPPER_CONFIG=/etc/conf.d/snapper install
|
||||
|
||||
The package is available in the [AUR](https://aur.archlinux.org/packages/snap-sync/).
|
||||
|
||||
## Options
|
||||
|
||||
@@ -29,8 +29,9 @@ set -o errtrace
|
||||
version="0.4"
|
||||
name="snap-sync"
|
||||
|
||||
# The following line is modified by the Makefile
|
||||
SNAPPER_CONFIG=/etc/conf.d/snapper
|
||||
# The following line is modified by the Makefile or
|
||||
# find_snapper_config script
|
||||
SNAPPER_CONFIG=/etc/sysconfig/snapper
|
||||
|
||||
TMPDIR=$(mktemp -d)
|
||||
PIPE=$TMPDIR/$name.out
|
||||
|
||||
15
find_snapper_config
Executable file
15
find_snapper_config
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
etcdirs="sysconfig default conf.d"
|
||||
|
||||
for x in $etcdirs; do
|
||||
d=/etc/$x/snapper
|
||||
if [[ -f $d ]]; then
|
||||
sed -i 's@^SNAPPER_CONFIG.*@SNAPPER_CONFIG='$d'@g' bin/snap-sync
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
|
||||
printf "==> Unable to find snapper configuration file in a standard location.\n"
|
||||
printf "==> Using SNAPPER_CONFIG make variable.\n"
|
||||
exit 1
|
||||
Reference in New Issue
Block a user