aboutsummaryrefslogtreecommitdiffstats
path: root/community/cachefilesd/cachefilesd.initd
diff options
context:
space:
mode:
authorFrancesco Colista <fcolista@alpinelinux.org>2016-08-25 07:52:52 +0000
committerFrancesco Colista <fcolista@alpinelinux.org>2016-08-25 07:55:48 +0000
commitbe96b6bf8a3c73b9972a3a5bedf15b303ac05d93 (patch)
tree8ba945b5d77a348821f7599de76d4a802368bef3 /community/cachefilesd/cachefilesd.initd
parent3f23a4137b928c5ea363afd39af52af49eacb5ce (diff)
downloadaports-be96b6bf8a3c73b9972a3a5bedf15b303ac05d93.tar.bz2
aports-be96b6bf8a3c73b9972a3a5bedf15b303ac05d93.tar.xz
community/cachefilesd: moved from testing, upgrade to 0.10.9
Diffstat (limited to 'community/cachefilesd/cachefilesd.initd')
-rw-r--r--community/cachefilesd/cachefilesd.initd53
1 files changed, 53 insertions, 0 deletions
diff --git a/community/cachefilesd/cachefilesd.initd b/community/cachefilesd/cachefilesd.initd
new file mode 100644
index 0000000000..589faa7d57
--- /dev/null
+++ b/community/cachefilesd/cachefilesd.initd
@@ -0,0 +1,53 @@
+#!/sbin/openrc-run
+# 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.2 2010/09/20 08:45:22 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 "
+ 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 /usr/bin/cachefilesd -- ${OPTIONS}
+ eend $? "Failed to start cachefilesd. Check the system log to see the error"
+
+}
+
+stop() {
+ ebegin "Stopping cachefilesd"
+ start-stop-daemon --stop --exec /usr/bin/cachefilesd --pidfile /var/run/cachefilesd.pid
+ eend $? "Failed to stop cachefilesd"
+}
+
+