postinst is in gallery2 2.3-1ubuntu6.
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 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | #!/bin/sh
set -e
. /usr/share/debconf/confmodule
db_version 2.0 || [ $? -lt 30 ]
EG=/etc/gallery2/apache.conf
EGB=/etc/gallery2_backup/apache.conf
if [ "$1" = upgrade ]; then
if [ -d $EGB ]; then
mv $EGB $EG
rm -rf $EGB
fi
fi
if [ "$1" = "configure" ]; then
if [ ! -L /usr/share/gallery2/lib/smarty ]; then
if [ -d /usr/share/gallery2/lib/smarty ]; then
rm -rf /usr/share/gallery2/lib/smarty
fi
if [ ! -e /usr/share/gallery2/lib/smarty ]; then
ln -s /usr/share/php/smarty /usr/share/gallery2/lib/smarty
fi
fi
if [ ! -L /usr/share/gallery2/lib/adodb ]; then
if [ -d /usr/share/gallery2/lib/adodb ]; then
rm -rf /usr/share/gallery2/lib/adodb
fi
ln -s /usr/share/php/adodb /usr/share/gallery2/lib/adodb
fi
db_get gallery2/webserver_type
webservers="$RET"
restart=""
for webserver in $webservers; do
webserver=${webserver%,}
test -x /usr/sbin/$webserver || continue
case "$webserver" in
apache|apache-perl|apache-ssl)
if [ -x /usr/sbin/modules-config ]; then
if [ -f /usr/lib/apache/1.3/libphp5.so ]; then
if ! grep -qs "^LoadModule php5_module " /etc/$webserver/modules.conf; then
modules-config $webserver enable mod_php5
fi
elif [ -f /usr/lib/apache/1.3/libphp4.so ]; then
if ! grep -qs "^LoadModule php4_module " /etc/$webserver/modules.conf; then
modules-config $webserver enable mod_php4
fi
elif [ -f /usr/lib/apache/1.3/libphp3.so ]; then
if ! grep -qs "^LoadModule php3_module " /etc/$webserver/modules.conf; then
modules-config $webserver enable mod_php3
fi
else
if [ -f /usr/lib/apache/1.3/mod_actions.so ]; then
if ! grep -qs "^LoadModule action_module " /etc/$webserver/modules.conf; then
modules-config $webserver enable mod_actions
fi
fi
if [ -f /usr/lib/apache/1.3/mod_cgi.so ]; then
if ! grep -qs "^LoadModule cgi_module " /etc/$webserver/modules.conf; then
modules-config $webserver enable mod_cgi
fi
fi
fi
fi
if grep -qs "^Include /etc/gallery2/apache.conf" /etc/$webserver/httpd.conf; then
mv -f /etc/$webserver/httpd.conf /etc/$webserver/httpd.conf.old.gallery2
grep -v "^Include /etc/gallery2/apache.conf" /etc/$webserver/httpd.conf.old.gallery2 \
> /etc/$webserver/httpd.conf
fi
if ! grep -qs "^Include /etc/$webserver/conf.d" /etc/$webserver/httpd.conf; then
cp -f /etc/$webserver/httpd.conf /etc/$webserver/httpd.conf.old.gallery2
echo "Include /etc/$webserver/conf.d" >> /etc/$webserver/httpd.conf
fi
if [ -f /etc/$webserver/httpd.conf.old.gallery2 ]; then
mv -f /etc/$webserver/httpd.conf.old.gallery2 /etc/$webserver/httpd.conf.old
fi
mkdir -p /etc/$webserver/conf.d
;;
apache2)
if [ -d /etc/$webserver/mods-enabled ]; then
if [ ! -f /etc/$webserver/mods-enabled/actions.load -a ! -h /etc/$webserver/mods-enabled/actions.load ]; then
ln -s /etc/$webserver/mods-available/actions.load /etc/$webserver/mods-enabled/actions.load
fi
if [ -f /etc/apache2/mods-available/php5.load ]; then
if [ ! -f /etc/$webserver/mods-enabled/php5.load -a ! -h /etc/$webserver/mods-enabled/php5.load ]; then
ln -s /etc/$webserver/mods-available/php5.load /etc/$webserver/mods-enabled/php5.load
fi
elif [ -f /etc/apache2/mods-available/php4.load ]; then
if [ ! -f /etc/$webserver/mods-enabled/php4.load -a ! -h /etc/$webserver/mods-enabled/php4.load ]; then
ln -s /etc/$webserver/mods-available/php4.load /etc/$webserver/mods-enabled/php4.load
fi
else
if [ ! -f /etc/$webserver/mods-enabled/cgi.load -a ! -h /etc/$webserver/mods-enabled/cgi.load ]; then
ln -s /etc/$webserver/mods-available/cgi.load /etc/$webserver/mods-enabled/cgi.load
fi
fi
fi
;;
esac
case "$webserver" in
apache|apache-perl|apache-ssl|apache2)
test -d /etc/$webserver/conf.d || continue
if [ ! -f /etc/$webserver/conf.d/gallery2 -a ! -h /etc/$webserver/conf.d/gallery2 ]; then
ln -s /etc/gallery2/apache.conf /etc/$webserver/conf.d/gallery2
fi
db_reset gallery2/restart-webserver || true
db_subst gallery2/restart-webserver webserver "$webserver"
db_input high gallery2/restart-webserver || true
db_go
db_get gallery2/restart-webserver
if [ "$RET" = "true" ]; then
restart="$restart $webserver"
fi
;;
esac
done
db_get gallery2/mysql/configure
if [ "$RET" = true ]; then
# get the answers to our questions
db_get gallery2/mysql/dbserver
dbserver=$RET
db_get gallery2/mysql/dbadmin
dbadmin=$RET
db_get gallery2/mysql/dbadmpass
dbadmpass=$RET
db_reset gallery2/mysql/dbadmpass
db_get gallery2/mysql/dbname
dbname=$RET
# create the database
. /usr/share/wwwconfig-common/mysql-createdb.sh
fi
db_stop
if [ ! -e /etc/gallery2/config.php ]; then
touch /etc/gallery2/config.php
chown www-data /etc/gallery2/config.php
chmod 640 /etc/gallery2/config.php
fi
if [ -e /usr/share/gallery2/g2data ]; then
mv /usr/share/gallery2/g2data/* /var/lib/gallery2/g2data/
rm -rf /usr/share/gallery2/g2data
fi
if [ -e /etc/gallery2/config.php ]; then
perl -pi -e 's/usr\/share\/gallery2\/g2data/var\/lib\/gallery2\/g2data/' /etc/gallery2/config.php
fi
for webserver in $restart; do
webserver=${webserver%,}
if [ -x /usr/sbin/invoke-rc.d ]; then
invoke-rc.d $webserver restart
else
/etc/init.d/$webserver restart
fi
done
fi
|