From d3863ebc938d5db915283fe815f6a141e15e1ca7 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 27 Jul 2021 02:51:00 +0200 Subject: Supporting /etc/compute-tools/container.conf.d. Signed-off-by: Daniel Baumann --- Makefile | 2 ++ bin/container | 10 ++++++++-- share/hooks/pre-build.git-pull.sh | 11 +++++++---- share/hooks/pre-get.git-pull.sh | 11 +++++++---- share/man/container.1.rst | 2 +- 5 files changed, 25 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index a0e050d..7bcccc9 100644 --- a/Makefile +++ b/Makefile @@ -73,6 +73,7 @@ install: build mkdir -p $(DESTDIR)/etc/$(SOFTWARE)/debconf mkdir -p $(DESTDIR)/etc/$(SOFTWARE)/hooks mkdir -p $(DESTDIR)/etc/$(SOFTWARE)/keys + mkdir -p $(DESTDIR)/etc/${SOFTWARE}/container.conf.d mkdir -p $(DESTDIR)/usr/bin cp -r bin/* $(DESTDIR)/usr/bin @@ -205,6 +206,7 @@ uninstall: rmdir --ignore-fail-on-non-empty --parents $(DESTDIR)/etc/$(SOFTWARE)/debconf || true rmdir --ignore-fail-on-non-empty --parents $(DESTDIR)/etc/$(SOFTWARE)/hooks || true rmdir --ignore-fail-on-non-empty --parents $(DESTDIR)/etc/$(SOFTWARE)/keys || true + rmdir --ignore-fail-on-non-empty --parents $(DESTDIR)/etc/$(SOFTWARE)/container.conf.d || true rmdir --ignore-fail-on-non-empty --parents $(DESTDIR)/etc/$(SOFTWARE) || true rmdir --ignore-fail-on-non-empty --parents $(DESTDIR)/etc || true diff --git a/bin/container b/bin/container index 1ec73ef..172caec 100755 --- a/bin/container +++ b/bin/container @@ -80,9 +80,15 @@ do echo "${DATE} ${HOST} ${CONTAINER_USER} ${PROGRAM} ${COMMAND} ${OPTIONS}" >> "/var/log/${SOFTWARE}/${PROGRAM}.log" # irc - if [ -e /usr/bin/irk ] && [ -e "/etc/${SOFTWARE}.conf" ] + if [ -e /usr/bin/irk ] then - . "/etc/${SOFTWARE}.conf" + for FILE in "/etc/${SOFTWARE}/${PROGRAM}.conf" "/etc/${SOFTWARE}/${PROGRAM}.conf.d"/*.conf + do + if [ -e "${FILE}" ] + then + . "${FILE}" + fi + done if [ -n "${IRK_TARGETS}" ] then diff --git a/share/hooks/pre-build.git-pull.sh b/share/hooks/pre-build.git-pull.sh index 744f955..d2cc152 100755 --- a/share/hooks/pre-build.git-pull.sh +++ b/share/hooks/pre-build.git-pull.sh @@ -31,10 +31,13 @@ do then echo "Updating ${DIRECTORY}..." - if [ -e "/etc/${SOFTWARE}.conf" ] - then - . "/etc/${SOFTWARE}.conf" - fi + for FILE in "/etc/${SOFTWARE}/${PROGRAM}.conf" "/etc/${SOFTWARE}/${PROGRAM}.conf.d"/*.conf + do + if [ -e "${FILE}" ] + then + . "${FILE}" + fi + done DEBCONF_ID="${DEBCONF_ID:-HEAD}" diff --git a/share/hooks/pre-get.git-pull.sh b/share/hooks/pre-get.git-pull.sh index 744f955..d2cc152 100755 --- a/share/hooks/pre-get.git-pull.sh +++ b/share/hooks/pre-get.git-pull.sh @@ -31,10 +31,13 @@ do then echo "Updating ${DIRECTORY}..." - if [ -e "/etc/${SOFTWARE}.conf" ] - then - . "/etc/${SOFTWARE}.conf" - fi + for FILE in "/etc/${SOFTWARE}/${PROGRAM}.conf" "/etc/${SOFTWARE}/${PROGRAM}.conf.d"/*.conf + do + if [ -e "${FILE}" ] + then + . "${FILE}" + fi + done DEBCONF_ID="${DEBCONF_ID:-HEAD}" diff --git a/share/man/container.1.rst b/share/man/container.1.rst index 05139f5..3fff87b 100644 --- a/share/man/container.1.rst +++ b/share/man/container.1.rst @@ -112,7 +112,7 @@ Files The following files are used: -/etc/compute-tools/container: +/etc/compute-tools/container.conf, /etc/compute-tools/container.conf.d/\*.conf: Container configuration files. /usr/bin/container, /usr/bin/cnt: -- cgit v1.2.3