summaryrefslogtreecommitdiff
path: root/debian/ifplugd.config
diff options
context:
space:
mode:
Diffstat (limited to 'debian/ifplugd.config')
-rw-r--r--debian/ifplugd.config72
1 files changed, 72 insertions, 0 deletions
diff --git a/debian/ifplugd.config b/debian/ifplugd.config
new file mode 100644
index 0000000..08962d1
--- /dev/null
+++ b/debian/ifplugd.config
@@ -0,0 +1,72 @@
+#!/bin/bash -e
+
+# Source debconf library.
+. /usr/share/debconf/confmodule
+
+db_version 2.0
+
+# This conf script is capable of backing up
+db_capb backup
+
+# Cool. ifplugd.conf just sets environment, so we
+# can use it and convert from and to debconf without
+# loss.
+CONFIGFILE=/etc/ifplugd/ifplugd.conf
+if [ -f ${CONFIGFILE} ] ; then
+ . ${CONFIGFILE}
+
+ db_set ifplugd/args ${ARGS}
+ db_set ifplugd/interfaces ${INTERFACES}
+fi
+
+DEFAULTFILE=/etc/default/ifplugd
+if [ -f ${DEFAULTFILE} ] ; then
+ . ${DEFAULTFILE}
+
+ db_set ifplugd/suspend_action ${SUSPEND_ACTION}
+ db_set ifplugd/hotplug_interfaces ${HOTPLUG_INTERFACES}
+
+ # we move those to /etc/default/ifplugd since 0.19:
+ db_set ifplugd/args ${ARGS}
+ db_set ifplugd/interfaces ${INTERFACES}
+fi
+
+STATE=1
+while [ "$STATE" != 0 -a "$STATE" != 5 ]; do
+ case "$STATE" in
+ 1)
+ db_input medium ifplugd/interfaces || true
+ ;;
+ 2)
+ db_input medium ifplugd/hotplug_interfaces || true
+ ;;
+ 3)
+ db_input medium ifplugd/args || true
+ ;;
+ 4)
+ db_input low ifplugd/suspend_action || true
+ ;;
+ esac
+
+ if db_go; then
+ STATE=$(($STATE + 1))
+ else
+ STATE=$(($STATE - 1))
+ fi
+done
+
+# dpkg-reconfigure does not stop services:
+# (cause of Bug#151528)
+# in debhelper version < 1.2.9
+
+DH_VERSION=`dpkg -l debconf | awk ' /^ii/ { print $3 }'`
+
+if dpkg --compare-versions $DH_VERSION lt "1.2.9" ; then
+ if [ x"$1" = x"reconfigure" ] ; then
+ if [ -x "/etc/init.d/ifplugd" ]; then
+ /etc/init.d/ifplugd stop || true
+ fi
+ fi
+fi
+
+exit 0