jlec        14/08/22 13:41:39

  Added:                cachefilesd-tmpfiles.d cachefilesd-3.init
  Log:
  sys-fs/cachefilesd: Create cache dir on runtime, #520500
  
  (Portage version: 2.2.12/cvs/Linux x86_64, signed Manifest commit with key 
B9D4F231BD1558AB!)

Revision  Changes    Path
1.1                  sys-fs/cachefilesd/files/cachefilesd-tmpfiles.d

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-fs/cachefilesd/files/cachefilesd-tmpfiles.d?rev=1.1&view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-fs/cachefilesd/files/cachefilesd-tmpfiles.d?rev=1.1&content-type=text/plain

Index: cachefilesd-tmpfiles.d
===================================================================
d /var/cache/fscache 0755 - - -



1.1                  sys-fs/cachefilesd/files/cachefilesd-3.init

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-fs/cachefilesd/files/cachefilesd-3.init?rev=1.1&view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-fs/cachefilesd/files/cachefilesd-3.init?rev=1.1&content-type=text/plain

Index: cachefilesd-3.init
===================================================================
#!/sbin/runscript
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: 
/var/cvsroot/gentoo-x86/sys-fs/cachefilesd/files/cachefilesd-3.init,v 1.1 
2014/08/22 13:41:39 jlec Exp $

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)
        checkpath -d "${testpath}"
        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 /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 
/run/cachefilesd.pid
        eend $? "Failed to stop cachefilesd"
}





Reply via email to