blob: 17f62c211894b7ea9d1f9f7faf9e896b53c6b4f7 (
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
|
#!/bin/sh
set -e
DEFAULT_FILE="/etc/default/iperf3"
do_default() {
cat <<-EOF > $DEFAULT_FILE
#
# This file is not used if systemd is being used
# you should run 'dpkg-reconfigure iperf3' instead of editing this file
# set START_DAEMON="yes" to start iperf3 as a daemon
#
START_DAEMON="$1"
EOF
}
do_initrc() {
if [ "$1" = "enable" ]; then action="defaults"; else action="remove"; fi
update-rc.d iperf3 $action || true
}
do_systemd() {
action="$1"
DPKG_MAINTSCRIPT_PACKAGE=iperf3 deb-systemd-helper unmask 'iperf3.service' >/dev/null || true
DPKG_MAINTSCRIPT_PACKAGE=iperf3 deb-systemd-helper $action 'iperf3.service' >/dev/null || true
}
. /usr/share/debconf/confmodule
# fetch data from debconf if any
db_get iperf3/start_daemon
if [ "$RET" = 'true' ] ; then
db_set iperf3/start_daemon true
else
db_set iperf3/start_daemon false
fi
db_input high iperf3/start_daemon || true
db_go
# fetch data from debconf if any
db_get iperf3/start_daemon
if [ "$RET" = 'true' ] ; then
do_default yes
do_systemd reenable
do_initrc enable
if [ -d /run/systemd/system ]; then
deb-systemd-invoke start 'iperf3.service' || true
else
invoke-rc.d iperf3 start || true
fi
else
do_default no
do_systemd disable
do_initrc disable
if [ -d /run/systemd/system ]; then
deb-systemd-invoke stop 'iperf3.service' || true
else
invoke-rc.d iperf3 stop || true
fi
fi
exit 0
|