1
0
mirror of https://github.com/Zygo/bees.git synced 2025-05-17 21:35:45 +02:00

Allow custom libexec location

To install for different distributions, LIBEXEC_PREFIX can now be set.
It defaults to $(PREFIX)/usr/lib/bees as used in most common
distributions.

Local overrides are possible by setting variables in a "localconf" file
which will be included by the Makefile if it exists.

For some distributions you may want to set it to /usr/libexec or
/usr/libexec/bees.
This commit is contained in:
Kai Krakow 2017-09-20 21:00:54 +02:00
parent 0455827989
commit 893595190f
3 changed files with 13 additions and 5 deletions

1
.gitignore vendored
View File

@ -10,3 +10,4 @@ html/
latex/
make.log
make.log.new
localconf

View File

@ -1,8 +1,12 @@
PREFIX ?= /
LIBEXEC_PREFIX ?= $(PREFIX)/usr/lib
MARKDOWN := $(shell which markdown markdown2 markdown_py 2>/dev/null)
MARKDOWN ?= markdown
# allow local configuration to override above variables
-include localconf
default all: lib src test README.html
clean: ## Cleanup
@ -21,6 +25,9 @@ test: ## Run tests
test: lib src
$(MAKE) -C test
scripts/beesd: scripts/beesd.in
sed -e's#@LIBEXEC_PREFIX@#$(LIBEXEC_PREFIX)#' -e's#@PREFIX@#$(PREFIX)#' "$<" >"$@"
README.html: README.md
$(MARKDOWN) README.md > README.html.new
mv -f README.html.new README.html
@ -28,9 +35,10 @@ README.html: README.md
install: ## Install bees + libs
install: lib src test
install -Dm644 lib/libcrucible.so $(PREFIX)/usr/lib/libcrucible.so
install -Dm755 bin/bees $(PREFIX)/usr/libexec/bees
install -Dm755 bin/bees $(LIBEXEC_PREFIX)/bees/bees
install_scripts: ## Install scipts
install_scripts: scripts/beesd
install -Dm755 scripts/beesd $(PREFIX)/usr/sbin/beesd
install -Dm644 scripts/beesd.conf.sample $(PREFIX)/etc/bees/beesd.conf.sample
install -Dm644 scripts/beesd@.service $(PREFIX)/lib/systemd/system/beesd@.service

View File

@ -1,5 +1,4 @@
#!/bin/bash
# /usr/bin/beesd
## Helpful functions
INFO(){ echo "INFO:" "$@"; }
@ -13,7 +12,7 @@ export CONFIG_FILE
export UUID AL16M
readonly AL16M="$((16*1024*1024))"
readonly CONFIG_DIR=/etc/bees/
readonly CONFIG_DIR=@PREFIX@/etc/bees/
## Pre checks
{
@ -21,7 +20,7 @@ readonly CONFIG_DIR=/etc/bees/
[ "$UID" == "0" ] || ERRO "Must be run as root"
}
command -v /usr/libexec/bees &> /dev/null || ERRO "Missing 'bees' agent"
command -v @LIBEXEC_PREFIX@/bees &> /dev/null || ERRO "Missing 'bees' agent"
## Parse args
UUID="$1"
@ -123,6 +122,6 @@ filter_path(){
fi
}
/usr/libexec/bees "$MNT_DIR" 3>&1 2>&1 | filter_time | filter_path
@LIBEXEC_PREFIX@/bees "$MNT_DIR" 3>&1 2>&1 | filter_time | filter_path
exit 0