update-all-config: new utility to update projects' config
[girocco.git] / make-apache-conf.sh
blobd8a3da15af16ebb9d346ed3bf91531407ad108ab
1 #!/bin/sh
3 # This script uses the current values of Girocco::Config to
4 # convert apache.conf.in into apache.conf.
6 # It is run automatically by "make" or "make apache.conf" but
7 # may be run separately if desired.
9 set -e
11 . ./shlib.sh
13 config_options='admin basedir certsdir cgiroot httpdnsname reporoot webroot'
15 cmd="sed < apache.conf.in > apache.conf.1.$$ -e '/^##/d'"
16 for option in $config_options; do
17 cmd="$cmd -e \"s#@@$option@@#\$cfg_$option#g\""
18 done
19 eval "$cmd"
20 sed < apache.conf.1.$$ > apache.conf.2.$$ \
21 -ne '1,/^# ---- BEGIN DUPLICATE LINES ----/p'
22 sed < apache.conf.1.$$ \
23 -ne '/^# ---- BEGIN LINES TO DUPLICATE ----/,/# ---- END LINES TO DUPLICATE ----/p' | \
24 sed >> apache.conf.2.$$ \
25 -e '1d' -e '$d'
26 sed < apache.conf.1.$$ >> apache.conf.2.$$ \
27 -ne '/^# ---- END DUPLICATE LINES ----/,$p'
28 rm -f apache.conf.1.$$
29 mv -f apache.conf.2.$$ apache.conf