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
|
#!/bin/bash
# postinst maintainer script for movabletype-opensource
set -e
# source debconf stuff
. /usr/share/debconf/confmodule
# source dbconfig-common stuff
dbc_dbfile_owner="www-data:www-data"
. /usr/share/dbconfig-common/dpkg/postinst
dbc_go movabletype-opensource $@
if [ "$1" == "configure" ]; then
# Generate mt-config.cgi
NEWCONF=/etc/movabletype-opensource/.mt-config.cgi.new
if [ -f /etc/dbconfig-common/movabletype-opensource.conf ]; then
. /etc/dbconfig-common/movabletype-opensource.conf
if [ -n "$dbc_install" -a "$dbc_install" == "true" ]; then
# We can proceed
cat > $NEWCONF <<EOF
CGIPath /cgi-bin/movabletype/
StaticWebPath /mt-static/
StaticFilePath /usr/share/movabletype/static/
MailTransfer sendmail
SendMailPath /usr/sbin/sendmail
HTMLUmask 0022
DBUmask 0022
UploadUmask 0022
DirUmask 0022
CaptchaSourceImageBase /usr/share/movabletype/static/images/captcha-source/
ThemesDirectory /usr/share/movabletype/themes/
EOF
REALCONF=/etc/movabletype-opensource/mt-config.cgi
if [ -f $REALCONF ]; then
chown --reference $REALCONF $NEWCONF
chmod --reference $REALCONF $NEWCONF
else
chown root:www-data $NEWCONF
chmod 640 $NEWCONF
fi
if [ "$dbc_dbtype" == "sqlite" ]; then
echo "ObjectDriver DBI::sqlite" >> $NEWCONF
echo "Database $dbc_basepath/$dbc_dbname" >> $NEWCONF
elif [ "$dbc_dbtype" == "mysql" ]; then
echo "ObjectDriver DBI::mysql" >> $NEWCONF
echo "Database $dbc_dbname" >> $NEWCONF
echo "DBUser $dbc_dbuser" >> $NEWCONF
if [ -n "$dbc_dbpass" ]; then
echo "DBPassword $dbc_dbpass" >> $NEWCONF
fi
if [ -n "$dbc_dbhost" ]; then
echo "DBHost $dbc_dbhost" >> $NEWCONF
fi
if [ -n "$dbc_dbport" ]; then
echo "DBPort $dbc_dbport" >> $NEWCONF
fi
elif [ "$dbc_dbtype" == "pgsql" ]; then
echo "ObjectDriver DBI::pgsql" >> $NEWCONF
echo "Database $dbc_dbname" >> $NEWCONF
echo "DBUser $dbc_dbuser" >> $NEWCONF
if [ -n "$dbc_dbpassword" ]; then
echo "DBPassword $dbc_dbpassword" >> $NEWCONF
fi
if [ -n "$dbc_dbhost" ]; then
echo "DBHost $dbc_dbhost" >> $NEWCONF
fi
if [ -n "$dbc_dbport" ]; then
echo "DBPort $dbc_dbport" >> $NEWCONF
fi
fi
ucf --debconf-ok $NEWCONF $REALCONF
rm -f $NEWCONF
fi
fi
if [ -x "`which apache2ctl`" ]; then
if [ -z "$2" ] || dpkg --compare-versions "$2" lt 4.2.6.1-2~test.3; then
db_get movabletype-opensource/reload_apache || true
RELOAD="$RET"
if [ "$RELOAD" = "true" ]; then
if apache2ctl configtest 2>/dev/null; then
invoke-rc.d apache2 reload || true
else
echo "apache2 configuration broken, not reloading!"
fi
else
echo "Please manually reload Apache to apply the configuration update"
fi
fi
fi
# Reset this for the next upgrade
db_fset movabletype-opensource/schema_upgrade seen false
fi
#DEBHELPER#
|