File: postinst.common

package info (click to toggle)
apache 1.3.34-4.1%2Betch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 4,824 kB
  • ctags: 90
  • sloc: sh: 1,273; makefile: 686; perl: 215
file content (574 lines) | stat: -rw-r--r-- 18,120 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
#!/bin/bash

# Save the default IFS for later use
old_IFS="$IFS"
# And define the sketchy one we occasionally use
new_IFS=`printf '\x07'`

### perl functions

# perl get - $1 configfile $2 what
pget() {
 perl -e " OUTER: while (<>) {next OUTER if /^\s*#/;next OUTER if /^$/;if ( (/<virtualhost/i &&  ! /#.*<virtualhost/i)
 || /<virtualhost.*#.*<virtualhost/i ){ INNER: while (<>) { next INNER until /<\/virtualhost/i }};print if /^\s*$2/i}" < $1
}

# perl set - $1 configfile $2 what $3 to-what
pset() {
 cat $1 | \
 perl -e " OUTER: while (<>) { if ( (/<virtualhost/i &&  ! /#.*<virtualhost/i)
 || /<virtualhost.*#.*<virtualhost/i ){ print; INNER: while (<>)
 { print; next INNER until /<\/virtualhost/i }};
 if ( ! /^\s*#/ ) {s,^\s*$2.*,$2 $3,i;} print}" \
 > $1.$$
 mv -f $1.$$ $1
}

suggested_corrections() {
    # this will create a list of corrections that should be
    # done to be Debian standard in /etc/$pkg/suggested_corrections
    # but not a complete new configfile. it gets to complex in some
    # situations
    if [ "$#" -ne 1 ]; then
    	echo "Wrong number of arguments to suggested_corrections"
	return
    fi
    pkg="$1"

    corfile=/etc/$pkg/suggested_corrections

    rm -f $corfile

    export IFS="$new_IFS"
    CONFS=`/usr/share/apache/listconffiles -V /etc/$pkg/httpd.conf`

    for i in $CONFS; do
	export IFS="$old_IFS"
	# Alias /icons/
	icons=`pget $i "Alias \/icons\/" | tail -n 1 | awk '{print $NF}'`
	if [ "$icons" ]; then
	    if [ "$icons" != "/usr/share/apache/icons/" ]; then
		echo "$pkg $i config file declares a non standard:" >> $corfile
		echo "Alias /icons/ $icons" >> $corfile
		echo "and it should be changed to:" >> $corfile
		echo "Alias /icons/ /usr/share/apache/icons/" >> $corfile
		echo "----" >> $corfile
	    fi
	fi

	# ScriptAlias
	scripts=`pget $i "ScriptAlias \/cgi-bin\/" | tail -n 1 | awk '{print $NF}'`
	if [ "$scripts" ]; then
	    if [ "$scripts" != "/usr/lib/cgi-bin/" ]; then
		echo "$pkg $i config file declares a non standard:" >> $corfile
		echo "ScriptAlias /cgi-bin/ $scripts" >> $corfile
		echo "and it should be changed to:" >> $corfile
		echo "ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/" >> $corfile
		echo "NOTE: remember to verify the corresponding" >> $corfile
		echo "      <Directory $scripts> entry" >> $corfile
		echo "      matches the ScriptAlias definition" >> $corfile
		echo "----" >> $corfile
	    fi
	fi

	# Alias /doc
	docs=`pget $i "Alias \/doc\/" | tail -n 1 | awk '{print $NF}'`
	if [ "$docs" ]; then
	    if [ "$docs" != "/usr/share/doc/" ]; then
		echo "$pkg $i config file declares a non standard:" >> $corfile
		echo "Alias /doc/ $docs" >> $corfile
		echo "and it should be changed to:" >> $corfile
		echo "Alias /doc/ /usr/share/doc/" >> $corfile
		echo "----" >> $corfile
	    fi
	fi

	mime=`pget $i "MIMEMagicFile" | tail -n 1 | awk '{print $NF}'`
	if [ "$mime" ]; then
	    if [ "$mime" != "/usr/share/file/magic.mime" ]; then
	        echo "$pkg $i config file declares a non standard:" >> $corfile
		echo "MIMEMagicFile $mime" >> $corfile
		echo "and it should be changed to:" >> $corfile
		echo "MIMEMagicFile /usr/share/file/magic.mime" >> $corfile
		echo "----" >> $corfile
	    fi
	fi

	if [ "$pkg" = "apache-ssl" ]; then
	    # SSLCacheServerPort /var/run/gcache_port
	    cacheport=`pget $i "SSLCacheServerPort \/var\/run\/gcache_port" | tail -n 1 | awk '{print $NF}'`
	    if [ "$cacheport" ]; then
	        if [ "$cacheport" != "/var/run/gcache_port" ]; then
	    	    echo "$pkg $i config file declares a non standard:" >> $corfile
		    echo "SSLCacheServerPort $cacheport"  >> $corfile
		    echo "and it should be changed to:" >> $corfile
		    echo "SSLCacheServerPort /var/run/gcache_port" >> $corfile
		    echo "----" >> $corfile
	        fi
	    fi
	fi
        export IFS="$new_IFS"
    done
    export IFS="$old_IFS"
}

defaultindex() {
    if [ "$#" -ne 1 ]; then
    	echo "Wrong number of arguments to defaultindex"
	return
    fi
    pkg="$1"
    if [ ! -h /var/www ] && [ ! -d /var/www ] && [ ! -e /var/www ]; then
    	mkdir -p /var/www
	chown root:root /var/www
	chmod 755 /var/www
	cp -f /usr/share/apache/default-configs/$pkg/intro.html /var/www/index.html
	chown www-data:www-data /var/www/index.html
	chmod 644 /var/www/index.html
    fi
}

fix_pid() {
    if [ "$#" -ne 1 ]; then
    	echo "Wrong number of arguments to fix_pid"
	return
    fi
    pkg="$1"
    if [ ! "`grep "PidFile /var/run/$pkg.pid" /etc/$pkg/httpd.conf.dpkg-inst.queue.dpkg-inst.queue`" ] ; then
	cat /etc/$pkg/httpd.conf.dpkg-inst.queue.dpkg-inst.queue |  perl -pe \
	"s,^PidFile.*,PidFile /var/run/$pkg.pid,;" > /etc/$pkg/httpd.conf.dpkg-inst.queue.dpkg-inst.queue.$$
	mv -f /etc/$pkg/httpd.conf.dpkg-inst.queue.dpkg-inst.queue.$$ /etc/$pkg/httpd.conf.dpkg-inst.queue.dpkg-inst.queue
    fi
}

check_start() {
    if [ "$#" -ne 1 ]; then
        echo "Wrong number of arguments to check_start"
	return
    fi
    pkg="$1"
    db_get $pkg/init || true
    start_at_boot=$RET
    if [ -e /etc/default/$pkg ]; then
	rm -f /etc/default/$pkg
    fi
    if [ -e /etc/$pkg/apache_not_to_be_run ]; then
    	rm -f /etc/$pkg/apache_not_to_be_run
    fi
}

do_debconf_configs() {
    if [ "$#" -ne 1 ]; then
    	echo "Wrong number of arguments to do_debconf_configs"
	return
    fi
    pkg="$1"

    # introducing *RB for rollingback without reading again the config files
    export IFS="$new_IFS"

    for i in $CONFS; do
        export IFS="$old_IFS"
        i="$i.dpkg-inst.queue"
	if [ ! "$SERNAME" ]; then
	    SERNAME=`pget $i servername | tail -n 1 | awk '{print $2}'`
	    SERNAMERB=$SERNAME
	fi
	if [ ! "$SERADMIN" ]; then
	    SERADMIN=`pget $i serveradmin | tail -n 1 | awk '{print $2}'`
	    SERADMINRB=$SERADMIN
	fi
	if [ ! "$DOCROOT" ]; then
	    DOCROOT=`pget $i documentroot | tail -n 1 | awk '{print $2}'`
	    DOCROOTRB=$DOCROOT
	fi
	if [ "$pkg" != "apache-ssl" ]; then
	    if [ ! "$PORT" ]; then
	    	PORT=`pget $i port | tail -n 1 | awk '{print $2}'`
		PORTRB=$PORT
	    fi
	fi
        export IFS="$new_IFS"
    done
    export IFS="$old_IFS"
 
    if [ ! "$SERNAME" ]; then
        db_set $pkg/server-name localhost
    else
        db_set $pkg/server-name $SERNAME
    fi
    db_set $pkg/server-admin $SERADMIN
    db_set $pkg/document-root $DOCROOT
    if [ "$pkg" != "apache-ssl" ]; then
        db_set $pkg/server-port $PORT
    fi

    db_input low $pkg/server-name || true
    db_input low $pkg/server-admin || true
    db_input low $pkg/document-root || true
    if [ "$pkg" != "apache-ssl" ]; then
        db_input low $pkg/server-port || true
    fi

    db_go || true
 
    db_get $pkg/server-name || true
    SERNAME=$RET
    if [ "x$SERNAME" = "x" ]; then
        if [ "x$SERNAMERB" = "x" ]; then
	    SERNAME=localhost
	else
            SERNAME=$SERNAMERB
	fi
    fi
    db_get $pkg/server-admin || true
    SERADMIN=`echo $RET | sed -e 's/\./\\\./g' -e 's/\@/\\\@/g'`
    if [ "x$SERADMIN" = "x" ]; then
        SERADMIN=`echo $SERADMINRB | sed -e 's/\./\\\./g' -e 's/\@/\\\@/g'`
    fi
    db_get $pkg/document-root || true
    DOCROOT=$RET
    if [ "x$DOCROOT" = "x" ]; then
        DOCROOT=$DOCROOTRB
    fi
    if [ "$pkg" != "apache-ssl" ]; then
    	db_get $pkg/server-port || true
    	PORT=$RET
	if [ "x$PORT" = "x" ]; then
	    PORT=$PORTRB
	fi
    else
	PORT=443
    fi

    #we need a bit of blackmagic for ServerName
    doblackmagic=true

    export IFS="$new_IFS"	
    for i in $CONFS; do
	export IFS="$old_IFS"
	# this is gonna look terrible but it's the only way to make it as much dynamic
	# as possible.. eh what we have to do to make out users happy

	i="$i.dpkg-inst.queue"

	#servername
	temp=`pget $i servername | tail -n 1 | awk '{print $2}'`
	if [ "$temp" ]; then
	    pset $i ServerName $SERNAME
	    doblackmagic=false
	fi

	#serveradmin
	temp=`pget $i serveradmin | tail -n 1 | awk '{print $2}'`
	if [ "$temp" ]; then
	    pset $i ServerAdmin $SERADMIN
	fi

	#docroot
	temp=`pget $i documentroot | tail -n 1 | awk '{print $2}'`
	if [ "$temp" ]; then
	    pset $i DocumentRoot $DOCROOT
	fi
	#port
	temp=`pget $i port | tail -n 1 | awk '{print $2}'`
	if [ "$temp" ]; then
	    pset $i Port $PORT
	fi
	export IFS="$new_IFS"
    done
    export IFS="$old_IFS"

    if [ "$doblackmagic" = "true" ]; then
	# this means that there is no ServerName specified for the default server
	# and we can safely add it in httpd.conf and we use the last comment as
	# reference
	cat /etc/$pkg/httpd.conf.dpkg-inst.queue.dpkg-inst.queue | perl -pe "s,# anyway\, and this will make redirections work in a sensible way.,# anyway\, and this will make redirections work in a sensible way.\nServerName $SERNAME," > /etc/$pkg/httpd.conf.dpkg-inst.queue.dpkg-inst.queue.$$
	mv -f /etc/$pkg/httpd.conf.dpkg-inst.queue.dpkg-inst.queue.$$ /etc/$pkg/httpd.conf.dpkg-inst.queue.dpkg-inst.queue
    fi
}

link_suexec() {
    if [ "$#" -ne 1 ]; then
        echo "Wrong number of arguments to link_suexec"
        return
    fi
    pkg="$1"
    
    db_get $pkg/enable-suexec || true
    cd /usr/lib/$pkg
    if [ "$RET" = "true" ] || [ "$UPGRADEFROMWOODY" = "true" ]; then
        ln -sf suexec.disabled suexec
    else
        if [ -L suexec -a "$(readlink suexec)" = "suexec.disabled" ]; then
            rm -f suexec
        fi
        # else, the admin has made either a file or a symlink himself,
        # so that should be preserved
    fi
}

add_group_if_missing() {
    if [ -x /usr/sbin/adduser ]; then
        if ! id -g www-data >/dev/null 2>&1; then
                addgroup --gid 33 --force-badname www-data
        fi
    fi
}

add_user_if_missing() {
    if [ -x /usr/sbin/adduser ]; then
        if ! id -u www-data > /dev/null 2>&1; then
            adduser --system --home /var/www --no-create-home \
                --uid 33 --gid 33 --disabled-password --force-badname \
                www-data
        fi
    fi
}

add_magic_loadmodule_line() {
    if [ "$#" -ne 1 ]; then
        echo "Wrong number of arguments to add_magic_loadmodule_line"
        return
    fi
    pkg="$1"
    if [ -f /etc/$pkg/httpd.conf.dpkg-inst.queue.dpkg-inst.queue ] \
        && ! grep -q LoadModule: /etc/$pkg/httpd.conf.dpkg-inst.queue.dpkg-inst.queue \
        && ! grep -q ClearModuleList: /etc/$pkg/httpd.conf.dpkg-inst.queue.dpkg-inst.queue
        then
#    echo -n "Adding magic LoadModule line to httpd.conf ... "
        cat > /etc/$pkg/httpd.conf.dpkg-inst.queue.dpkg-inst.queue.$$ <<EOF

# Please keep this LoadModule: line here, it is needed for installation.


EOF
        cat /etc/$pkg/httpd.conf.dpkg-inst.queue.dpkg-inst.queue >> /etc/$pkg/httpd.conf.dpkg-inst.queue.dpkg-inst.queue.$$
        mv -f /etc/$pkg/httpd.conf.dpkg-inst.queue.dpkg-inst.queue.$$ /etc/$pkg/httpd.conf.dpkg-inst.queue.dpkg-inst.queue
#    echo "done."
    fi
}

comment_out_adddefaultcharset() {
# If the 1.3.9 Debian Package's srm.conf is still around, comment out
# this directive or the newly-installed web server (currently 1.3.14)
# won't start.
    if [ "$#" -ne 1 ]; then
        echo "Wrong number of arguments to comment_out_add_default_charset"
        return
    fi
    pkg="$1"
    
    if [ -f /etc/$pkg/srm.conf.dpkg-inst.queue ]; then
        if grep -q "^[ 	]*AddDefaultCharsetName" /etc/$pkg/srm.conf.dpkg-inst.queue; then
            sed '/[^	]*AddDefaultCharsetName/s/^/# Obsolete # /' < /etc/$pkg/srm.conf.dpkg-inst.queue > /etc/$pkg/srm.conf.dpkg-inst.queue.$$ &&
	     mv -f /etc/$pkg/srm.conf.dpkg-inst.queue.$$ /etc/$pkg/srm.conf.dpkg-inst.queue
        fi
    fi
}

link_mime_types() {
    if [ "$#" -ne 1 ]; then
        echo "Wrong number of arguments to link_mime_types"
        return
    fi
    pkg="$1"

    if [ ! -e /etc/$pkg/mime.types ]
        then
        ln -s /etc/mime.types /etc/$pkg/mime.types
    fi
}

add_webmaster_alias() {
# Only add alias on initial installation
    if [ -e /etc/aliases ]; then
        if ! grep -qi "^webmaster:" /etc/aliases; then
            echo "webmaster: root" >> /etc/aliases
	    newal=`which newaliases`
            if [ $newal ] && [ -x $newal ]; then
                newaliases
            fi
        fi
    fi
}

check_logs_outside_var_log() {
    if [ "$#" -ne 1 ]; then
        echo "Wrong number of arguments to check_logs_outside_var_log"
        return
    fi
    pkg="$1"

    if ! `/usr/share/apache/listlogfiles /etc/$pkg/httpd.conf.dpkg-inst.queue.dpkg-inst.queue`; then
	db_subst apache-common/logs flavour $pkg
	db_input high apache-common/logs || true
	db_go
    fi
}

remove_savelog_setup() {
    if [ "$#" -ne 1 ]; then
        echo "Wrong number of arguments to remove_savelog_setup"
        return
    fi
    pkg="$1"
    KNOWN_MD5SUMS="0046dde8f24968114cef88e76c37d339 e8f560b16b76c04ab8c61ee2f53de737 ecbc4d14566e32bdbe16075c752c3cde"

    for file in /etc/cron.daily/$pkg /etc/$pkg/cron.conf; do
        if [ -f "$file" ]; then
            md5sum=$(md5sum "$file" | awk '{print $1}')
            for sum in $KNOWN_MD5SUMS; do
                if [ "$md5sum" = "$sum" ]; then
                    rm -f "$file"
                fi
            done
            if [ -f "$file" ]; then
                db_subst apache-common/old-logrotate-exists flavour $pkg
                db_input high apache-common/old-logrotate-exists || true
                db_go
            fi
        fi
    done

}

add_conf_d() {
    if [ "$#" -ne 1 ]; then
        echo "Wrong number of arguments to add_conf.d"
	return
    fi
    pkg="$1"

    # code has been partially taken from phpmyadmin.postinst
    # note that the grep does not match for ^ since it would
    # override user decision to exclude conf.d from his/her
    # setup

    if ! grep -qs "Include /etc/$pkg/conf.d" /etc/$pkg/httpd.conf.dpkg-inst.queue.dpkg-inst.queue; then
        cp /etc/$pkg/httpd.conf.dpkg-inst.queue.dpkg-inst.queue /etc/$pkg/httpd.conf.dpkg-inst.queue.dpkg-inst.queue.$$
    	echo "" >> /etc/$pkg/httpd.conf.dpkg-inst.queue.dpkg-inst.queue.$$
	echo "# Automatically added by the post-installation script" >> /etc/$pkg/httpd.conf.dpkg-inst.queue.dpkg-inst.queue.$$
	echo "# as part of the transition to a config directory layout" >> /etc/$pkg/httpd.conf.dpkg-inst.queue.dpkg-inst.queue.$$
	echo "# similar to apache2, and that will help users to migrate" >> /etc/$pkg/httpd.conf.dpkg-inst.queue.dpkg-inst.queue.$$
	echo "# from apache to apache2 or revert back easily" >> /etc/$pkg/httpd.conf.dpkg-inst.queue.dpkg-inst.queue.$$
	echo "Include /etc/$pkg/conf.d" >> /etc/$pkg/httpd.conf.dpkg-inst.queue.dpkg-inst.queue.$$
	mv -f /etc/$pkg/httpd.conf.dpkg-inst.queue.dpkg-inst.queue.$$ /etc/$pkg/httpd.conf.dpkg-inst.queue.dpkg-inst.queue
    fi
}

prepare_ucf() {
    if [ "$#" -ne 1 ]; then
        echo "Wrong number of arguments to prepare_ucf"
	return
    fi
    pkg="$1"

    export IFS="$new_IFS"
    for i in $CONFS; do
	if [ ! -e $i.dpkg-inst.queue ]; then
	    cp -f $i $i.dpkg-inst.queue
	fi
    done
    export IFS="$old_IFS"
}

do_ucf() {
    if [ "$#" -ne 1 ]; then
        echo "Wrong number of arguments to do_ucf"
	return
    fi
    pkg="$1"

    #this is a leftover for NOT using config files directly
    #and requires special treatments

    if [ -e /etc/$pkg/httpd.conf.dpkg-inst.queue.dpkg-inst.queue ]; then
	mv -f /etc/$pkg/httpd.conf.dpkg-inst.queue.dpkg-inst.queue /etc/$pkg/httpd.conf.dpkg-inst.queue
    fi

    # removing the fake (if any)

    if [ -e /etc/$pkg/modules.conf.fake ]; then
        rm -f /etc/$pkg/modules.conf.fake /etc/$pkg/modules.conf
    fi

    # here we treat our well known configfiles
    # NOTE: this will register in ucf only files that needs to be registered
    #       and does that dynamically (less ucf clutter)

    for i in httpd.conf srm.conf access.conf modules.conf; do
        if [ -e /etc/$pkg/$i.dpkg-inst.queue ]; then
	    ucf --debconf-ok "/etc/$pkg/$i.dpkg-inst.queue" "/etc/$pkg/$i"
	    rm -f /etc/$pkg/$i.dpkg-inst.queue
	    if [ -e /etc/$pkg/$i.dpkg-dist ]; then
		if [ "`md5sum /etc/$pkg/$i.dpkg-dist | awk '{print $1}'`" = "`md5sum /etc/$pkg/$i | awk '{print $1}'`" ]; then
		    rm -f /etc/$pkg/$i.dpkg-dist
		fi
	    fi
	fi
    done

    # here we check if we mangled other configfiles
    # in the first place we check if the file is already registered in ucf
    # we run ucf that in one case or another will register it
    # and at the end we purge if it was NOT registered.
    # in this way we use ucf to detect user changes and we prompt the user
    # NOTE: it can be improved keeping track of normally unregistered config!

    export IFS="$new_IFS"
    CONFS=`/usr/share/apache/listconffiles /etc/$pkg/httpd.conf`

    for i in $CONFS; do
        export IFS="$old_IFS"
        if [ -e $i.dpkg-inst.queue ]; then
	    purge_from_ucf=1
	    if [ "`grep $i$ /var/lib/ucf/hashfile`" ]; then
	        purge_from_ucf=0
	    fi
	    ucf --debconf-ok "$i.dpkg-inst.queue" "$i"
	    rm -f $i.dpkg-inst.queue
	    if [ -e $i.dpkg-dist ]; then
	        if [ "`md5sum $i.dpkg-dist | awk '{print $1}'`" = "`md5sum $i | awk '{print $1}'`" ]; then
		    rm -f $i.dpkg-dist
		fi
	    fi
	    if [ "$purge_from_ucf" = "1" ]; then
	        ucf --purge $i
	    fi
	fi
        export IFS="$new_IFS"
    done
    export IFS="$old_IFS"
}

do_all() {
    if [ "$#" -ne 1 ]; then
        echo "Wrong number of arguments to do_all"
	return
    fi
    pkg="$1"

    # small workaround to avoid listconfig complains while installing
    if [ ! -e /etc/$pkg/modules.conf ]; then
        touch /etc/$pkg/modules.conf.fake
        ln -sf /etc/$pkg/modules.conf.fake /etc/$pkg/modules.conf
    fi
    CONFS=`/usr/share/apache/listconffiles /etc/$pkg/httpd.conf.dpkg-inst.queue`
    export CONFS="/etc/$pkg/httpd.conf.dpkg-inst.queue`printf '\x07'`$CONFS"
    prepare_ucf $pkg
    do_debconf_configs $pkg
    fix_pid $pkg
    check_start $pkg
    add_magic_loadmodule_line $pkg
    comment_out_adddefaultcharset $pkg
    link_mime_types $pkg
    # Remove post-sarge (potato is savelog, woody is logrotate)
    check_logs_outside_var_log $pkg
    remove_savelog_setup $pkg
    link_suexec $pkg
    defaultindex $pkg
    add_conf_d $pkg
    do_ucf $pkg
    suggested_corrections $pkg
}