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

Collapse All | Expand All

(-)/etc/init.d/fetchmail (-5 / +46 lines)
Lines 1-19 Link Here
1
#!/sbin/runscript
1
#!/sbin/runscript
2
2
3
pidfile="/var/run/fetchmail/${RC_SVCNAME}.pid"
3
pidfile="/var/run/fetchmail/${RC_SVCNAME}.pid"
4
rcfile="/etc/${RC_SVCNAME}rc"
5
fidfile="/var/lib/fetchmail/${RC_SVCNAME}.fetchids"
4
fidfile="/var/lib/fetchmail/${RC_SVCNAME}.fetchids"
6
5
6
# Need to define this variable here to make it global instead of local
7
rcfile=""
8
7
depend() {
9
depend() {
8
	need net
10
	need net
9
	use mta
11
	use mta
10
}
12
}
11
13
12
checkconfig() {
14
checkconfig() {
13
        if [ ! -f ${rcfile} ]; then
15
	if [ -z "${fetchmail_config}" ]; then
14
                eerror "Configuration file ${rcfile} not found"
16
		# Config is not explicitly set in the relevant conf.d file
15
                return 1
17
		if [ -z "${fetchmail_rc}" ]; then
16
        fi
18
			# User does not specify which file to use. Let's go find the right one
19
			if   [ -f /etc/${RC_SVCNAME}.rc ]; then
20
				# Newer naming system
21
				rcfile="/etc/${RC_SVCNAME}.rc"
22
			elif [ -f /etc/${RC_SVCNAME}rc ]; then
23
				# Older naming system
24
				rcfile="/etc/${RC_SVCNAME}rc"
25
			else
26
				[ "x$1" != "xquiet" ] && eerror "Can't find any proper configuration for ${RC_SVCNAME}"
27
				return 1
28
			fi
29
		else
30
			if [ -f ${fetchmail_rc} ]; then
31
				rcfile="${fetchmail_rc}"
32
			else
33
				[ "x$1" != "xquiet" ] && eerror "Can't find ${fetchmail_rc} configuration file for ${RC_SVCNAME}"
34
				return 1
35
			fi
36
		fi
37
		[ "x$1" != "xquiet" ] && einfo "Using configuration file: ${rcfile}"
38
	else
39
		[ "x$1" != "xquiet" ] && einfo "Using provided configuration in /etc/conf.d/${RC_SVCNAME}"
40
		# Config is explicitly specified. Let's dump it into a file to be read back by fetchmail
41
		# Why dumping it into a file instead of other methods (e.g., named pipe)? This allows
42
		# troubleshooting.
43
		rcfile="/var/run/fetchmail/${RC_SVCNAME}.rc"
44
		echo "${fetchmail_config}" > $rcfile
45
	fi
46
47
	# Ensure ownership and permissions to prevent fetchmail from complaining
48
	chown fetchmail:root $rcfile
49
	chmod 0700 $rcfile
17
}
50
}
18
51
19
start() {
52
start() {
Lines 32-36 Link Here
32
        ebegin "Stopping ${RC_SVCNAME}"
65
        ebegin "Stopping ${RC_SVCNAME}"
33
        start-stop-daemon --stop --quiet --pidfile ${pidfile}
66
        start-stop-daemon --stop --quiet --pidfile ${pidfile}
34
        eend ${?}
67
        eend ${?}
68
69
	# To assist troubleshooting (e.g., starting from shell using
70
	# 'fetchmail -v -f $rcfile'), we do the courtesy of changing
71
	# $rcfile's owner.
72
	if checkconfig quiet ; then
73
		chown root:root $rcfile
74
		chmod 0700 $rcfile
75
	fi
35
}
76
}
36
77

Return to bug 387009