blob: afc7fc5a0ab63f516a3b1d6305473ec69b2fdec3 (
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
|
#!/sbin/runscript
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
depend() {
need localmount
use logger
before nfsmount
}
checkxattr() {
local testpath testfile ret
# SELinux requires xattrs, so we can assume things work already
[ -f /sys/fs/selinux/status ] && return 0;
testpath=$(awk '/^[[:space:]]*dir/ {print $2}' /etc/cachefilesd.conf)
testfile="${testpath}/.tmp-xattr-test.cachefilesd"
touch "${testfile}"
# creates a file in the testpath and tries to set an attribute on it to check
# if the support is available
attr -s test -V xattr "${testfile}" 2>&1 > /dev/null
ret=$?
rm -f "${testfile}"
[ ${ret} -ne 0 ] && eerror "xattr support missing on the ${testpath} filesystem"
return ${ret}
}
start() {
ebegin "Starting cachefilesd"
checkxattr || return $?
# check if the cachefiles modules is loaded (or builtin)
if [ ! -c /dev/cachefiles ] ; then
local ret
einfo "/dev/cachefiles doesn't exist, trying to modprobe cachefiles"
modprobe cachefiles
ret=$?
if [ $ret -ne 0 ] ; then
eerror "cachefiles modules cannot be loaded so cachefilesd "
eerror "cannot be started, aborting. Did you build fscache in your "
eerror "kernel? Note that you need a 2.6.30 or better kernel"
return $ret
fi
fi
start-stop-daemon --start --pidfile /var/run/cachefilesd.pid --exec /sbin/cachefilesd -- ${OPTIONS}
eend $? "Failed to start cachefilesd. Check the system log to see the error"
}
stop() {
ebegin "Stopping cachefilesd"
start-stop-daemon --stop --exec /sbin/cachefilesd --pidfile /var/run/cachefilesd.pid
eend $? "Failed to stop cachefilesd"
}
|