#!/sbin/runscript # Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/sys-fs/cachefilesd/cachefilesd/files/cachefilesd.rc ,v 1.0 2000/11/10 18:45:10 [Enrico] Exp $ depend() { need localmount } checkxattr() { #it is fixed for now but it can be easly get from the config file testpath="/var/fscache" local testfile="${testpath}/xattr-test" touch ${testfile} #creates a file in the testpath and tries to set an attribute on it to check if the support is avaible attr -s test -V xattr ${testfile} > /dev/null local ret=$? [ ${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 einfo "/dev/cachefiles doesn't exist, trying to modprobe cachefiles" modprobe cachefiles local ret=$? [ $ret -ne "0" ] && eerror "cachefiles modules cannot be loaded so cachefilesd cannot be started, aborting. \nDid you build fscache in your kernel?\nNote that you need a 2.6.30 or better kernel" && return $ret fi start-stop-daemon --start --exec /sbin/cachefilesd --pidfile /var/run/cachefilesd.pid eend $? "Failed to start cachefilesd. grep cachefilesd /var/log/message 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" }