chiark / gitweb /
contrib: Do proper substitutions on contrib files.
authorMark Wooding <mdw@distorted.org.uk>
Fri, 16 Mar 2012 00:15:38 +0000 (00:15 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 16 Mar 2012 00:19:07 +0000 (00:19 +0000)
contrib/Makefile.am
contrib/ipif-peers.in [moved from contrib/ipif-peers with 95% similarity]
contrib/tripe-ipif.in [moved from contrib/tripe-ipif with 97% similarity]

index fe5b472..5d71313 100644 (file)
 
 include $(top_srcdir)/vars.am
 
-dist_noinst_DATA        =
+noinst_DATA             =
 
 ###--------------------------------------------------------------------------
 ### Contributions.
 
 ## Glue for `userv-ipif'.
-dist_noinst_DATA       += tripe-ipif ipif-peers
+noinst_DATA            += tripe-ipif ipif-peers
+EXTRA_DIST             += tripe-ipif.in ipif-peers.in
+CLEANFILES             += tripe-ipif ipif-peers
+
+tripe-ipif: tripe-ipif.in Makefile
+       $(SUBST) $(srcdir)/tripe-ipif.in >$@.new $(SUBSTITUTIONS) && \
+               mv $@.new $@
+
+ipif-peers: ipif-peers.in Makefile
+       $(SUBST) $(srcdir)/ipif-peers.in >$@.new $(SUBSTITUTIONS) && \
+               mv $@.new $@
 
 ###----- That's all, folks --------------------------------------------------
similarity index 95%
rename from contrib/ipif-peers
rename to contrib/ipif-peers.in
index c976238..3b95a48 100755 (executable)
 
 set -e
 quis=${0##*/}
-case ${TRIPEDIR+t} in
-  t) ;;
-  *) echo >&2 "$quis: \`TRIPEDIR' unset"; exit 1 ;;
-esac
+: ${TRIPEDIR=@configdir@}
 
 ## Trundle through the table.
 while read name remote_ext local_int remote_int routes; do
similarity index 97%
rename from contrib/tripe-ipif
rename to contrib/tripe-ipif.in
index 689957c..5a620fa 100755 (executable)
@@ -59,6 +59,9 @@
 
 set -e
 quis=${0##*/}
+: ${TRIPEDIR=@configdir@}
+: ${logfile=@logfile@}
+: ${TRIPE_IPIF_LOG=${logfile%/*}/tripe-ipif.log}
 
 ## Parse the command line.
 case $# in 1) ;; *) echo >&2 "Usage: $quis PEER"; exit 1 ;; esac
@@ -69,7 +72,7 @@ esac
 peer=$1
 
 ## Arrange for errors to go somewhere.
-case "${TRIPE_IPIF_LOG+t}" in t) exec 2>>"$TRIPE_IPIF_LOG" ;; esac
+exec 2>>"$TRIPE_IPIF_LOG"
 now=$(date +"%Y-%m-%d %H:%M:%S")
 echo >&2 "$now $quis[$$] running for peer \`$peer'"