postinst is in tvtime 1.0.2-10ubuntu10.
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 171 172 | #! /bin/sh
# postinst script for tvtime
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
#
# quoting from the policy:
# Any necessary prompting should almost always be confined to the
# post-installation script, and should be protected with a conditional
# so that unnecessary prompting doesn't happen if a package's
# installation fails and the `postinst' is called with `abort-upgrade',
# `abort-remove' or `abort-deconfigure'.
setuid () {
db_get tvtime/setuid
if [ -x /usr/bin/tvtime ] && [ "$RET" = "false" ] ; then
if [ ! -x /usr/sbin/dpkg-statoverride ] ||\
! /usr/sbin/dpkg-statoverride --list /usr/bin/tvtime >/dev/null; then
chown root:root /usr/bin/tvtime
chmod u=rwx,go=rx /usr/bin/tvtime
fi
else
if [ ! -x /usr/sbin/dpkg-statoverride ] || \
! /usr/sbin/dpkg-statoverride --list /usr/bin/tvtime >/dev/null; then
chown root:root /usr/bin/tvtime
chmod u=rwxs,go=rx /usr/bin/tvtime
fi
fi
}
# Parse the option requested from tvtime-configure
get_option () {
OPTION=`tvtime-configure --$1 2>/dev/null | awk -F: '{ print \$2 }'`
}
suck_tvtime_xml () {
# If tvtime-configure was not there at Debconf, but
# /etc/tvtime/tvtime.xml was, then we presume that the
# administrator knew what he was doing. We will therefore suck
# this information into the Debconf database now that
# tvtime-configure is installed.
if [ -f /etc/tvtime/debconf.tvtime.xml ]; then
get_option norm
db_set tvtime/norm "$OPTION"
get_option frequencies
db_set tvtime/frequencies-ntsc "$OPTION"
db_set tvtime/frequencies-jp "$OPTION"
db_set tvtime/frequencies-pal "$OPTION"
get_option device
db_set tvtime/v4ldevice "$OPTION"
get_option vbidevice
db_set tvtime/vbidevice "$OPTION"
get_option priority
db_set tvtime/processpriority "$OPTION"
fi
}
### MAIN POSTINST ###
case "$1" in
configure)
# Load Debconf library
. /usr/share/debconf/confmodule
# Handle the setuid bit.
setuid
# Load /etc/tvtime/tvtime.xml into Debconf, if necessary
suck_tvtime_xml
# Try to set the /var/run/tvtime directory to video group
if [ -d /var/run/tvtime ] ; then
if [ ! -x /usr/sbin/dpkg-statoverride ] || \
! /usr/sbin/dpkg-statoverride --list /var/run/tvtime >/dev/null; then
chmod ug=rwx,o=rxt /var/run/tvtime
chown root:video /var/run/tvtime
fi
fi
CONFIGFILE=/etc/tvtime/tvtime.xml
db_get tvtime/norm
NORM=$RET
case "$NORM" in
NTSC|PAL-M|PAL-Nc)
db_get tvtime/frequencies-ntsc
case "$RET" in
Cable) FREQTABLE=us-cable ;;
Broadcast) FREQTABLE=us-broadcast ;;
*) FREQTABLE=us-cable100 ;;
esac
;;
NTSC-JP)
db_get tvtime/frequencies-jp
case "$RET" in
Cable) FREQTABLE=japan-cable ;;
*) FREQTABLE=japan-broadcast ;;
esac
;;
PAL|PAL-60|PAL-N|SECAM)
db_get tvtime/frequencies-pal
case "$RET" in
Europe) FREQTABLE=europe ;;
France) FREQTABLE=france ;;
Russia) FREQTABLE=russia ;;
Australia) FREQTABLE=australia ;;
"New Zealand") FREQTABLE=newzealand ;;
"China Broadcast") FREQTABLE=china-broadcast ;;
"Australia Optus cable") FREQTABLE=australia-optus ;;
*) FREQTABLE=custom ;;
esac
;;
*)
FREQTABLE=custom
;;
esac
db_get tvtime/v4ldevice
V4LDEV=$RET
db_get tvtime/vbidevice
VBIDEV=$RET
db_get tvtime/processpriority
PRI=$RET
db_stop
# Create the configuration file if it doesn't exist
if [ ! -f $CONFIGFILE ]; then
cp /usr/share/doc/tvtime/examples/default.tvtime.xml $CONFIGFILE
fi
# Configure tvtime.
tvtime-configure --configfile="$CONFIGFILE" --norm="$NORM" \
--frequencies="$FREQTABLE" --device="$V4LDEV" \
--vbidevice="$VBIDEV" --priority="$PRI" 2>/dev/null
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
# Automatically added by dh_installmenu
if [ "$1" = "configure" ] && [ -x "`which update-menus 2>/dev/null`" ]; then
update-menus
fi
# End automatically added section
exit 0
|