summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2014-10-01 03:16:30 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2014-10-01 03:16:30 -0400
commit9b6b6dad291e2d62a957a38ace952d98147a83d2 (patch)
tree1e3e37af8a9d693d0cb749999aaaef095bb7876c
parent051a269d2ff56d5ab01301c965a7f7d0799bc441 (diff)
conf.sh: don't hardcode /etc, get it during build from $(sysconfdir)
-rw-r--r--common.mk9
-rw-r--r--src/lib/.gitignore1
-rw-r--r--src/lib/Makefile2
-rw-r--r--src/lib/conf.sh.in (renamed from src/lib/conf.sh)12
4 files changed, 16 insertions, 8 deletions
diff --git a/common.mk b/common.mk
index bd0b0d5..e1051de 100644
--- a/common.mk
+++ b/common.mk
@@ -9,7 +9,10 @@ pkglibexecdir ?= $(libexecdir)/libretools
# Usage: <INPUT $(edit) >OUTPUT
# Expand m4_include macros to use librelib
# This is used when using sources grabbed from devtools
-edit = sed -e 's|^\#!\s*/bin/bash|\#!/usr/bin/env bash|' -e 's|m4_include(lib/\(.*\))|. "$$(librelib \1)"|'
+edit = sed \
+ -e 's|^\#!\s*/bin/bash|\#!/usr/bin/env bash|' \
+ -e 's|m4_include(lib/\(.*\))|. "$$(librelib \1)"|' \
+ -e 's|@sysconfdir@|$(sysconfdir)|g'
# Usage: $(call indent,FILENAME)
# Command to auto-indent a file.
@@ -94,6 +97,10 @@ $(sort $(_do_patch)): %: %.ugly Makefile
%: %.in
@echo 'EDIT < $< > $@'; $(edit) <"$<" >"$@"
$(if $(filter-out %.sh,$@),chmod 755 "$@")
+# work-around for what I currently believe to be a regression in Make
+%.sh: %.sh.in
+ @echo 'EDIT < $< > $@'; $(edit) <"$<" >"$@"
+ $(if $(filter-out %.sh,$@),chmod 755 "$@")
# Build ########################################################################
diff --git a/src/lib/.gitignore b/src/lib/.gitignore
index 9a0c402..e769566 100644
--- a/src/lib/.gitignore
+++ b/src/lib/.gitignore
@@ -1,3 +1,4 @@
common.sh
common.sh.in
common.sh.top
+conf.sh
diff --git a/src/lib/Makefile b/src/lib/Makefile
index 5226dda..97b30eb 100644
--- a/src/lib/Makefile
+++ b/src/lib/Makefile
@@ -2,7 +2,7 @@ copy_files = common.sh.in
libexecs = $(filter-out librelib,$(progs))
# include common.sh in libs explicitly, because it might not exist yet
# when the wildcard is performed
-libs = $(sort $(wildcard *.sh) common.sh)
+libs = $(sort $(wildcard *.sh) common.sh conf.sh)
include ../../common.mk
diff --git a/src/lib/conf.sh b/src/lib/conf.sh.in
index 3c4234f..fa66016 100644
--- a/src/lib/conf.sh
+++ b/src/lib/conf.sh.in
@@ -40,27 +40,27 @@ list_files() {
local slug=$1
case $slug in
abs)
- echo /etc/$slug.conf
+ echo @sysconfdir@/$slug.conf
echo "$LIBREHOME/.$slug.conf"
;;
makepkg)
- if [[ ${MAKEPKG_CONF:-} != /etc/$slug.conf && -r ${MAKEPKG_CONF:-} ]]; then
+ if [[ ${MAKEPKG_CONF:-} != @sysconfdir@/$slug.conf && -r ${MAKEPKG_CONF:-} ]]; then
echo "$MAKEPKG_CONF"
else
- echo /etc/$slug.conf
+ echo @sysconfdir@/$slug.conf
echo "$LIBREHOME/.$slug.conf"
fi
;;
xbs*)
- echo /etc/xbs/$slug.conf
+ echo @sysconfdir@/xbs/$slug.conf
echo "$XDG_CONFIG_HOME/xbs/$slug.conf"
;;
libretools)
- echo /etc/$slug.conf
+ echo @sysconfdir@/$slug.conf
echo "$XDG_CONFIG_HOME/libretools/$slug.conf"
;;
*)
- echo /etc/libretools.d/$slug.conf
+ echo @sysconfdir@/libretools.d/$slug.conf
echo "$XDG_CONFIG_HOME/libretools/$slug.conf"
;;
esac