postinst is in kstars-data-extra-tycho2 1.1r1-9.
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 | #!/bin/sh
# kstars-data-extra POSTINST
set -e
# Can we work with debconf?
if [ ! -e /usr/share/debconf/confmodule ] ; then
# Nothing we can do
exit 0
fi
#export DEBCONF_DEBUG=developer
. /usr/share/debconf/confmodule
db_version 2.0
log ()
{
echo postinst "$1" >&2 > /dev/null
}
log_err ()
{
echo postinst "$1" >&2
}
log "$@"
case $1 in
configure|reconfigure|install) # case $1
# Check if /etc/kde4 exists (somebody can, even if futile, install this package without kstars or any other KDE stuff)
if [ -d /etc/kde4 ] ; then
# Is this the first EVER kstars-data-extra package configured?
db_get "kstars-data-extra/kstarsrc-previously-exists"
kstarsrc_previously_exists_RET=$RET
log "kstarsrc-previously-exists RET $RET"
if [ "$kstarsrc_previously_exists_RET" = "unset" ] ; then
#THIS SECTION: IF NEVER HAS BEEN PREVIOUS FILE
# If script reaches this point, it is beacause there have never
#been a kstars-data-extra package configured in this system.
# Is there a preexistent global kstarsrc config file?
if [ -f /etc/kde4/kstarsrc ] ; then
log "[ -f /etc/kde4/kstarsrc ] YES"
pregunta="kstars-data-extra/kstarsrc-exists"
else
log "[ -f /etc/kde4/kstarsrc ] NO"
db_set "kstars-data-extra/kstarsrc-previously-exists" "does not exist"
pregunta="kstars-data-extra/kstarsrc-does-not-exist"
fi # if [ -f /etc/kde4/kstarsrc ]
db_get $pregunta
log "`basename $pregunta` RET $RET"
if [ "$RET" = "true" -o "$RET" = "backup and create new" -o "$RET" = "delete and create new" ] ; then
# Create new kstarsrc
db_get kstars-data-extra/disable-downloads
log "disable-downloads RET $RET"
echo '#/etc/kde4/kstarsrc' > /etc/kde4/kstarsrc
echo '# This file has been created by debconf' >> /etc/kde4/kstarsrc
echo '[KDE Action Restrictions]' >> /etc/kde4/kstarsrc
if [ "$RET" = "keep enabled" ] ; then
:
elif [ "$RET" = "disable" ] ; then
echo 'action/get_data=false' >> /etc/kde4/kstarsrc
elif [ "$RET" = "lock" ] ; then
echo 'action/get_data[$i]=false' >> /etc/kde4/kstarsrc
fi
fi # if [ "$RET" = "true" -o "$RET" = "backup and create new" -o "$RET" = "delete and create new" ]
db_stop || true
exit 0
else # ! if [ "$kstarsrc_previously_exists_RET" = "unset" ]
#THIS SECTION: IF THERE HAS BEEN A PREVIOUS CONFIGURATION
# If script reaches this point, it is because a previous
#kstars-data-extra package was configured. We will rely on its
#configuration and do nothing.
# TODO Add here a low-p question about if you want to reconfigure
db_stop || true
exit 0
fi # if [ "$kstarsrc_previously_exists_RET" = "unset" ]
fi #if [ -f /etc/kde4 ]
;; # configure|reconfigure|install)
abort-remove|abort-deconfigure) #case $1
log "postinst $1"
exit 0
;; # abort-remove|abort-deconfigure)
*) #case $1
log_err "postinst called with unknown argument $1"
exit 1
;; # *)
esac
|