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
|
#!/bin/sh -e
# source debconf library
. /usr/share/debconf/confmodule
CONFIGFILE=/etc/ifplugd/ifplugd.conf
CONFIGTMP=${CONFIGFILE}.tmp
DEFAULTFILE=/etc/default/ifplugd
DEFAULTTMP=${DEFAULTFILE}.tmp
write_db_conf (){
rm -f ${CONFIGTMP}
echo "# this file is deprecated - use /etc/default/ifplugd." >> ${CONFIGTMP}
mv ${CONFIGTMP} ${CONFIGFILE}
}
write_default (){
rm -f ${DEFAULTTMP}
(
echo "# This file may be changed either manually or by running dpkg-reconfigure."
echo "#"
echo "# N.B.: dpkg-reconfigure deletes everything from this file except for"
echo "# the assignments to variables INTERFACES, HOTPLUG_INTERFACES, ARGS and"
echo "# SUSPEND_ACTION. When run it uses the current values of those variables"
echo "# as their default values, thus preserving the administrator's changes."
echo "#"
echo "# This file is sourced by both the init script /etc/init.d/ifplugd and"
echo "# the hotplug script /etc/hotplug.d/net/ifplugd.hotplug to give default"
echo "# values. The init script starts ifplugd for all interfaces listed in"
echo "# INTERFACES, and the hotplug script starts ifplugd for all interfaces"
echo "# listed in HOTPLUG_INTERFACES. The special value "all" starts one"
echo "# ifplugd for all interfaces being present."
) >> $DEFAULTTMP
db_get ifplugd/interfaces || true
echo "INTERFACES=\"$RET\"" >> $DEFAULTTMP
db_get ifplugd/hotplug_interfaces || true
echo "HOTPLUG_INTERFACES=\"$RET\"" >> $DEFAULTTMP
db_get ifplugd/args || true
echo "ARGS=\"$RET\"" >> $DEFAULTTMP
db_get ifplugd/suspend_action || true
echo "SUSPEND_ACTION=\"$RET\"" >> $DEFAULTTMP
mv ${DEFAULTTMP} ${DEFAULTFILE}
}
case "$1" in
configure)
write_db_conf
write_default
if [ ! "$2" ] || [ "$2" = "<unknown>" ] ; then
# Fresh install
for F in /etc/apm/suspend.d/20ifplugd \
/etc/apm/resume.d/80ifplugd /etc/apm/other.d/50ifplugd ; do
[ -e $F ] && mv -f $F ${F}.dpkg-old
ln -nsf ../scripts.d/ifplugd $F
done
fi
# create udev rules file
if [ -z "$2" ] || [ "$2" = "<unknown>" ] || dpkg --compare-versions "$2" lt 0.28 ; then
ln -sf ../ifplugd.rules /etc/udev/rules.d/030_ifplugd.rules
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
esac
db_stop
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
|