1 |
swift 14/06/08 13:13:23 |
2 |
|
3 |
Added: cachefilesd-2.init |
4 |
Log: |
5 |
Fix bug #509708 - Update cachefilesd init script to handle SELinux support |
6 |
|
7 |
(Portage version: 2.2.8-r1/cvs/Linux x86_64, signed Manifest commit with key 0x2EDD52403B68AF47) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 sys-fs/cachefilesd/files/cachefilesd-2.init |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-fs/cachefilesd/files/cachefilesd-2.init?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-fs/cachefilesd/files/cachefilesd-2.init?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: cachefilesd-2.init |
16 |
=================================================================== |
17 |
#!/sbin/runscript |
18 |
# Copyright 1999-2014 Gentoo Foundation |
19 |
# Distributed under the terms of the GNU General Public License v2 |
20 |
# $Header: /var/cvsroot/gentoo-x86/sys-fs/cachefilesd/files/cachefilesd-2.init,v 1.1 2014/06/08 13:13:23 swift Exp $ |
21 |
|
22 |
depend() { |
23 |
need localmount |
24 |
use logger |
25 |
before nfsmount |
26 |
} |
27 |
|
28 |
checkxattr() { |
29 |
local testpath testfile ret |
30 |
# SELinux requires xattrs, so we can assume things work already |
31 |
[ -f /sys/fs/selinux/status ] && return 0; |
32 |
testpath=$(awk '/^[[:space:]]*dir/ {print $2}' /etc/cachefilesd.conf) |
33 |
testfile="${testpath}/.tmp-xattr-test.cachefilesd" |
34 |
touch "${testfile}" |
35 |
# creates a file in the testpath and tries to set an attribute on it to check |
36 |
# if the support is available |
37 |
attr -s test -V xattr "${testfile}" 2>&1 > /dev/null |
38 |
ret=$? |
39 |
rm -f "${testfile}" |
40 |
[ ${ret} -ne 0 ] && eerror "xattr support missing on the ${testpath} filesystem" |
41 |
return ${ret} |
42 |
} |
43 |
|
44 |
start() { |
45 |
ebegin "Starting cachefilesd" |
46 |
checkxattr || return $? |
47 |
# check if the cachefiles modules is loaded (or builtin) |
48 |
if [ ! -c /dev/cachefiles ] ; then |
49 |
local ret |
50 |
einfo "/dev/cachefiles doesn't exist, trying to modprobe cachefiles" |
51 |
modprobe cachefiles |
52 |
ret=$? |
53 |
if [ $ret -ne 0 ] ; then |
54 |
eerror "cachefiles modules cannot be loaded so cachefilesd " |
55 |
eerror "cannot be started, aborting. Did you build fscache in your " |
56 |
eerror "kernel? Note that you need a 2.6.30 or better kernel" |
57 |
return $ret |
58 |
fi |
59 |
fi |
60 |
start-stop-daemon --start --pidfile /var/run/cachefilesd.pid --exec /sbin/cachefilesd -- ${OPTIONS} |
61 |
eend $? "Failed to start cachefilesd. Check the system log to see the error" |
62 |
|
63 |
} |
64 |
|
65 |
stop() { |
66 |
ebegin "Stopping cachefilesd" |
67 |
start-stop-daemon --stop --exec /sbin/cachefilesd --pidfile /var/run/cachefilesd.pid |
68 |
eend $? "Failed to stop cachefilesd" |
69 |
} |