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
|
#!/bin/sh -e
AC_DEFINE ()
{
CFLAGS="-D$1 $CFLAGS"
}
#UPSTREAM SETUP#
ponder ()
{
driver=$1
#UPSTREAM HEURISTICS#
lircd_driver=`expr $HW_DEFAULT : 'hw_\(.*\)'`
if [ "$IRTTY" != "none" ];then
DEVICE=$IRTTY
else
DEVICE="/dev/lirc"
fi
MODULES=`echo -n $lirc_driver | sed -n -e '/lirc_/p'`;
[ "$SOFT_CARRIER" = "on" ] && AC_DEFINE LIRC_SERIAL_SOFTCARRIER
[ "$TRANSMITTER" = "on" ] && AC_DEFINE LIRC_SERIAL_TRANSMITTER
}
DebconfSave ()
{
db_set lirc/driver "$lircd_driver"
db_set lirc/modules "$MODULES"
db_set lirc/device "$DEVICE"
db_set lirc/lircd_conf "$lircd_conf"
db_set lirc/lircmd_conf "$lircmd_conf"
db_set lirc/port "$LIRC_PORT"
db_set lirc/irq "$LIRC_IRQ"
db_set lirc/timer "$TIMER"
db_set lirc/cflags "$CFLAGS"
}
# Source debconf library.
. /usr/share/debconf/confmodule
# Tell users to use IntelliMouse instead of IMPS/2
if \
[ -f /etc/lirc/lircmd.conf ] && \
grep -q -i "^[^#]*PROTOCOL[\t ]*IMPS/2" /etc/lirc/lircmd.conf
then
db_input medium lirc/should-use-IntelliMouse || true
fi
# Should I install device nodes?
db_input medium lirc/install_devices || true
db_go
db_fget lirc/reconfigure configured
CONFIGURED=$RET
if $CONFIGURED; then
db_input medium lirc/reconfigure || true
db_go
fi
db_get lirc/reconfigure
if ! $CONFIGURED || $RET; then
TEMP=`mktemp /tmp/lirc.XXXXXX`
CONFIG=`mktemp /tmp/lirc.XXXXXX`
START=`mktemp /tmp/lirc.XXXXXX`
db_set lirc/reconfigure false
db_fset lirc/reconfigure seen true
ConfigDriver || true
#TEMP is the output of the last invocation of dialog, which dumps the
#selected choice or nothing if cancelled
if [ -n "`cat $TEMP`" ];then
ponder $LIRC_DRIVER || true
DebconfSave
db_fset lirc/reconfigure configured true
db_fset lirc/reconfigure config_changed true
else
#Canceled
echo CANCELED;
fi
rm -f $TEMP $CONFIG $START
fi
# Tell the user to take care of old configuration files if they are
# still there
if [ -f /etc/lircmd.conf ] || [ -f /etc/lircd.conf ];then
db_reset lirc/take_care_of_old_config
db_input high lirc/take_care_of_old_config || true
db_go
fi
# Tell the user about the old /var/log/lirc log file
if [ -f /var/log/lircd ]
then
db_fset lirc/remove_var-log-lircd seen false
db_input medium lirc/remove_var-log-lircd || true
db_go
fi
|