tags #296597 patch
thanks

On Fri, Feb 25, 2005 at 10:11:38AM +0100, Marc Haber wrote:
> On Wed, Feb 23, 2005 at 09:17:59AM -0500, Marc Sherman wrote:
> > A -o option would be useful on update-exim4.conf.template, to generate a
> > sample "one big config" from the installed conf.d files when
> > dc_use_split_config='false'.
> 
> Nice idea. Do you have a patch? Otherwise, the relevant could should
> be rippable from ue4.conf easily.

Can I have your comments about the patch attached?

Greetings
Marc

-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany  |  lose things."    Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature |  How to make an American Quilt | Fax: *49 621 72739835
Index: debian/debconf/update-exim4.conf.template
===================================================================
--- debian/debconf/update-exim4.conf.template   (revision 898)
+++ debian/debconf/update-exim4.conf.template   (working copy)
@@ -5,11 +5,15 @@
 CONFDIR="${CONFDIR:-/etc/exim4}"
 DONOTRUN='true'
 
+UPEX4CT_templatefile=/etc/exim4/exim4.conf.template
+UPEX4CT_outputfile="${UPEX4C_templatefile}"
+
 usage() {
 cat <<EOF
 $0 - Generate exim4 configuration file template
        Options:
        -n|--nobackup - Overwrite old template, do not take backup.
+       -o|--output file - write output to file instead of ${UPEX4CT_outputfile}
        -h|--help - This message.
        -r|--run - Actually do something
 EOF
@@ -17,8 +21,8 @@
 
 ## Parse commandline
 TEMP=$(getopt -n update-exim4.conf.template \
-       -l nobackup,help,run -- \
-       +nhr "$@")
+       -l nobackup,output:,help,run -- \
+       +nohr "$@")
 
 if test "$?" != 0; then
        echo "Terminating..." >&2
@@ -32,6 +36,10 @@
                        usage
                        exit 0
                ;;
+               -o|--output)
+                       shift
+                       UPEX4CT_outputfile="$1"
+               ;;
                -n|--nobackup)
                        NOBACKUP=1
                ;;
@@ -105,16 +113,16 @@
 fi
 
 
-if [ -e "${CONFDIR}/exim4.conf.template" ] && [ -z "$NOBACKUP" ]; then
-  if [ -e "${CONFDIR}/exim4.conf.template.bak.$$" ]; then
-    echo >&2 "ERR: ${CONFDIR}/exim4.conf.template.bak.$$ already exists, 
aborting"
+if [ -e "${UPEX4CT_outputfile}" ] && [ -z "$NOBACKUP" ]; then
+  if [ -e "${UPEX4CT_outputfile}.bak.$$" ]; then
+    echo >&2 "ERR: ${UPEX4CT_outputfile}.bak.$$ already exists, aborting"
     exit 1
   fi
 fi
  
 NEWTEMPLATE=`tempfile -m644 -p ex4`
-if [ -f "${CONFDIR}/exim4.conf.template" ] ; then
-       chmod --reference="${CONFDIR}/exim4.conf.template" "$NEWTEMPLATE"
+if [ -f "${UPEX4CT_outputfile" ] ; then
+       chmod --reference="${UPEX4CT_outputfile}" "$NEWTEMPLATE"
 fi
 
 # generate .template. Ugly - better alternative?
@@ -123,8 +131,8 @@
   cat_parts $i
 done > "$NEWTEMPLATE"
 
-if [ -e "${CONFDIR}/exim4.conf.template" ] && [ -z "$NOBACKUP" ] ; then
-       mv "${CONFDIR}/exim4.conf.template" \
-               "${CONFDIR}/exim4.conf.template.bak.$$"
+if [ -e "${UPEX4CT_outputfile}" ] && [ -z "$NOBACKUP" ] ; then
+       mv "${UPEX4CT_outputfile}" \
+               "${UPEX4CT_outputfile}.bak.$$"
 fi
-mv "$NEWTEMPLATE" "${CONFDIR}/exim4.conf.template"
+mv "$NEWTEMPLATE" "${UPEX4CT_outputfile}"

Reply via email to