summaryrefslogtreecommitdiff
path: root/debian/ifplugd.config
blob: 12b22bd1916ba7afb33e74d7e5310a6a13816b8c (plain)
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
#!/bin/bash

set -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
		if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
			invoke-rc.d ifplugd stop || exit $?
		else
			/etc/init.d/ifplugd stop || exit $?
		fi
	fi
    fi
fi

exit 0