postinst is in ipplan 4.92a-2.
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 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | #!/bin/sh
set -e
MCONFDIR=/usr/share/ipplan/mconf/
# only if we install the package and on dpkg-reconfigure
if [ "${DEBCONF_RECONFIGURE}" = "1" ] || [ "$1" = "configure" ] && [ -z "$2" ]; then
. /usr/share/debconf/confmodule
db_version 2.0 || [ $? -lt 30 ]
db_get ipplan/webserver_type
webservers="$RET"
restart=""
for webserver in $webservers; do
webserver=${webserver%,}
test -x /usr/sbin/$webserver || continue
case "$webserver" in
apache2)
if [ -d /etc/$webserver/mods-enabled ]; then
# enable actions module
a2enmod actions >/dev/null
# enable php or cgi module
if [ -f /usr/lib/$webserver/modules/libphp5.so ]; then
a2enmod php5 >/dev/null
else
a2enmod cgi >/dev/null
fi
fi
;;
esac
case "$webserver" in
apache2)
test -d /etc/$webserver/conf.d || continue
if [ ! -f /etc/$webserver/conf.d/ipplan -a ! -h /etc/$webserver/conf.d/ipplan ]; then
ln -s /etc/ipplan/apache.conf /etc/$webserver/conf.d/ipplan
fi
restart="$restart $webserver"
;;
esac
done
db_get ipplan/mysql/configure
if [ "$RET" = true ]; then
# get the answers to our questions
db_get ipplan/mysql/dbserver
dbserver=$RET
db_get ipplan/mysql/dbadmin
dbadmin=$RET
db_get ipplan/mysql/dbadmpass
dbadmpass=$RET
db_reset ipplan/mysql/dbadmpass
db_get ipplan/mysql/dbname
dbname=$RET
db_get ipplan/mysql/dbuser
dbuser=$RET
db_get ipplan/mysql/dbpass
dbpass=$RET
db_reset ipplan/mysql/dbpass
# create the database
. /usr/share/wwwconfig-common/mysql-createdb.sh
# create user
. /usr/share/wwwconfig-common/mysql-createuser.sh
# write database options into config
echo "<?php" > $MCONFDIR/db.php
echo "// Please don't edit this file, use local_conf.php to overwrite" >> $MCONFDIR/db.php
echo "// You can change this settings with 'dpkg-reconfigure -plow ipplan'." >> $MCONFDIR/db.php
echo "defined(\"DBF_TYPE\")|| define(\"DBF_TYPE\", 'mysql');" >> $MCONFDIR/db.php
echo "defined(\"DBF_HOST\")|| define(\"DBF_HOST\", '$dbserver');" >> $MCONFDIR/db.php
echo "defined(\"DBF_USER\")|| define(\"DBF_USER\", '$dbuser');" >> $MCONFDIR/db.php
echo "defined(\"DBF_NAME\")|| define(\"DBF_NAME\", '$dbname');" >> $MCONFDIR/db.php
echo "defined(\"DBF_PASSWORD\")|| define(\"DBF_PASSWORD\", '$dbpass');" >> $MCONFDIR/db.php
echo "?>" >> $MCONFDIR/db.php
else
# leave note, that database has to be configured local
echo "<?php" > $MCONFDIR/db.php
echo "// You have decided to configure you database yourself!" > $MCONFDIR/db.php
echo "// You can change that with 'dpkg-reconfigure -plow ipplan'." > $MCONFDIR/db.php
echo "// Please don't edit this file, use local_conf.php to overwrite" >> $MCONFDIR/db.php
echo "?>" >> $MCONFDIR/db.php
fi
db_stop
# drop owner to www-data of uploaddir
if ! [ -d /var/spool/ipplan ]; then
mkdir /var/spool/ipplan
chown -R www-data /var/spool/ipplan
fi
# copy template of local user config, if there is none
if [ ! -f /etc/ipplan/local_conf.php ];then
cp $MCONFDIR/local_conf.php /etc/ipplan/
fi
for webserver in $restart; do
webserver=${webserver%,}
# Reload webserver in any case, configuration might have changed
# Redirection of 3 is needed because Debconf uses it and it might
# be inherited by webserver. See bug #446324.
if [ -x /usr/sbin/invoke-rc.d ]; then
invoke-rc.d $webserver reload 3>/dev/null || true
else
/etc/init.d/$webserver reload 3>/dev/null || true
fi
done
fi
# register config files
for conffile in db.php ; do
# secure our config files
chown root $MCONFDIR/$conffile
chmod 600 $MCONFDIR/$conffile
# Tell ucf that the file in /usr/share/ipplan is the latest
# maintainer version, and let it handle how to manage the real
# configuration file in /etc/ipplan.
ucf $MCONFDIR/$conffile /etc/ipplan/$conffile
ucfr ipplan /etc/ipplan/$conffile
# set permissions
if [ -f "/etc/ipplan/$conffile" ]; then
chown root:www-data /etc/ipplan/$conffile
if [ "$conffile" != "db.php" ]; then
chmod 640 /etc/ipplan/$conffile
else
chmod 644 /etc/ipplan/$conffile
fi
fi
done
|