postinst is in webfs 1.21+ds1-9.
This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.
The actual contents of the file can be viewed below.
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 | #!/bin/sh
set -e
# Source debconf library.
. /usr/share/debconf/confmodule
db_version 2.0
q1=web_root
q2=web_host
q3=web_ip
q4=web_port
q5=web_virtual
q6=web_timeout
q7=web_conn
q8=web_index
q9=web_dircache
q10=web_accesslog
q11=web_logbuffering
q12=web_syslog
q13=web_user
q14=web_group
q15=web_cgipath
q16=web_extras
CONFFILE=/etc/webfsd.conf
AUTOCONFFILE=/usr/share/webfs/webfsd.conf.auto
if [ "$1" = "configure" ]
then
TEMPCONFFILE=$(mktemp)
# Copy static file (in package) to a writable location.
cp -a $AUTOCONFFILE $TEMPCONFFILE
if test -f $CONFFILE
then
# Use old configuration as upgrade basis
cp -a $CONFFILE $TEMPCONFFILE
fi
# update config file from debconf answers
for question in $q1 $q2 $q3 $q4 $q5 $q6 $q7 $q8 $q9 $q10 \
$q11 $q12 $q13 $q14 $q15 $q16
do
db_get "webfsd/$question"
# echo "debug: webfsd/$question=$RET" > /dev/tty
if grep -q -e "^$question=" $TEMPCONFFILE
then
sed -i -e "s|^$question=.*|$question=\"$RET\"|" \
$TEMPCONFFILE
else
echo "$question=\"$RET\"" >> $TEMPCONFFILE
fi
done
db_set webfsd/pending no
# Register the auto generated configuration file.
test -x /usr/bin/ucf && \
ucf --three-way --debconf-ok $TEMPCONFFILE $CONFFILE
test -x /usr/bin/ucfr && \
ucfr webfs $CONFFILE
# Compute some sensible defaults before doing setup.
db_get "webfs/web_user" || RET=www-data
web_user=$RET
db_get "webfs/web_group" || RET=www-data
web_group=$RET
db_get "webfs/web_accesslog" || RET=/var/log/webfs/webfs.log
web_accesslog=$RET
db_stop
# Set owner and group on the preferred logging directory.
# It was installed for "root:root".
reply=`dpkg-statoverride --list /var/log/webfs 2>&1` || true
if test -z "$reply"
then
# No previous overrides.
dpkg-statoverride --update --add root "$web_group" 0770 \
/var/log/webfs
else
# If the mode was 2755, as in some earlier package versions,
# then forcibly update it to 0770 for improved security.
#
# The pattern contains the obsolete override.
pattern="root $web_group 2755 /var/log/webfs"
if echo $reply | grep "$pattern" > /dev/null 2>&1
then
# Change the obsolete setting.
dpkg-statoverride --update --force \
--add root "$web_group" 0770 /var/log/webfs
fi
fi
# create logfile
if test "$web_accesslog" != "" && test ! -f "$web_accesslog"
then
touch "$web_accesslog" 2>/dev/null || true
chown "$web_user":"$web_group" "$web_accesslog" 2>/dev/null || true
chmod o= "$web_accesslog" || true
fi
# Erase safely, out of principle
rm $TEMPCONFFILE 2>/dev/null || true
fi # test for "configure"
# Automatically added by dh_installinit
if [ -x "/etc/init.d/webfs" ] || [ -e "/etc/init/webfs.conf" ]; then
if [ ! -e "/etc/init/webfs.conf" ]; then
update-rc.d webfs defaults >/dev/null
fi
invoke-rc.d webfs start || exit $?
fi
# End automatically added section
|