Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 554690 | Differences between
and this patch

Collapse All | Expand All

(-)file_not_specified_in_diff (-16 / +12 lines)
Line  Link Here
0
-- a/net-firewall/fwknop/files/fwknopd.init
0
++ b/net-firewall/fwknop/files/fwknopd.init
Lines 1-28 Link Here
1
#!/sbin/runscript
1
#!/sbin/runscript
2
# Copyright 1999-2015 Gentoo Foundation
2
# Copyright 1999-2015 Gentoo Foundation
3
# Distributed under the terms of the GNU General Public License v2
3
# Distributed under the terms of the GNU General Public License v2
4
# $Header: /var/cvsroot/gentoo-x86/net-firewall/fwknop/files/fwknopd.init,v 1.4 2015/05/01 09:55:00 idella4 Exp $
4
# $Header: $
5
5
6
extra_commands="checkconfig"
6
extra_commands="checkconfig"
7
extra_started_commands="reload"
7
extra_started_commands="reload"
8
8
9
: ${FWKNOPD_BINARY:=/usr/sbin/fwknopd}
9
: ${FWKNOPD_CONFDIR:=/etc/fwknop}
10
: ${FWKNOPD_CONFDIR:=/etc/fwknop}
10
: ${FWKNOPD_CONFIG:=${FWKNOPD_CONFDIR}/fwknopd.conf}
11
: ${FWKNOPD_CONFIG:=${FWKNOPD_CONFDIR}/fwknopd.conf}
11
: ${FWKNOPD_PIDFILE:=/run/fwknop/${SVCNAME}.pid}
12
: ${FWKNOPD_PIDFILE:=/run/fwknop/${SVCNAME}.pid}
12
: ${FWKNOPD_BINARY:=/usr/sbin/fwknopd}
13
13
14
depend() {
14
depend() {
15
	need iptables
15
	after iptables ip6tables ebtables firewall
16
	use logger
16
	use logger
17
	if [ "${rc_need+set}" = "set" ]; then
17
	if [ "${rc_need+set}" = "set" ]; then
18
		: # Do nothing, the user has explicitly set rc_need
18
		: # Do nothing, the user has explicitly set rc_need
19
	else
19
	else
20
		warn_intf=''
20
		local x warn_intf
21
		for x in $(awk '/^PCAP_INTF/{ sub(";$", ""); print $2 }' "${FWKNOPD_CONFIG}" 2>/dev/null); do
21
		for x in $(awk '/^PCAP_INTF/{ sub(";$", ""); print $2 }' "${FWKNOPD_CONFIG}" 2>/dev/null); do
22
			warn_intf="${warn_intf} $x"
22
			warn_intf="${warn_intf} ${x}"
23
		done
23
		done
24
		unset x
24
		if [ -n "${warn_intf}" ]; then
25
		if [ "${warn_intf:+set}" = "set" ]; then
26
			need net
25
			need net
27
			ewarn "You are binding an interface in PCAP_INTF statement in your fwknopd.conf!"
26
			ewarn "You are binding an interface in PCAP_INTF statement in your fwknopd.conf!"
28
			ewarn "You must add rc_need=\"net.FOO\" to your /etc/conf.d/${SVCNAME},"
27
			ewarn "You must add rc_need=\"net.FOO\" to your /etc/conf.d/${SVCNAME},"
Lines 30-43 depend() { Link Here
30
			ewarn "${warn_intf}"
29
			ewarn "${warn_intf}"
31
		else
30
		else
32
			# if PCAP_INTF and PCAP_FILE are not set, then fwknopd uses eth0
31
			# if PCAP_INTF and PCAP_FILE are not set, then fwknopd uses eth0
33
			if [ -z "$(grep '^PCAP_FILE' ${FWKNOPD_CONFIG})" ]; then
32
			if ! grep -q '^PCAP_FILE' "${FWKNOPD_CONFIG}"; then
34
				need net
33
				need net
35
				ewarn "You are not binding any interface in PCAP_INTF statement in your fwknopd.conf,"
34
				ewarn "You are not binding any interface in PCAP_INTF statement in your fwknopd.conf,"
36
				ewarn "neither you are providing PCAP_FILE option. Thus fwknopd will listen on eth0."
35
				ewarn "neither you are providing PCAP_FILE option. Thus fwknopd will listen on eth0."
37
				ewarn "You must add rc_need=\"net.eth0\" to your /etc/conf.d/${SVCNAME}."
36
				ewarn "You must add rc_need=\"net.eth0\" to your /etc/conf.d/${SVCNAME}."
38
			fi
37
			fi
39
		fi
38
		fi
40
		unset warn_intf
41
	fi
39
	fi
42
}
40
}
43
41
Lines 70-76 start() { Link Here
70
68
71
	ebegin "Starting ${SVCNAME}"
69
	ebegin "Starting ${SVCNAME}"
72
	start-stop-daemon --start \
70
	start-stop-daemon --start \
73
		--exec "${FWKNOPD_BINARY}" --pidfile="${FWKNOPD_PIDFILE}" \
71
		--exec ${FWKNOPD_BINARY} --pidfile ${FWKNOPD_PIDFILE} \
74
		-- ${FWKNOPD_OPTS}
72
		-- ${FWKNOPD_OPTS}
75
	eend $?
73
	eend $?
76
}
74
}
Lines 81-96 stop() { Link Here
81
	fi
79
	fi
82
80
83
	ebegin "Stopping ${SVCNAME}"
81
	ebegin "Stopping ${SVCNAME}"
84
	start-stop-daemon --stop \
82
	start-stop-daemon --stop --pidfile ${FWKNOPD_PIDFILE}
85
		--exec "${FWKNOPD_BINARY}" --pidfile "${FWKNOPD_PIDFILE}"
86
	eend $?
83
	eend $?
87
}
84
}
88
85
89
reload() {
86
reload() {
90
	checkconfig || return 1
87
	checkconfig || return 1
91
88
92
	ebegin "Reloading ${SVCNAME}"
89
	ebegin "Reloading ${SVCNAME} configuration"
93
	start-stop-daemon --signal HUP \
90
	start-stop-daemon --signal HUP --pidfile ${FWKNOPD_PIDFILE}
94
		--exec "${FWKNOPD_BINARY}" --pidfile "${FWKNOPD_PIDFILE}"
95
	eend $?
91
	eend $?
96
}
92
}

Return to bug 554690