postinst is in mythexport 2.2.4-0ubuntu5.
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 | #! /bin/sh -e
reload_apache()
{
if apache2ctl configtest 2>/dev/null; then
invoke-rc.d apache2 force-reload || true
else
echo "Your apache2 configuration is broken, so we're not restarting it for you."
fi
}
#Used to fail at some point but not abort postinst
fail_database() {
echo "Failed to create or modify database (incorrect MySQL username/password?)" >&2
echo "Verify /etc/mythtv/mysql.txt then try:" >&2
echo "sudo dpkg-reconfigure mythexport" >&2
db_input high mythexport/mysql_error || true
db_set mythexport/password ""
exit 0
}
case "$1" in
configure)
. /usr/share/debconf/confmodule
db_get mythexport/dir
dir="$RET"
if [ -n $dir ]; then
mkdir -p $dir
chown mythtv:mythtv $dir || true
chmod 775 $dir || true
if [ ! -e /usr/share/mythtv/mythexport/video ]; then
# remove broken symlink if it exists
if [ -h /usr/share/mythtv/mythexport/video ]; then
rm /usr/share/mythtv/mythexport/video
fi
ln -s $dir /usr/share/mythtv/mythexport/video
fi
fi
mkdir -p /var/www/.mythtv
mkdir -p /home/mythtv/.mythtv
if [ ! -e /var/www/.mythtv/config.xml ]; then
ln -s /etc/mythtv/config.xml /var/www/.mythtv/config.xml
fi
if [ ! -e /home/mythtv/.mythtv/config.xml ]; then
ln -s /etc/mythtv/config.xml /home/mythtv/.mythtv/config.xml
fi
if [ ! -e /var/www/mythexport ]; then
ln -s /usr/share/mythtv/mythexport /var/www/mythexport
fi
if [ -e /etc/mythtv/config.xml ]; then
chown www-data:mythtv /etc/mythtv/config.xml
fi
mkdir -p /etc/mythtv/mythexport
chmod 775 /etc/mythtv/mythexport
chown www-data:www-data /etc/mythtv/mythexport
if [ -e /etc/mythtv/mythexport.cfg ]; then
mv -f /etc/mythtv/mythexport.cfg /etc/mythtv/mythexport/mythexport.cfg
elif [ ! -e /etc/mythtv/mythexport/mythexport.cfg ]; then
touch /etc/mythtv/mythexport/mythexport.cfg
chmod 644 /etc/mythtv/mythexport/mythexport.cfg
chown www-data:www-data /etc/mythtv/mythexport/mythexport.cfg
echo "dir=$dir" > /etc/mythtv/mythexport/mythexport.cfg
fi
if [ -e /etc/mythtv/mythexport_settings.cfg ]; then
mv -f /etc/mythtv/mythexport_settings.cfg /etc/mythtv/mythexport/mythexport_settings.cfg
chmod 644 /etc/mythtv/mythexport/mythexport_settings.cfg
chown www-data:www-data /etc/mythtv/mythexport/mythexport_settings.cfg
fi
db_get mythexport/user
admin_username="$RET"
db_get mythexport/password
admin_password="$RET"
db_get mythexport/host
hostname="$RET"
if [ "$admin_username" = "debian-sys-maint" ]; then
SECURITY_INFO="--defaults-file=/etc/mysql/debian.cnf"
else
if [ -n $admin_password ]; then
admin_password="-p$admin_password"
fi
SECURITY_INFO="--host=\"$hostname\" --user=\"$admin_username\" $admin_password"
fi
db_get mythexport/dbname
dbname="$RET"
if ! mysql $SECURITY_INFO $dbname < /usr/share/mythtv/mythexport.sql >/dev/null 2>&1; then
fail_database
fi
if [ -e /etc/apache2/apache2.conf ]; then
a2ensite mythexport.conf >/dev/null || true
reload_apache
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# Automatically added by dh_installinit
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then
if [ -x "/etc/init.d/mythexport" ]; then
update-rc.d mythexport defaults >/dev/null
fi
if [ -x "/etc/init.d/mythexport" ] || [ -e "/etc/init/mythexport.conf" ]; then
invoke-rc.d mythexport start || exit $?
fi
fi
# End automatically added section
db_set mythexport/password ""
exit 0
|