commands/vconf2dir
changeset 0 6f7a81934006
equal deleted inserted replaced
-1:000000000000 0:6f7a81934006
       
     1 #!/bin/sh
       
     2 set -e
       
     3 if [ $# -ne 2 ]; then
       
     4   echo Usage: vconf2dir configuration-file configuration-dir
       
     5   exit 1
       
     6 fi
       
     7 
       
     8 sed -e '/^#/d' -e '/^ *$/d' -e '/=/!d' -e 's/ *= */ /' <"$1" | \
       
     9 {
       
    10   if ! cd "$2"; then
       
    11     echo vconf2dir: "$2" is not a directory.
       
    12     exit 1
       
    13   fi
       
    14   while read n v; do
       
    15     echo "$v" > $n
       
    16   done
       
    17 }
       
    18 
       
    19 cd "$2"
       
    20 # Post-process postmaster-aliases
       
    21 if [ -f postmaster-aliases ]; then
       
    22   pa=`cat postmaster-aliases`
       
    23   echo -n >postmaster-aliases
       
    24   i=1
       
    25   v=`echo $pa | cut -d, -f$i`
       
    26   while [ -n "$v" ]; do
       
    27     echo $v >>postmaster-aliases
       
    28     i=`expr $i + 1`
       
    29     v=`echo $pa | cut -d, -f$i`
       
    30   done
       
    31 fi