~libravatar/libravatar/master

« back to all changes in this revision

Viewing changes to debian/libravatar-www.postinst

  • Committer: Francois Marier
  • Date: 2012-03-06 07:41:38 UTC
  • Revision ID: git-v1:a96ff37497638137350770b43b788708003e79ca
awstats: add a config file for www (bug #904468)

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
EXPORT_FILES_ROOT=/var/lib/libravatar/export
36
36
APACHE_CONFIG=/etc/libravatar/www.apache2.conf
37
37
RULES_ABE=/usr/share/libravatar/libravatar/rules.abe
 
38
AWSTATS_CONFIG=/etc/libravatar/awstats.www.conf
 
39
AWSTATS_DIR=/var/lib/awstats/www
 
40
 
38
41
 
39
42
case "$1" in
40
43
    configure)
124
127
 
125
128
        mv ${RULES_ABE}.working ${RULES_ABE}
126
129
 
127
 
        # Make a copy of the template apache config to work on, then copy into place
 
130
        # Make a copy of the templates to work on, then copy into place
128
131
        cp ${APACHE_CONFIG} ${APACHE_CONFIG}.working
 
132
        cp ${AWSTATS_CONFIG} ${AWSTATS_CONFIG}.working
129
133
 
130
134
        for MARKER in $(grep -o -E '__[A-Z0-9_]+__' ${APACHE_CONFIG}.working); do
131
135
            # Turns __MARKER__ into marker and puts packagename/ on the front
133
137
            db_get libravatar-common/$DEBCONF_VAR
134
138
            sed -i -e "s/${MARKER}/${RET}/g" ${APACHE_CONFIG}.working
135
139
        done
 
140
        for MARKER in $(grep -o -E '__[A-Z0-9_]+__' ${AWSTATS_CONFIG}.working); do
 
141
            # Turns __MARKER__ into marker and puts packagename/ on the front
 
142
            DEBCONF_VAR=$(echo "${MARKER:2:${#MARKER}-4}" | tr '[:upper:]' '[:lower:]')
 
143
            db_get libravatar-common/$DEBCONF_VAR
 
144
            sed -i -e "s/${MARKER}/${RET}/g" ${AWSTATS_CONFIG}.working
 
145
        done
136
146
 
137
147
        # Enable apache modules we want unconditionally
138
148
        a2enmod alias > /dev/null 2>&1
158
168
        echo "Libravatar is now ready for action. You need to restart apache for any"
159
169
        echo "configuration changes to take effect"
160
170
        echo ""
 
171
 
 
172
        mkdir -p /etc/awstats
 
173
        mv ${AWSTATS_CONFIG}.working /etc/awstats/awstats.www.conf
 
174
 
 
175
        mkdir -p ${AWSTATS_DIR}
 
176
        chown www-data:www-data ${AWSTATS_DIR}
161
177
    ;;
162
178
 
163
179
    abort-upgrade|abort-remove|abort-deconfigure)