preinst is in irda-utils 0.9.18-14ubuntu2.
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 | #!/bin/bash
# Debconf configuration script for irda-utils
# Copyright © 2004 Sebastian Henschel <shensche@kodeaffe.de>
# This file is hereby placed into the public domain.
PACKAGE="irda-utils"
CONFIG="/etc/default/$PACKAGE"
CONFIG_OLD="/etc/irda.conf"
MODULES_24_OLD="/etc/modutils/irda"
MODULES_26_OLD="/etc/modprobe.d/irda"
MODULES_26_NEWER="/etc/modprobe.d/$PACKAGE"
MODULES_26="${MODULES_26_NEWER}.conf"
MODULES_24="/etc/modutils/$PACKAGE"
INIT_OLD="/etc/init.d/irda"
PREV="$2"
set -e
. /usr/share/debconf/confmodule || exit 0
if dpkg --compare-versions "$2" lt-nl 0.9.18-8.1ubuntu2
then
if [ -e $MODULES_26_NEWER ]
then
mv $MODULES_26_NEWER $MODULES_26
fi
if [ -e $MODULES_24 ]
then
rm $MODULES_24
fi
fi
# save data from $CONFIG_OLD to debconf
if [ -f "$CONFIG_OLD" ]; then # package version < 0.9.16-5
ENABLE="true"
egrep '^ENABLE=no' $CONFIG_OLD > /dev/null && ENABLE="false"
db_set $PACKAGE/enable $ENABLE
eval `egrep '^IRDADEV' $CONFIG_OLD`
case "$IRDADEV" in
/dev/ttyS*)
db_set $PACKAGE/selectdevice serial
db_set $PACKAGE/ttydev $IRDADEV
;;
irda0)
db_set $PACKAGE/selectdevice native
if [ -f "$MODULES_26_OLD" ]; then
modules="$MODULES_26_OLD";
elif [ -f "$MODULES_24_OLD" ]; then
modules="$MODULES_24_OLD";
fi
if [ -f "$modules" ]; then
if egrep "^alias irda0" $modules > /dev/null 2>&1 ; then
set `egrep "^alias irda0" $modules`
db_set $PACKAGE/firdev "$3"
if dpkg --compare-versions "$PREV" gt 0.9.14-17; then
set `egrep "^options $3" $modules`;
shift; shift
else
shift; shift; shift;
fi
db_set $PACKAGE/firopt "$*"
fi
fi
;;
esac
eval `egrep '^DONGLE' $CONFIG_OLD`
if [ -z "$DONGLE" ]; then
DONGLE="none"
fi
db_set $PACKAGE/dongle $DONGLE
eval `egrep '^DISCOVERY' $CONFIG_OLD`
if [ -z "$DISCOVERY" ]; then
DISCOVERY="false"
else
DISCOVERY="true"
fi
db_set $PACKAGE/discovery $DISCOVERY
db_go || true
# remove old debconf entries
db_unregister $PACKAGE/dongle24 || true
db_unregister $PACKAGE/dongle26 || true
db_unregister $PACKAGE/firdev24 || true
db_unregister $PACKAGE/firdev26 || true
db_unregister $PACKAGE/kver || true
db_unregister $PACKAGE/regen || true
db_go || true
# remove old files
if [ -e "$CONFIG_OLD" ]; then rm $CONFIG_OLD; fi
if [ -e "$MODULES_24_OLD" ]; then rm $MODULES_24_OLD; fi
if [ -e "$MODULES_26_OLD" ]; then rm $MODULES_26_OLD; fi
if [ -e "$INIT_OLD" ]; then rm $INIT_OLD; fi
fi
# load data from configuration files into debconf
if [ -f "$CONFIG" ]; then
. $CONFIG || true
# store values from current config
db_set $PACKAGE/enable $ENABLE
db_set $PACKAGE/automatic $AUTOMATIC
case "$DEVICE" in
/dev/ttyS*)
db_set $PACKAGE/selectdevice serial
db_set $PACKAGE/ttydev $DEVICE
;;
irda0)
db_set $PACKAGE/selectdevice native
kversion=`uname --kernel-release | cut --characters=1-3`
if [ "$kversion" = "2.4" ]; then
modules="/etc/modutils/$PACKAGE";
else
modules="/etc/modprobe.d/$PACKAGE";
fi
if [ -f "$modules" ]; then
set `egrep "^alias irda0" $modules`
db_set $PACKAGE/firdev "$3"
set `egrep "^options $3" $modules`; shift; shift
db_set $PACKAGE/firopt "$*"
fi
;;
esac
db_set $PACKAGE/dongle $DONGLE
db_set $PACKAGE/discovery $DISCOVERY
db_set $PACKAGE/setserial $SETSERIAL
db_go || true
fi
|