diff options
author | Justin Lecher <jlec@gentoo.org> | 2010-09-19 08:08:16 +0000 |
---|---|---|
committer | Justin Lecher <jlec@gentoo.org> | 2010-09-19 08:08:16 +0000 |
commit | ff67e41700ffa4d8289dbd92345f232c2571e245 (patch) | |
tree | ade222643d504f71bee54be289b9b221b3d84cb7 /sys-fs/cachefilesd/files/cachefilesd.init | |
parent | Version bump. (diff) | |
download | gentoo-2-ff67e41700ffa4d8289dbd92345f232c2571e245.tar.gz gentoo-2-ff67e41700ffa4d8289dbd92345f232c2571e245.tar.bz2 gentoo-2-ff67e41700ffa4d8289dbd92345f232c2571e245.zip |
New addition, 275014; thanks Bruno Redondi and everyone else for the contribution
(Portage version: 2.2_rc83/cvs/Linux x86_64)
Diffstat (limited to 'sys-fs/cachefilesd/files/cachefilesd.init')
-rw-r--r-- | sys-fs/cachefilesd/files/cachefilesd.init | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/sys-fs/cachefilesd/files/cachefilesd.init b/sys-fs/cachefilesd/files/cachefilesd.init new file mode 100644 index 000000000000..6c934b06d029 --- /dev/null +++ b/sys-fs/cachefilesd/files/cachefilesd.init @@ -0,0 +1,52 @@ +#!/sbin/runscript +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/cachefilesd/files/cachefilesd.init,v 1.1 2010/09/19 08:08:16 jlec Exp $ + +depend() { + need localmount + use logger + before nfsmount +} + +checkxattr() { + local testpath testfile ret + 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 " + error "cannot be started, aborting. Did you build fscache in your " + error "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" +} + |