postinst is in serendipity 1.5.3-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 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | #!/bin/sh
set -e
if [ -n "$S9Y_DBG" ]; then
# echo "now debugging $0 $@"
set -x
fi
hook_apache2_install_0 () {
apache2ctl configtest
if [ "$?" -ne 0 ] ; then
echo "[!] Apache config failed, please check"
return 1
fi
}
hook_lighttpd_install_0 () {
lighty-enable-mod $@
}
run_hook () {
local webserver=$1
shift
local mode=$1
shift
local stage=$1
shift
hook_${webserver}_${mode}${stage:+_$stage} $@ >/dev/null 2>&1
if [ "$?" -ne 0 ] ; then
echo $0: "Could not run hook hook_${webserver}_${mode}${stage:+_$stage} (probably does not exist)"
fi
}
# inspired from phpbb3 postinst
install_webserver_config () {
local package=$1
local webserver=$2
local prio=$3
local confdir
local wfile
case "$webserver" in
"lighttpd" )
confdir=conf-available
wfile=${prio}-$package.conf
;;
"apache2" )
confdir=conf.d
wfile=$package.conf
;;
* )
echo Webserver $webserver is not supported.
exit 1
;;
esac
if [ -d /etc/$webserver/$confdir ] && [ ! -L /etc/$webserver/$confdir/$wfile ] ; then
if [ ! -x /usr/sbin/$webserver ] ; then
echo "$webserver not installed, skipping"
else
ln -s ../../$package/$webserver.conf /etc/$webserver/$confdir/$wfile
run_hook $webserver install 0 $package
fi
fi
}
reload_webserver () {
local webserver=$1
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
}
postgres_update_seqs () {
if db_get serendipity/dbconfig-install && [ "$RET" = "true" ]; then
db_get serendipity/database-type
if [ "$RET" = "pgsql" ]; then
db_get serendipity/db/dbname
/usr/share/serendipity/postgres_update_seqs.sh /usr/share/dbconfig-common/data/serendipity/install/pgsql | su - postgres -c "psql -d $RET -q >/dev/null"
fi
fi
}
. /usr/share/debconf/confmodule
. /usr/share/dbconfig-common/dpkg/postinst
if [ "$1" = "configure" ]; then
dbc_generate_include="php:/etc/serendipity/database.inc.php"
dbc_generate_include_owner="root:www-data"
dbc_generate_include_perms="0640"
# for sqlite: make sure that the database is readable for the webserver
dbc_dbfile_owner="root:www-data"
dbc_dbfile_perms="0660"
if ! dbc_go serendipity $@ ; then
echo 'dbc_go (postinst) failed!'
fi
postgres_update_seqs
# do special stuff on update
UCF=ucf
if dpkg --compare-versions "$2" lt-nl "1.5.3-1"; then
for i in $(find /etc/apache2/conf.d -type l); do
[ "$(readlink -fn $i)" = "/etc/serendipity/apache.conf" ] && rm $i
done
[ -f /etc/serendipity/apache.conf ] && mv /etc/serendipity/apache.conf /etc/serendipity/apache2.conf
ucft=$(mktemp -t)
echo "3761ea8f307cf83362e96475348d1df2 /etc/serendipity/apache2.conf" > $ucft
UCF="ucf --sum-file $ucft"
# copied from rules because it seems not to apply on upgrade
chmod u=rwx,g=wx,o= \
/var/cache/serendipity/templates \
/var/lib/serendipity/archives
chmod u=rwx,g=rwx,o= \
/var/lib/serendipity/uploads
fi
# lend from phpbb3 - configure and restart webserver(s) - the quick variant without debconf
supported_webservers_auto="apache2"
for webserver in ${supported_webservers_auto}; do
webserver=${webserver%,}
test -x /usr/sbin/$webserver || continue
$UCF --debconf-ok --three-way /usr/share/doc/serendipity/examples/$webserver.conf /etc/serendipity/$webserver.conf
ucfr serendipity /etc/serendipity/$webserver.conf
install_webserver_config serendipity $webserver 50
reload="$reload $webserver"
done
for webserver in $reload; do
webserver=${webserver%,}
reload_webserver $webserver
done
echo
# Create dummy htaccess, if none exists yet
if [ ! -e /var/lib/serendipity/htaccess ]; then
touch /var/lib/serendipity/htaccess
chgrp www-data /var/lib/serendipity/htaccess
chmod 0660 /var/lib/serendipity/htaccess
fi
# clean up special upgrade actions
if dpkg --compare-versions "$2" lt-nl "1.5.3-1"; then
rm $ucft
fi
# purge the caches
rm -f /var/cache/serendipity/templates/*
fi
|