From 893595190fdfb50e32ce48f77e59514ab9f15715 Mon Sep 17 00:00:00 2001 From: Kai Krakow Date: Wed, 20 Sep 2017 21:00:54 +0200 Subject: [PATCH] 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. --- .gitignore | 1 + Makefile | 10 +++++++++- scripts/{beesd => beesd.in} | 7 +++---- 3 files changed, 13 insertions(+), 5 deletions(-) rename scripts/{beesd => beesd.in} (94%) diff --git a/.gitignore b/.gitignore index 7a91af7..d8ca283 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ html/ latex/ make.log make.log.new +localconf diff --git a/Makefile b/Makefile index 0d1ce79..3d75cd7 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/scripts/beesd b/scripts/beesd.in similarity index 94% rename from scripts/beesd rename to scripts/beesd.in index 4c6e99e..f99ea09 100755 --- a/scripts/beesd +++ b/scripts/beesd.in @@ -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