Rejig our Makefile to better support NetBSD. We now talk to /var/run/resolvconf direc...
authorRoy Marples <roy@marples.name>
Wed, 5 Mar 2008 19:37:26 +0000 (19:37 +0000)
committerRoy Marples <roy@marples.name>
Wed, 5 Mar 2008 19:37:26 +0000 (19:37 +0000)
Makefile
dnsmasq.in
libc.in
resolvconf.8.in
resolvconf.in

index a106f12336f9de2f66b732be50a9b44e871526fc..27f682a8710c560b5c33a8ff40e1d489fba5fef6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,51 +1,50 @@
-NAME = openresolv
-VERSION = 1.3
-PKG = $(NAME)-$(VERSION)
+NAME=          openresolv
+VERSION=       1.3
+PKG=           ${NAME}-${VERSION}
 
-INSTALL ?= install
-MANPREFIX ?= /usr/share
+INSTALL?=      install
+MANPREFIX?=    /usr/share
+VARBASE?=      /var
 
-ROOT = $(DESTDIR)$(PREFIX)
-ETCDIR = $(ROOT)/etc/resolvconf
-MANDIR = $(DESTDIR)$(MANPREFIX)/man/man8
-BINDIR = $(ROOT)/sbin
-VARDIR = $(DESTDIR)/var/run
-UPDATEDIR = $(ETCDIR)/update.d
+BINMODE?=      0755
+MANMODE?=      0444
 
-RESOLVCONF = resolvconf resolvconf.8
-SUBSCRIBERS = libc dnsmasq named
-TARGET = $(RESOLVCONF) $(SUBSCRIBERS)
+SYSCONFDIR?=   ${PREFIX}/etc/resolvconf
+BINDIR=                /sbin
+MANDIR?=       ${MANPREFIX}/man
+
+RESOLVCONF=    resolvconf resolvconf.8
+SUBSCRIBERS=   libc dnsmasq named
+TARGET=                ${RESOLVCONF} ${SUBSCRIBERS}
 
 .SUFFIXES: .in
 
-all: $(TARGET)
+all: ${TARGET}
 
 .in:
-       sed -e s':^PREFIX=.*:PREFIX="$(PREFIX)":' $@.in > $@
-
-resolvconf.8: resolvconf.8.in
-       sed -e 's:@PREFIX@:$(PREFIX):g' $@.in > $@
+       sed -e 's:@PREFIX@:${PREFIX}:g' \
+               -e 's:@SYSCONFDIR@:${SYSCONFDIR}:g' \
+               -e 's:@VARBASE@:${VARBASE}:g' \
+               $@.in > $@
 
 clean:
-       rm -f $(TARGET) openresolv-$(VERSION).tar.bz2
-
-install: $(TARGET)
-       $(INSTALL) -d $(BINDIR)
-       $(INSTALL) -d $(VARDIR)/resolvconf
-       $(INSTALL) resolvconf $(BINDIR)
-       $(INSTALL) -d $(MANDIR)
-       $(INSTALL) -d $(ETCDIR)/resolv.conf.d
-       $(INSTALL) -d $(ETCDIR)/update-libc.d
-       $(INSTALL) -d $(UPDATEDIR)
-       $(INSTALL) $(SUBSCRIBERS) $(UPDATEDIR)
-       $(INSTALL) -m 0644 resolvconf.8 $(MANDIR)
-       ln -snf /var/run/resolvconf $(ETCDIR)/run
+       rm -f ${TARGET} openresolv-${VERSION}.tar.bz2
+
+install: ${TARGET}
+       ${INSTALL} -d ${DESTDIR}${PREFIX}${BINDIR}
+       ${INSTALL} -m ${BINMODE} resolvconf ${DESTDIR}${PREFIX}${BINDIR}
+       ${INSTALL} -d ${DESTDIR}${SYSCONFDIR}/resolv.conf.d
+       ${INSTALL} -d ${DESTDIR}${SYSCONFDIR}/update-libc.d
+       ${INSTALL} -d ${DESTDIR}${SYSCONFDIR}/update.d
+       ${INSTALL} -m ${BINMODE} ${SUBSCRIBERS} ${DESTDIR}${SYSCONFDIR}/update.d
+       ${INSTALL} -d ${DESTDIR}${MANDIR}/man8
+       ${INSTALL} -m ${MANMODE} resolvconf.8 ${DESTDIR}${MANDIR}/man8
 
 dist:
-       $(INSTALL) -d /tmp/$(PKG)
-       cp -RPp . /tmp/$(PKG)
-       (cd /tmp/$(PKG); $(MAKE) clean)
-       rm -rf /tmp/$(PKG)/*.bz2 /tmp/$(PKG)/.git /tmp/$(PKG)/.gitignore
-       tar cvjpf $(PKG).tar.bz2 -C /tmp $(PKG) 
-       rm -rf /tmp/$(PKG) 
-       ls -l $(PKG).tar.bz2
+       ${INSTALL} -d /tmp/${PKG}
+       cp -RPp . /tmp/${PKG}
+       (cd /tmp/${PKG}; ${MAKE} clean)
+       rm -rf /tmp/${PKG}/*.bz2 /tmp/${PKG}/.git /tmp/${PKG}/.gitignore
+       tar cvjpf ${PKG}.tar.bz2 -C /tmp ${PKG} 
+       rm -rf /tmp/${PKG} 
+       ls -l ${PKG}.tar.bz2
index 2de1f3b7af983ba711c2b510ec032494e644a934..2bf6e45f8416b7073798c20103c4789c94909a57 100755 (executable)
@@ -40,8 +40,8 @@
 # NOTE: The loopback interface on some systems maybe lo0.
 #domain-needed
 #interface=lo
-#resolv-file=/etc/dnsmasq-resolv.conf
-#conf-file=/etc/dnsmasq-resolvconf.conf
+#resolv-file=@PREFIX@/etc/dnsmasq-resolv.conf
+#conf-file=@PREFIX@/etc/dnsmasq-resolvconf.conf
 
 # The last step is to configure dns configuration for /etc/resolv.conf
 # for the lo interface. You can do this in resolvconf as well by adding
@@ -52,7 +52,7 @@
 VARS="$(resolvconf -v)"
 eval "${VARS}"
 
-PREFIX=
+PREFIX=@PREFIX@
 DNSMASQRESOLV="${PREFIX}/etc/dnsmasq-resolv.conf"
 DNSMASQCONF="${PREFIX}/etc/dnsmasq-resolvconf.conf"
 
diff --git a/libc.in b/libc.in
index b608bf3eb607848bbd57ec5588fab1b2892a1e8b..b7a1abdb9f5b3f0b06bd878e7e55814614a1dbf1 100755 (executable)
--- a/libc.in
+++ b/libc.in
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 RESOLVCONF=/etc/resolv.conf
-PREFIX=
+PREFIX=@PREFIX@
+SYSCONFDIR=@SYSCONFDIR@
 RESOLVCONFS="$(resolvconf -l)"
-CONFDIR="${PREFIX}"/etc/resolvconf
-BASE="${CONFDIR}/resolv.conf.d/base"
+BASE="${SYSCONFDIR}/resolv.conf.d/base"
 
 uniqify() {
     local result=
@@ -109,8 +109,8 @@ done
 
 # Hold our new resolv.conf in a variable to save on temporary files
 NEWCONF="# Generated by resolvconf\n"
-[ -e "${CONFDIR}"/resolv.conf.d/head ] \
-       && NEWCONF="${NEWCONF}$(cat "${CONFDIR}"/resolv.conf.d/head)\n"
+[ -e "${SYSCONFDIR}"/resolv.conf.d/head ] \
+       && NEWCONF="${NEWCONF}$(cat "${SYSCONFDIR}"/resolv.conf.d/head)\n"
 [ -n "${SEARCH}" ] && NEWCONF="${NEWCONF}${SEARCH}\n"
 for N in ${NS}; do
        NEWCONF="${NEWCONF}nameserver ${N}\n"
@@ -132,8 +132,8 @@ NEWCONF="${NEWCONF}$(echo "${RESOLVCONFS}" | sed -e '/^[[:space:]]*$/d' \
        -e '/^[[:space:]]*search[[:space:]]*.*/d' \
        -e '/^[[:space:]]*domain[[:space:]]*.*/d' \
        )"
-[ -e "${CONFDIR}"/resolv.conf.d/tail ] \
-       && NEWCONF="${NEWCONF}$(cat "${CONFDIR}"/resolv.conf.d/tail)"
+[ -e "${SYSCONFDIR}"/resolv.conf.d/tail ] \
+       && NEWCONF="${NEWCONF}$(cat "${SYSCONFDIR}"/resolv.conf.d/tail)"
 
 # Check if the file has actually changed or not
 if [ -e "${RESOLVCONF}" ]; then
@@ -147,7 +147,7 @@ resolvconf -s nscd restart
 retval=$?
 
 # Notify users of the resolver
-for x in "${CONFDIR}"/update-libc.d/*; do
+for x in "${SYSCONFDIR}"/update-libc.d/*; do
        if [ -e "${x}" ]; then
                "${x}" "$@"
                retval=$((${retval} + $?))
index 3e2d1f571d33c855f4c9ea5493eb7b7fa9c2bb89..575d72dcc26122ba98d624156a82594e1a94fe2c 100644 (file)
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd Feb 11, 2008
+.Dd Mar 05, 2008
 .Dt RESOLVCONF 8 SMM
 .Sh NAME
 .Nm resolvconf
@@ -144,35 +144,33 @@ the resolver easily.
 .El
 .Sh FILES
 .Bl -ohang
-.It Pa @PREFIX@/etc/resolvconf/run
+.It Pa @VARBASE@/run/resolvconf
 Directory that holds the data for
 .Nm .
-Normally a symlink to
-.Pa /var/run/resolvconf .
 You could symlink
 .Pa /etc/resolv.conf
 to
-.Pa resolvconf/run/resolv.conf
+.Pa @VARBASE@/run/resolvconf/resolv.conf
 to support a read only
 .Pa /etc .
-.It Pa @PREFIX@/etc/resolvconf/update.d
+.It Pa @SYSCONFDIR@/update.d
 Directory of the helper scripts which are run every time
 .Nm
 adds, deletes or updates.
-.It Pa @PREFIX@/etc/resolvconf/update-libc.d
+.It Pa @SYSCONFDIR@/update-libc.d
 Directory of helper scripts which are run after the libc helper script is run.
-.It Pa @PREFIX@/etc/resolvconf/interface-order
+.It Pa @SYSCONFDIR@/interface-order
 Determines the order in which nameserver information records are processed
 by resolvconf -l.
-.It Pa @PREFIX@/etc/resolvconf/resolv.conf.d/base
+.It Pa @SYSCONFDIR@/resolv.conf.d/base
 Contains basic resolver information which is included in
 .Pa /etc/resolv.conf
 even when no interfaces are configured.
-.It Pa @PREFIX@/etc/resolvconf/resolv.conf.d/head
+.It Pa @SYSCONFDIR@/resolv.conf.d/head
 File to be prepended to
 .Pa /etc/resolv.conf .
 Normally this is just a comment line.
-.It Pa @PREFIX@/etc/resolvconf/resolv.conf.d/tail
+.It Pa @SYSCONFDIR@/resolv.conf.d/tail
 File to be appended to
 .Pa /etc/resolv.conf .
 .El
@@ -194,7 +192,7 @@ When running a local resolver other than libc, you will need to configure it
 to include files that
 .Nm
 will generate. You should consult the comment section in the helper script
-for your resolver found in @PREFIX@/etc/resolvconf/update.d for instructions
+for your resolver found in @SYSCONFDIR@/update.d for instructions
 on this.
 .Sh SEE ALSO
 .Xr dnsmasq 8 ,
index bb2e53d08b34d416317c069f1a77d46da0b6cc84..dc6f335e2f025da5a08689523fc62edb6ebd41c3 100755 (executable)
 
 ARGV0="$0"
 
-PREFIX=
-RESOLVCONF="${PREFIX}"/etc/resolvconf
-UPDATED="${RESOLVCONF}"/update.d
-VARDIR="${RESOLVCONF}"/run
+SYSCONFDIR=@SYSCONFDIR@
+VARDIR=@VARBASE@/run/resolvconf
 IFACEDIR="${VARDIR}/interfaces"
 
 error_exit() {
@@ -149,8 +147,8 @@ if [ "${CMD}" = "l" -o "${CMD}" = "i" ]; then
        if [ -n "${ARGS}" ]; then
                LIST="${ARGS}"
                ${FORCE} || REPORT=true
-       elif [ -r "${RESOLVCONF}"/interface-order ]; then
-               LIST="$(cat "${RESOLVCONF}"/interface-order)"
+       elif [ -r "${SYSCONFDIR}"/interface-order ]; then
+               LIST="$(cat "${SYSCONFDIR}"/interface-order)"
        fi
 
        # If we don't have a list then prefer lo, tunnels, ppp
@@ -312,7 +310,7 @@ if [ "${CMD}" = "a" ]; then
 fi
 
 RETVAL=0
-for SCRIPT in "${UPDATED}"/*; do
+for SCRIPT in "${SYSCONFDIR}"/update.d/*; do
        if [ -e "${SCRIPT}" ]; then
                "${SCRIPT}" "${CMD}" "${IFACE}"
                RETVAL=$((${RETVAL} + $?))