From 7100e42128e4272ec7604cad4554866943556214 Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Fri, 18 Sep 2015 18:52:00 +0000 Subject: Allow copying the local configuration from a defined directory, instead of system /etc. New configuration variable: CONFDIR Closes: #580086 --- pbuilder-modules | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'pbuilder-modules') diff --git a/pbuilder-modules b/pbuilder-modules index e5ec024..cd61f89 100644 --- a/pbuilder-modules +++ b/pbuilder-modules @@ -451,13 +451,19 @@ EOF function copy_local_configuration () { log "I: copying local configuration" + if [ -n "$CONFDIR" ] && [ -d "$CONFDIR" ]; then + log "I: copying files from $CONFDIR (if possible) instead of using the system ones" + fi for a in hosts hostname resolv.conf mailname; do - if [ -f "/etc/$a" ]; then - rm -f "$BUILDPLACE/etc/$a" - cp "$( readlink -f "/etc/$a" )" "$BUILDPLACE/etc/$a"; - else - log "W: No local /etc/$a to copy, relying on $BUILDPLACE/etc/$a to be correct" - fi + if [ -n "$CONFDIR" ] && [ -f "$CONFDIR/$a" ]; then + rm -f "$BUILDPLACE/etc/$a" + cp "$( readlink -f "$CONFDIR/$a" )" "$BUILDPLACE/etc/$a" + elif [ -f "/etc/$a" ]; then + rm -f "$BUILDPLACE/etc/$a" + cp "$( readlink -f "/etc/$a" )" "$BUILDPLACE/etc/$a" + else + log "W: No local /etc/$a to copy, relying on $BUILDPLACE/etc/$a to be correct" + fi done } -- cgit v1.2.3