summaryrefslogtreecommitdiff
path: root/sys-fs
diff options
context:
space:
mode:
authorJustin Lecher <jlec@gentoo.org>2014-08-22 13:41:39 +0000
committerJustin Lecher <jlec@gentoo.org>2014-08-22 13:41:39 +0000
commit360c37c35a3defb8405fb06dabb084385d7d8f5f (patch)
tree01516073e2f7d1bd57e9fac3199624dc85f0602a /sys-fs
parentold (diff)
downloadgentoo-2-360c37c35a3defb8405fb06dabb084385d7d8f5f.tar.gz
gentoo-2-360c37c35a3defb8405fb06dabb084385d7d8f5f.tar.bz2
gentoo-2-360c37c35a3defb8405fb06dabb084385d7d8f5f.zip
sys-fs/cachefilesd: Create cache dir on runtime, #520500
(Portage version: 2.2.12/cvs/Linux x86_64, signed Manifest commit with key B9D4F231BD1558AB!)
Diffstat (limited to 'sys-fs')
-rw-r--r--sys-fs/cachefilesd/ChangeLog8
-rw-r--r--sys-fs/cachefilesd/cachefilesd-0.10.5-r4.ebuild57
-rw-r--r--sys-fs/cachefilesd/files/cachefilesd-3.init56
-rw-r--r--sys-fs/cachefilesd/files/cachefilesd-tmpfiles.d1
4 files changed, 121 insertions, 1 deletions
diff --git a/sys-fs/cachefilesd/ChangeLog b/sys-fs/cachefilesd/ChangeLog
index 842fc2d786dc..06988f981dfd 100644
--- a/sys-fs/cachefilesd/ChangeLog
+++ b/sys-fs/cachefilesd/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for sys-fs/cachefilesd
# Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-fs/cachefilesd/ChangeLog,v 1.12 2014/06/08 13:13:23 swift Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-fs/cachefilesd/ChangeLog,v 1.13 2014/08/22 13:41:39 jlec Exp $
+
+*cachefilesd-0.10.5-r4 (22 Aug 2014)
+
+ 22 Aug 2014; Justin Lecher <jlec@gentoo.org> +cachefilesd-0.10.5-r4.ebuild,
+ +files/cachefilesd-3.init, +files/cachefilesd-tmpfiles.d:
+ Create cache dir on runtime, #520500
*cachefilesd-0.10.5-r3 (08 Jun 2014)
diff --git a/sys-fs/cachefilesd/cachefilesd-0.10.5-r4.ebuild b/sys-fs/cachefilesd/cachefilesd-0.10.5-r4.ebuild
new file mode 100644
index 000000000000..b67dab943990
--- /dev/null
+++ b/sys-fs/cachefilesd/cachefilesd-0.10.5-r4.ebuild
@@ -0,0 +1,57 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-fs/cachefilesd/cachefilesd-0.10.5-r4.ebuild,v 1.1 2014/08/22 13:41:39 jlec Exp $
+
+EAPI=5
+
+inherit eutils flag-o-matic systemd toolchain-funcs
+
+DESCRIPTION="Provides a caching directory on an already mounted filesystem"
+HOMEPAGE="http://people.redhat.com/~dhowells/fscache/"
+SRC_URI="http://people.redhat.com/~dhowells/fscache/${P}.tar.bz2 -> ${P}.tar"
+
+SLOT="0"
+LICENSE="GPL-2"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc selinux"
+
+DEPEND="selinux? ( sec-policy/selinux-cachefilesd )"
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+ epatch "${FILESDIR}"/0.10.4-makefile.patch
+ tc-export CC
+ if ! use selinux; then
+ sed -e '/^secctx/s:^:#:g' -i cachefilesd.conf || die
+ fi
+
+ append-flags -fpie
+}
+
+src_install() {
+ default
+
+ if use selinux; then
+ insinto /usr/share/doc/${P}
+ doins -r selinux
+ fi
+
+ dodoc howto.txt
+
+ newconfd "${FILESDIR}"/cachefilesd.conf ${PN}
+ newinitd "${FILESDIR}"/cachefilesd-3.init ${PN}
+
+ systemd_dounit ${PN}.service
+ systemd_newtmpfilesd "${FILESDIR}"/${PN}-tmpfiles.d ${PN}.conf
+}
+
+pkg_postinst() {
+ [[ -d /var/cache/fscache ]] && return
+ elog "Before CacheFiles can be used, a directory for local storage"
+ elog "must be created. The default configuration of /etc/cachefilesd.conf"
+ elog "uses /var/cache/fscache. The filesystem mounted there must support"
+ elog "extended attributes (mount -o user_xattr)."
+ echo ""
+ elog "Once that is taken care of, start the daemon, add -o ...,fsc"
+ elog "to the mount options of your network mounts, and let it fly!"
+}
diff --git a/sys-fs/cachefilesd/files/cachefilesd-3.init b/sys-fs/cachefilesd/files/cachefilesd-3.init
new file mode 100644
index 000000000000..f076c39bab64
--- /dev/null
+++ b/sys-fs/cachefilesd/files/cachefilesd-3.init
@@ -0,0 +1,56 @@
+#!/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"
+}
+
diff --git a/sys-fs/cachefilesd/files/cachefilesd-tmpfiles.d b/sys-fs/cachefilesd/files/cachefilesd-tmpfiles.d
new file mode 100644
index 000000000000..11da15afd7f0
--- /dev/null
+++ b/sys-fs/cachefilesd/files/cachefilesd-tmpfiles.d
@@ -0,0 +1 @@
+d /var/cache/fscache 0755 - - -