summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Fabbro <bicatali@gentoo.org>2012-10-30 14:44:27 +0000
committerSebastien Fabbro <bicatali@gentoo.org>2012-10-30 14:44:27 +0000
commit6f66f0e44f308940f0d91db13132f064e93dccd9 (patch)
tree38801cd69dbd7243401b1b317fd6c2ec19735e7f /net-fs/cvmfs
parentMask only sys-fs/redirfs live version (diff)
downloadgentoo-2-6f66f0e44f308940f0d91db13132f064e93dccd9.tar.gz
gentoo-2-6f66f0e44f308940f0d91db13132f064e93dccd9.tar.bz2
gentoo-2-6f66f0e44f308940f0d91db13132f064e93dccd9.zip
Import from science overlay, version bump
(Portage version: 2.2.0_alpha141/cvs/Linux x86_64, signed Manifest commit with key 0x13CB1360)
Diffstat (limited to 'net-fs/cvmfs')
-rw-r--r--net-fs/cvmfs/ChangeLog25
-rw-r--r--net-fs/cvmfs/Manifest11
-rw-r--r--net-fs/cvmfs/cvmfs-2.0.19.ebuild126
-rw-r--r--net-fs/cvmfs/files/cvmfs-2.0.19-autotools.patch194
-rw-r--r--net-fs/cvmfs/files/cvmfs-2.0.19-no-redhat-init.patch22
-rw-r--r--net-fs/cvmfs/files/cvmfs-2.0.19-openrc.patch82
-rw-r--r--net-fs/cvmfs/files/cvmfs-2.0.19-spinlock.patch15
-rw-r--r--net-fs/cvmfs/files/cvmfs.initd195
-rw-r--r--net-fs/cvmfs/files/cvmfsd.confd0
-rw-r--r--net-fs/cvmfs/files/cvmfsd.initd191
-rw-r--r--net-fs/cvmfs/metadata.xml22
11 files changed, 883 insertions, 0 deletions
diff --git a/net-fs/cvmfs/ChangeLog b/net-fs/cvmfs/ChangeLog
new file mode 100644
index 000000000000..e11c4158d7ea
--- /dev/null
+++ b/net-fs/cvmfs/ChangeLog
@@ -0,0 +1,25 @@
+# ChangeLog for net-fs/cvmfs
+# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/net-fs/cvmfs/ChangeLog,v 1.1 2012/10/30 14:44:26 bicatali Exp $
+
+*cvmfs-2.0.19 (30 Oct 2012)
+
+ 30 Oct 2012; Sébastien Fabbro <bicatali@gentoo.org> +cvmfs-2.0.19.ebuild,
+ +files/cvmfs-2.0.19-autotools.patch,
+ +files/cvmfs-2.0.19-no-redhat-init.patch, +files/cvmfs-2.0.19-openrc.patch,
+ +files/cvmfs-2.0.19-spinlock.patch, +files/cvmfs.initd, +files/cvmfsd.confd,
+ +files/cvmfsd.initd, +metadata.xml:
+ Import from science overlay, version bump
+
+ 25 Jul 2012; Sébastien Fabbro <bicatali@gentoo.org> cvmfs-2.0.18.ebuild,
+ files/cvmfs-2.0.18-openrc.patch, files/cvmfs.initd:
+ net-fs/cvmfs: fixed client init and setup, added config stage
+
+*cvmfs-2.0.18 (25 Jul 2012)
+
+ 25 Jul 2012; Sébastien Fabbro <bicatali@gentoo.org> +cvmfs-2.0.18.ebuild,
+ +files/cvmfs-2.0.18-autotools.patch, +files/cvmfs-2.0.18-no-redhat-init.patch,
+ +files/cvmfs-2.0.18-openrc.patch, +files/cvmfs-2.0.18-spinlock.patch,
+ +files/cvmfs-2.0.18-system-redirfs.patch, +files/cvmfs.initd,
+ +files/cvmfsd.confd, +files/cvmfsd.initd, +metadata.xml:
+ net-fs/cvmfs: Initial import, need more work
diff --git a/net-fs/cvmfs/Manifest b/net-fs/cvmfs/Manifest
new file mode 100644
index 000000000000..a05bc3c43b57
--- /dev/null
+++ b/net-fs/cvmfs/Manifest
@@ -0,0 +1,11 @@
+AUX cvmfs-2.0.19-autotools.patch 10558 SHA256 bbb55c0aa6a09780fdf3b7aa23e4cccf345cead567adccf0893ef6d288dc8c57 SHA512 fc68a89ca546e6ffe0e8b67669e04a1ec2505af28b8d17e30e8c8c2865f9329a1b60b53febcd994e686d9dc4fbc180d4b06f76a6c79441105f1fd43bed1e0244 WHIRLPOOL 9d521b7ec4c05b279639fb7e07c2b2af89832c4204e4df87168fcda47b280ffdcafd8578569dfce00a70c2e3d69bdce0fb5e7b7e0dcf5b3e5c4c29f165b10c74
+AUX cvmfs-2.0.19-no-redhat-init.patch 1161 SHA256 4878fa936d836a1872a16e40ffc9594221f7e89f1067d982d4ebe80cc353bad2 SHA512 1273b00a5a5e3d83443f663df68e9f10c3398266ed84b1ad9e265f34cdb4f0290c44c3329aa8b0e642dee410ed6e045c5188b2243c97cfd9744c35b83c842142 WHIRLPOOL 97fbfe1a4376bcb7636041d68a6deec9a715ccb82bdfe4f89c76db7f19c8b3f1fe0f99604dafd5e4f8801b32bfb0acf019a488fa88b22cf7605b9da67682b8eb
+AUX cvmfs-2.0.19-openrc.patch 2908 SHA256 c8ba422e9afd4eb1b5cb95317c6fb7735393eeecfb8452d472f347cd57726b89 SHA512 dfa6bfca8b4099f247fdf2f260d3dcc395855d0ed58430044e54d916a688924c95280dea35768f5604608eaa9dc638813ef3f18d1e76177a20dd4d8a7a535b6b WHIRLPOOL fcd6397c1972ce3c17297d24cba58491618490d224131ffbe4b066df4f0369b7a0ec5e6ee358b9af9f461686f4cebf4338cd71e2700601a3fb2407c5d866bce3
+AUX cvmfs-2.0.19-spinlock.patch 613 SHA256 05ed924cdb812f11eb5508c3d14684d56cadc0d5bd12dc55e900f288f8cf9544 SHA512 09e600322d8996ab96b26ab04f1d6183cbcbd7f6458c6457ce2dc3dd48c4a93e134006eb56db38757d26252a3a8b863ae4e3ed92c382b7b5213e08bb0e6d15c7 WHIRLPOOL 4b1695393b85e0f803657db028041124fe69039e67dc49af4bc1e77f014680bf2374f108f786ec1154bf0b0f54367579e26e1ebaa6bc7bcc44cfb37305c4a6aa
+AUX cvmfs.initd 4776 SHA256 e6086a1bf5f1e621208a29979005084e6d58edd3244cfc1c92f1d45e71b3481f SHA512 a6691d40200f3df180b6d55dc8000fb74d603970842a2f164375c66d17ce8c95025a381262146e5f533313efa7b34739de950ee0b92f44f6ea7ef88bc559622b WHIRLPOOL 0f774462b37f45d4de639f5feb7720596a65dfc27bd02d11497c054009ff9b9d2984bf8e44691e39a6176996ac84a86c5c838a287f376af6e7126214d35359dc
+AUX cvmfsd.confd 0 SHA256 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 SHA512 cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e WHIRLPOOL 19fa61d75522a4669b44e39c1d2e1726c530232130d407f89afee0964997f7a73e83be698b288febcf88e3e03c4f0757ea8964e59b63d93708b138cc42a66eb3
+AUX cvmfsd.initd 4566 SHA256 b5cae7c11bc6ef8f36ce49e9c845dc1ee670bbd6b7f9b5e38329b82ca6bb01f0 SHA512 c685bc3af8082b1caa34932c7a982599c29db6f25d43a4b6e96ea54f4791ad7c32e84f4582fba7df111bff4c1584f064e7e3b3bbe373d8dab6138dc5b32ec3a6 WHIRLPOOL 9ec37cf0307a76cffa02e8907db538bf2e50a119183935da2f72b4a2094ac0b400bc0011bc922de8dc7200fd709ed5c252e2294042f2ddfb0f31e3d7a51b3d2e
+DIST cvmfs-2.0.19.tar.gz 7740158 SHA256 a92ff675e16f4766d7108a2d34ccce324d83bdd720262b6574cc90a2510e580c SHA512 4456af5a883de199d8e6b6f5ba5fb25cd25c986677055a22fc1aa1d64e27fdd66ba5b406d2c4a6960af3866dbdf85b57f1ebc1a447dce6ebaca196a21aee95da WHIRLPOOL 621c59bdf52c963d528399a20af5c7c950afb300b0eaeb4dae5c7b3cc83436de897a184fffedd386921f5c84fb075f15dd42f820679d7a473ee6525b884b356f
+EBUILD cvmfs-2.0.19.ebuild 3027 SHA256 313075ea46c30ec4ee9000de1c993a63d5e7d84da4a85dc386b6776025bcdfb4 SHA512 bf91dc5d834a00c4bd6be447e9149af84f3e96f0d47dab1b9fde9ee64ab95826dd7d7cf39efd44158d5c7cde0855890aa136af5549f0a8d8601fee0ae2402739 WHIRLPOOL 34924da69a119ab0b22fadcc9ca0edf7f776e1f23f3fc7b15545c22e2bba6e08899d85782c7d4f1e7f7b1d4d52eac904e87df0fa14f7c862b6d3641121c5ab20
+MISC ChangeLog 1122 SHA256 574c29d72010d5d260f00582a83f03aa0b63147000a5d77b551951ff12f4d7a4 SHA512 3e87ef9bd6300d4c61902218c5f6d6020b8b3cd8fe298853a24b78e9d41137543e5ad4e2f6c1e5ff1904268eda288ccf5a907f486c04861167321d583a4e94a8 WHIRLPOOL 93b55f9c4a85f2236b3ed664ef026bcb050c08fc7285f308273934c650a206e62b4b8828e7649b0fe715c7f456a8535116cb0e3fbc900ff4c09849ba6412f3c2
+MISC metadata.xml 962 SHA256 8e663c6e3488bdb8cf49d7a3f03549fe093597522e25dd61a4cdde390ccc0091 SHA512 ad7ae2a380fabb7a3d65d04318e084f2e19310e6a4c22abf2f23ecf90cffd8be762fc93e26e3f4d7ddd05a168baca4cf903d7bff7f87d0dbe7dfc5c57b303b9d WHIRLPOOL bfd28004471a97a1a708ad42b84bd0aad99a9eb94fb200dc39986d3eaacfccf767fda17712533a217e623031dca0f1fb2e5bf3ba2ced122d9014d7cd11c8f7fc
diff --git a/net-fs/cvmfs/cvmfs-2.0.19.ebuild b/net-fs/cvmfs/cvmfs-2.0.19.ebuild
new file mode 100644
index 000000000000..81fe56942afc
--- /dev/null
+++ b/net-fs/cvmfs/cvmfs-2.0.19.ebuild
@@ -0,0 +1,126 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-fs/cvmfs/cvmfs-2.0.19.ebuild,v 1.1 2012/10/30 14:44:26 bicatali Exp $
+
+EAPI=4
+
+inherit eutils autotools toolchain-funcs linux-mod
+
+DESCRIPTION="HTTP read-only file system for distributing software"
+HOMEPAGE="http://cernvm.cern.ch/portal/filesystem"
+SRC_URI="https://ecsft.cern.ch/dist/${PN}/${P}/${P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+
+KEYWORDS="~amd64 ~x86"
+IUSE="+client doc openmp server"
+
+CDEPEND="dev-db/sqlite:3
+ dev-libs/openssl
+ sys-libs/zlib
+ client? (
+ dev-libs/jemalloc
+ net-misc/curl
+ sys-fs/fuse )
+ server? ( >=sys-fs/redirfs-0.10.20120313 )"
+
+RDEPEND="${CDEPEND}
+ client? ( net-fs/autofs )"
+
+DEPEND="${CDEPEND}
+ virtual/pkgconfig
+ doc? ( app-doc/doxygen[dot] )"
+
+# either client or server is required and are mutually exclusive
+REQUIRED_USE="^^ ( client server )"
+
+pkg_setup() {
+ if use server && use openmp && [[ $(tc-getCC) == *gcc* ]] && ! tc-has-openmp
+ then
+ ewarn "You are using a gcc without OpenMP capabilities"
+ die "Need an OpenMP capable compiler"
+ fi
+ if use server; then
+ MODULE_NAMES="cvmfsflt(misc:${S}/kernel/cvmfsflt/src)"
+ BUILD_PARAMS="-C ${KERNEL_DIR} M=${S}/kernel/cvmfsflt/src"
+ BUILD_TARGETS="cvmfsflt.ko"
+ linux-mod_pkg_setup
+ fi
+}
+
+src_prepare() {
+ # "${FILESDIR}"/${P}-system-redirfs.patch \
+ epatch \
+ "${FILESDIR}"/${P}-autotools.patch \
+ "${FILESDIR}"/${P}-no-redhat-init.patch \
+ "${FILESDIR}"/${P}-spinlock.patch \
+ "${FILESDIR}"/${P}-openrc.patch
+ eautoreconf
+}
+
+src_configure() {
+ econf \
+ --disable-sqlite3-builtin \
+ --disable-libcurl-builtin \
+ --disable-zlib-builtin \
+ --disable-jemalloc-builtin \
+ $(use_enable client cvmfs) \
+ $(use_enable client mount-scripts) \
+ $(use_enable openmp) \
+ $(use_enable server)
+}
+
+src_compile() {
+ emake
+ if use server; then
+ ln -s "${EROOT}"/usr/include/redirfs.h "${S}"/kernel/cvmfsflt/src
+ linux-mod_src_compile
+ fi
+ use doc && doxygen doc/cvmfs.doxy
+}
+
+src_install() {
+ default
+ # NEWS file is empty
+ rm "${ED}"/usr/share/doc/${PF}/{INSTALL,NEWS,COPYING}
+
+ use client && newinitd "${FILESDIR}"/${PN}.initd ${PN}
+ if use server; then
+ linux-mod_src_install
+ newinitd "${FILESDIR}"/${PN}d.initd ${PN}d
+ newconfd "${FILESDIR}"/${PN}d.confd ${PN}d
+ fi
+ use doc && dohtml -r doc/html/*
+}
+
+pkg_preinst() {
+ use server && linux-mod_pkg_preinst
+}
+
+pkg_postinst() {
+ use server && linux-mod_pkg_postinst
+}
+
+pkg_postrm() {
+ use server && linux-mod_pkg_postrm
+}
+
+pkg_config() {
+ if use client; then
+ einfo "Setting up CernVM-FS client"
+ cvmfs_config setup
+ cat > "${EROOT}"/etc/cvmfs/default.local <<-EOF
+ # Repositories to fetch example is for ATLAS
+ CVMFS_REPOSITORIES=atlas.cern.ch,atlas-condb.cern.ch,grid.cern.ch
+ # Local proxy settings, ex: http://cernvm.cern.ch/config/proxy.cgi
+ CVMFS_HTTP_PROXY="DIRECT"
+ # Where to keep the cvmfs cache
+ CVMFS_CACHE_BASE=${EROOT}/var/scratch/cvmfs
+ # Quota limit in Mb
+ CVMFS_QUOTA_LIMIT=10000
+ EOF
+ einfo "Now edit ${EROOT}/etc/cvmfs/default.local and run"
+ einfo " ${EROOT}/usr/init.d/cvmfs restart"
+ fi
+}
diff --git a/net-fs/cvmfs/files/cvmfs-2.0.19-autotools.patch b/net-fs/cvmfs/files/cvmfs-2.0.19-autotools.patch
new file mode 100644
index 000000000000..74ba5f2c83a7
--- /dev/null
+++ b/net-fs/cvmfs/files/cvmfs-2.0.19-autotools.patch
@@ -0,0 +1,194 @@
+Patch for various autotools fixes:
+* cleaner enable/disable functions
+* allow to build against system jemalloc
+* adapated to newer autoconf with standard macros
+* use LDADD instead of LDFLAGS to respect user's flags
+
+bicatali@gentoo.org 07/2012
+
+diff -Nur cvmfs-2.0.19.orig/configure.ac cvmfs-2.0.19/configure.ac
+--- cvmfs-2.0.19.orig/configure.ac 2012-07-24 17:54:17.000000000 +0100
++++ cvmfs-2.0.19/configure.ac 2012-10-30 11:00:26.000000000 +0000
+@@ -9,20 +9,22 @@
+ AC_CONFIG_HEADER([config.h])
+ AH_BOTTOM([#define CVMFS_PATCH_LEVEL "0"])
+
+-AC_ARG_ENABLE([cvmfs], AC_HELP_STRING([--disable-cvmfs], [Don't build the CernVM-FS FUSE module]), AC_SUBST([HAVE_CVMFS], [no]))
+-AC_ARG_ENABLE([server], AC_HELP_STRING([--disable-server], [Don't build writer's end programs]), AC_SUBST([HAVE_SERVER], [no]))
+-AC_ARG_ENABLE([sqlite3-builtin], AC_HELP_STRING([--enable-sqlite3-builtin], [Don't use system SQLite3]), AC_SUBST([USE_BUILTIN_SQLITE3], [yes]))
+-AC_ARG_ENABLE([libcurl-builtin], AC_HELP_STRING([--enable-libcurl-builtin], [Don't use system libcurl]), AC_SUBST([USE_BUILTIN_LIBCURL], [yes]))
++AC_ARG_ENABLE([cvmfs], AC_HELP_STRING([--disable-cvmfs], [Don't build the CernVM-FS FUSE module]), AC_SUBST([HAVE_CVMFS], [$enableval]),AC_SUBST([HAVE_CVMFS], [yes]))
++AC_ARG_ENABLE([server], AC_HELP_STRING([--disable-server], [Don't build writer's end programs]), AC_SUBST([HAVE_SERVER], [$enableval]),AC_SUBST([HAVE_SERVER], [yes]))
++AC_ARG_ENABLE([sqlite3-builtin], AC_HELP_STRING([--enable-sqlite3-builtin], [Don't use system SQLite3]), AC_SUBST([USE_BUILTIN_SQLITE3], [$enableval]),AC_SUBST([USE_BUILTIN_SQLITE3], [no]))
++AC_ARG_ENABLE([libcurl-builtin], AC_HELP_STRING([--enable-libcurl-builtin], [Don't use system libcurl]), AC_SUBST([USE_BUILTIN_LIBCURL], [$enableval]),AC_SUBST([USE_BUILTIN_LIBCURL], [no]))
+ dnl AC_ARG_ENABLE([libfuse-builtin], AC_HELP_STRING([--enable-libfuse-builtin], [Don't use system libfuse]), AC_SUBST([USE_BUILTIN_LIBFUSE], [yes]))
+-AC_ARG_ENABLE([zlib-builtin], AC_HELP_STRING([--enable-zlib-builtin], [Don't use system]), AC_SUBST([USE_BUILTIN_ZLIB], [yes]))
+-AC_ARG_ENABLE([kernel-module], AC_HELP_STRING([--enable-kernel-module], [Build the kernel module for the server part]), AC_SUBST([HAVE_KMODULE], [yes]))
+-AC_ARG_ENABLE([mount-scripts], AC_HELP_STRING([--enable-mount-scripts], [Install CernVM-FS mount tools in /etc and /sbin]), AC_SUBST([HAVE_MOUNTSCRIPTS], [yes]))
++AC_ARG_ENABLE([zlib-builtin], AC_HELP_STRING([--enable-zlib-builtin], [Don't use system]), AC_SUBST([USE_BUILTIN_ZLIB], [$enableval]),AC_SUBST([USE_BUILTIN_ZLIB], [no]))
++AC_ARG_ENABLE([jemalloc-builtin], AC_HELP_STRING([--enable-jemalloc-builtin], [Don't use system jemalloc]), AC_SUBST([USE_BUILTIN_JEMALLOC], [$enableval]),AC_SUBST([USE_BUILTIN_JEMALLOC], [no]))
++AC_ARG_ENABLE([kernel-module], AC_HELP_STRING([--enable-kernel-module], [Build the kernel module for the server part]), AC_SUBST([HAVE_KMODULE], [$enableval]),AC_SUBST([HAVE_KMODULE], [no]))
++AC_ARG_ENABLE([mount-scripts], AC_HELP_STRING([--enable-mount-scripts], [Install CernVM-FS mount tools in /etc and /sbin]), AC_SUBST([HAVE_MOUNTSCRIPTS], [$enableval]),AC_SUBST([HAVE_MOUNTSCRIPTS], [no]))
+ AM_CONDITIONAL([BUILD_CVMFS], [test x$HAVE_CVMFS != xno])
+ AM_CONDITIONAL([BUILD_SERVER], [test x$HAVE_SERVER != xno])
+ AM_CONDITIONAL([SYSTEM_SQLITE3], [test x$USE_BUILTIN_SQLITE3 != xyes])
+ AM_CONDITIONAL([SYSTEM_LIBCURL], [test x$USE_BUILTIN_LIBCURL != xyes])
+ AM_CONDITIONAL([SYSTEM_LIBFUSE], [test x != x])
+ AM_CONDITIONAL([SYSTEM_ZLIB], [test x$USE_BUILTIN_ZLIB != xyes])
++AM_CONDITIONAL([SYSTEM_JEMALLOC], [test x$USE_BUILTIN_JEMALLOC != xyes])
+ AM_CONDITIONAL([BUILD_KMODULE], [test x$HAVE_KMODULE == xyes])
+ AM_CONDITIONAL([BUILD_MEMCACHED], [test x$HAVE_MEMCACHED == xyes])
+ AM_CONDITIONAL([BUILD_MOUNTSCRIPTS], [test x$HAVE_MOUNTSCRIPTS == xyes])
+@@ -35,6 +37,7 @@
+ dnl AC_PROG_LIBTOOL
+ AC_PROG_MAKE_SET
+ AC_PROG_RANLIB
++m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
+
+ CXXFLAGS="$CXXFLAGS -g -fno-exceptions -fno-strict-aliasing -fasynchronous-unwind-tables -fno-omit-frame-pointer -fno-optimize-sibling-calls -Wall \
+ -D_REENTRANT -D__EXTENSIONS__ -D_LARGEFILE64_SOURCE -D__LARGE64_FILES"
+@@ -70,7 +73,7 @@
+ PKG_CHECK_MODULES([OPENSSL], [libcrypto >= 0.9.7a])
+
+ dnl Get OpenMP Options
+-gt_OPENMP()
++AC_OPENMP
+
+ dnl Checks for libraries.
+ save_LIBS=$LIBS
+@@ -86,6 +89,10 @@
+
+ AC_CHECK_LIB([rt], [sched_yield], ,[AC_MSG_ERROR(librt (Posix real time extensions) required)])
+
++if test x$USE_BUILTIN_JEMALLOC != xyes; then
++ AC_CHECK_LIB([jemalloc], [malloc], ,[AC_MSG_ERROR(jemalloc required)])
++fi
++
+ if test x$HAVE_CVMFS != xno; then
+ dnl if test x$USE_BUILTIN_LIBFUSE != xyes; then
+ dnl AC_CHECK_HEADERS([fuse.h fuse/fuse_opt.h],,[AC_MSG_ERROR(fuse headers required)],[#define _FILE_OFFSET_BITS 64])
+diff -Nur cvmfs-2.0.19.orig/cvmfs/src/Makefile.am cvmfs-2.0.19/cvmfs/src/Makefile.am
+--- cvmfs-2.0.19.orig/cvmfs/src/Makefile.am 2012-07-25 08:17:28.000000000 +0100
++++ cvmfs-2.0.19/cvmfs/src/Makefile.am 2012-10-30 11:08:44.000000000 +0000
+@@ -224,6 +224,11 @@
+ cvmfs_proxy_rtt_LDADD += $(LDFLAGS_ZLIB)
+ endif
+
++if ! SYSTEM_JEMALLOC
++LDFLAGS_JEMALLOC = ../../jemalloc/src/lib/libjemalloc.a
++cvmfs2_debug_LDADD += $(LDFLAGS_JEMALLOC)
++cvmfs2_LDADD += $(LDFLAGS_JEMALLOC)
++endif
+
+ CFLAGS_CVMFS2 =
+ if ! SYSTEM_SQLITE3
+@@ -238,8 +243,8 @@
+ if ! SYSTEM_ZLIB
+ CFLAGS_CVMFS2 += -I../../zlib/src
+ endif
+-cvmfs2_debug_LDADD += ../../jemalloc/src/lib/libjemalloc.a -ldl
+-cvmfs2_LDADD += ../../jemalloc/src/lib/libjemalloc.a -ldl
++
++
+ CFLAGS_CVMFS2 += $(PTHREAD_CFLAGS) $(CURL_CFLAGS) $(SQLITE_CFLAGS) $(OPENSSL_CFLAGS) $(FUSE_CFLAGS) -DCVMFS_CLIENT -DFUSE_CLIENT
+ LDFLAGS_CVMFS2 = $(PTHREAD_CFLAGS) -rdynamic
+ LIBS_CVMFS2 = $(PTHREAD_LIBS) $(CURL_LIBS) $(SQLITE_LIBS) $(FUSE_LIBS) $(Z_LIBS) $(OPENSSL_LIBS) $(CVMFS_LIBS) -lrt
+@@ -291,11 +296,11 @@
+ endif
+ CFLAGS_PROXYRTT += $(CURL_CFLAGS) -DCVMFS_CLIENT -DNDEBUGMSG
+ cvmfs_proxy_rtt_CFLAGS = $(CVMFS_CFLAGS) $(CFLAGS_PROXYRTT)
+-cvmfs_proxy_rtt_LDFLAGS = $(CVMFS_LIBS) $(CURL_LIBS)
++cvmfs_proxy_rtt_LDADD += $(CVMFS_LIBS) $(CURL_LIBS)
+
+
+ testtracer_CXXFLAGS = $(CVMFS_CXXFLAGS) $(PTHREAD_CFLAGS)
+-testtracer_LDFLAGS = $(CVMFS_LIBS) $(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
++testtracer_LDADD += $(CVMFS_LIBS) $(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
+
+ CFLAGS_SYNC =
+ if ! SYSTEM_SQLITE3
+@@ -307,7 +312,7 @@
+ CFLAGS_SYNC += $(PTHREAD_CFLAGS) $(OPENMP_CFLAGS) $(SQLITE_CFLAGS) $(OPENSSL_CFLAGS) -DNDEBUGMSG
+ cvmfs_sync_bin_CXXFLAGS = $(CVMFS_CXXFLAGS) $(CFLAGS_SYNC)
+ cvmfs_sync_bin_CFLAGS = $(CVMFS_CFLAGS) $(CFLAGS_SYNC)
+-cvmfs_sync_bin_LDFLAGS = $(CVMFS_LIBS) $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) $(SQLITE_LIBS) $(OPENSSL_LIBS) $(Z_LIBS) $(GOMP_LIBS)
++cvmfs_sync_bin_LDADD += $(CVMFS_LIBS) $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) $(SQLITE_LIBS) $(OPENSSL_LIBS) $(Z_LIBS) $(GOMP_LIBS)
+
+
+ CFLAGS_CLGCMP =
+@@ -320,7 +325,7 @@
+ CFLAGS_CLGCMP += $(SQLITE_CFLAGS) $(PTHREAD_CFLAGS) $(OPENSSL_CFLAGS) -DNDEBUGMSG
+ cvmfs_clgcmp_CXXFLAGS = $(CVMFS_CXXFLAGS) $(CFLAGS_CLGCMP)
+ cvmfs_clgcmp_CFLAGS = $(CVMFS_CFLAGS) $(CFLAGS_CLGCMP)
+-cvmfs_clgcmp_LDFLAGS = $(CVMFS_LIBS) $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) $(OPENSSL_LIBS) $(SQLITE_LIBS) $(Z_LIBS)
++cvmfs_clgcmp_LDADD += $(CVMFS_LIBS) $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) $(OPENSSL_LIBS) $(SQLITE_LIBS) $(Z_LIBS)
+
+
+ CFLAGS_LSCAT =
+@@ -333,7 +338,7 @@
+ CFLAGS_LSCAT += $(SQLITE_CFLAGS) $(PTHREAD_CFLAGS) $(OPENSSL_CFLAGS) -DNDEBUGMSG
+ cvmfs_lscat_CXXFLAGS = $(CVMFS_CXXFLAGS) $(CFLAGS_LSCAT)
+ cvmfs_lscat_CFLAGS = $(CVMFS_CFLAGS) $(CFLAGS_LSCAT)
+-cvmfs_lscat_LDFLAGS = $(CVMFS_LIBS) $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) $(OPENSSL_LIBS) $(SQLITE_LIBS) $(Z_LIBS)
++cvmfs_lscat_LDADD += $(CVMFS_LIBS) $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) $(OPENSSL_LIBS) $(SQLITE_LIBS) $(Z_LIBS)
+
+ CFLAGS_FIXINODES =
+ if ! SYSTEM_SQLITE3
+@@ -345,7 +350,7 @@
+ CFLAGS_FIXINODES += $(SQLITE_CFLAGS) $(PTHREAD_CFLAGS) $(OPENSSL_CFLAGS) -DNDEBUGMSG
+ cvmfs_fixinodes_CXXFLAGS = $(CVMFS_CXXFLAGS) $(CFLAGS_FIXINODES)
+ cvmfs_fixinodes_CFLAGS = $(CVMFS_CFLAGS) $(CFLAGS_FIXINODES)
+-cvmfs_fixinodes_LDFLAGS = $(CVMFS_LIBS) $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) $(OPENSSL_LIBS) $(SQLITE_LIBS) $(Z_LIBS)
++cvmfs_fixinodes_LDADD += $(CVMFS_LIBS) $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) $(OPENSSL_LIBS) $(SQLITE_LIBS) $(Z_LIBS)
+
+ CFLAGS_SIGN =
+ if ! SYSTEM_ZLIB
+@@ -354,7 +359,7 @@
+ CFLAGS_SIGN += $(SQLITE_CFLAGS) $(PTHREAD_CFLAGS) $(OPENSSL_CFLAGS) -DNDEBUGMSG
+ cvmfs_sign_CXXFLAGS = $(CVMFS_CXXFLAGS) $(CFLAGS_SIGN)
+ cvmfs_sign_CFLAGS = $(CVMFS_CFLAGS) $(CFLAGS_SIGN)
+-cvmfs_sign_LDFLAGS = $(CVMFS_LIBS) $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) $(SQLITE_LIBS) $(Z_LIBS) $(OPENSSL_LIBS)
++cvmfs_sign_LDADD += $(CVMFS_LIBS) $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) $(SQLITE_LIBS) $(Z_LIBS) $(OPENSSL_LIBS)
+
+ CFLAGS_PULL =
+ if ! SYSTEM_SQLITE3
+@@ -369,13 +374,13 @@
+ CFLAGS_PULL += $(SQLITE_CFLAGS) $(PTHREAD_CFLAGS) $(OPENSSL_CFLAGS) -DNDEBUGMSG
+ cvmfs_pull_CXXFLAGS = $(CVMFS_CXXFLAGS) $(CFLAGS_PULL)
+ cvmfs_pull_CFLAGS = $(CVMFS_CFLAGS) $(CFLAGS_PULL)
+-cvmfs_pull_LDFLAGS = $(CVMFS_LIBS) $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) $(OPENSSL_LIBS) $(SQLITE_LIBS) $(Z_LIBS)
++cvmfs_pull_LDADD += $(CVMFS_LIBS) $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) $(OPENSSL_LIBS) $(SQLITE_LIBS) $(Z_LIBS) $(CURL_LIBS)
+
+
+ CFLAGS_SCRUB = $(OPENSSL_CFLAGS) -DNDEBUGMSG
+ cvmfs_scrub_CXXFLAGS = $(CVMFS_CXXFLAGS) $(CFLAGS_SCRUB)
+ cvmfs_scrub_CFLAGS = $(CVMFS_CFLAGS) $(CFLAGS_SCRUB)
+-cvmfs_scrub_LDFLAGS = $(CVMFS_LIBS) $(OPENSSL_LIBS)
++cvmfs_scrub_LDADD += $(CVMFS_LIBS) $(OPENSSL_LIBS)
+
+
+ CFLAGS_ZPIPE =
+@@ -383,4 +388,4 @@
+ CFLAGS_ZPIPE += -I../../zlib/src
+ endif
+ cvmfs_zpipe_CFLAGS = $(CVMFS_CFLAGS) $(CFLAGS_ZPIPE)
+-cvmfs_zpipe_LDFLAGS = $(CVMFS_LIBS) $(Z_LIBS)
++cvmfs_zpipe_LDADD += $(CVMFS_LIBS) $(Z_LIBS)
+diff -Nur cvmfs-2.0.19.orig/Makefile.am cvmfs-2.0.19/Makefile.am
+--- cvmfs-2.0.19.orig/Makefile.am 2012-02-07 17:04:54.000000000 +0000
++++ cvmfs-2.0.19/Makefile.am 2012-10-30 11:00:26.000000000 +0000
+@@ -10,10 +10,13 @@
+ if ! SYSTEM_ZLIB
+ SUBDIR_ZLIB = zlib
+ endif
++if ! SYSTEM_JEMALLOC
++ SUBDIR_JEMALLOC = jemalloc
++endif
+ if BUILD_KMODULE
+ SUBDIR_KMODULE = kernel
+ endif
+-SUBDIRS = $(SUBDIR_KMODULE) $(SUBDIR_SQLITE3) $(SUBDIR_ZLIB) $(SUBDIR_LIBCURL) $(SUBDIR_LIBFUSE) jemalloc cvmfs cvmfsd mount replica
++SUBDIRS = $(SUBDIR_KMODULE) $(SUBDIR_SQLITE3) $(SUBDIR_ZLIB) $(SUBDIR_LIBCURL) $(SUBDIR_LIBFUSE) $(SUBDIR_JEMALLOC) cvmfs cvmfsd mount replica
+ EXTRA_DIST = sign-whitelist add-ons rpm doc c-ares libcurl libfuse kernel jemalloc zlib mount replica
+ docdir = ${datadir}/doc/${PACKAGE}-${VERSION}
+ dist_doc_DATA = NEWS README ChangeLog AUTHORS INSTALL COPYING FAQ
diff --git a/net-fs/cvmfs/files/cvmfs-2.0.19-no-redhat-init.patch b/net-fs/cvmfs/files/cvmfs-2.0.19-no-redhat-init.patch
new file mode 100644
index 000000000000..12593f78e603
--- /dev/null
+++ b/net-fs/cvmfs/files/cvmfs-2.0.19-no-redhat-init.patch
@@ -0,0 +1,22 @@
+* Avoid forcing install of fedora/redhat init scripts
+* Add a more general init script to adapt other distributions
+
+bicatali@gentoo.org 07/2012
+
+--- cvmfs-2.0.19.orig/mount/Makefile.am
++++ cvmfs-2.0.19/mount/Makefile.am
+@@ -2,14 +2,12 @@
+ install-exec-hook:
+ test -z "$(DESTDIR)/etc" || mkdir -p "$(DESTDIR)/etc"
+ test -z "$(DESTDIR)/sbin" || mkdir -p "$(DESTDIR)/sbin"
+- test -z "$(DESTDIR)/etc/rc.d/init.d" || mkdir -p "$(DESTDIR)/etc/rc.d/init.d"
+ test -z "$(DESTDIR)/etc/cvmfs" || mkdir -p "$(DESTDIR)/etc/cvmfs"
+ test -z "$(DESTDIR)/etc/cvmfs/config.d" || mkdir -p "$(DESTDIR)/etc/cvmfs/config.d"
+ test -z "$(DESTDIR)/etc/cvmfs/domain.d" || mkdir -p "$(DESTDIR)/etc/cvmfs/domain.d"
+ test -z "$(DESTDIR)/etc/cvmfs/keys" || mkdir -p "$(DESTDIR)/etc/cvmfs/keys"
+ install -c auto.cvmfs "$(DESTDIR)/etc/auto.cvmfs"
+ install -c mount.cvmfs "$(DESTDIR)/sbin/mount.cvmfs"
+- install -c cvmfs.initd "$(DESTDIR)/etc/rc.d/init.d/cvmfs"
+ install -c -m 0644 config.sh "$(DESTDIR)/etc/cvmfs/config.sh"
+ install -c -m 0644 default.conf "$(DESTDIR)/etc/cvmfs/default.conf"
+ install -c -m 0644 domain.d/cern.ch.conf "$(DESTDIR)/etc/cvmfs/domain.d/cern.ch.conf"
diff --git a/net-fs/cvmfs/files/cvmfs-2.0.19-openrc.patch b/net-fs/cvmfs/files/cvmfs-2.0.19-openrc.patch
new file mode 100644
index 000000000000..a2abd87cd839
--- /dev/null
+++ b/net-fs/cvmfs/files/cvmfs-2.0.19-openrc.patch
@@ -0,0 +1,82 @@
+diff -Nur cvmfs-2.0.19.orig/cvmfs/src/cvmfs_config cvmfs-2.0.19/cvmfs/src/cvmfs_config
+--- cvmfs-2.0.19.orig/cvmfs/src/cvmfs_config 2012-05-05 15:16:19.000000000 +0100
++++ cvmfs-2.0.19/cvmfs/src/cvmfs_config 2012-07-23 23:16:06.000000000 +0100
+@@ -16,9 +16,15 @@
+
+ if [ -x /sbin/service ]; then
+ service="/sbin/service"
+-else
++ chkconfig="/sbin/chkconfig"
++elif [ -x /usr/sbin/service ]; then
+ # Ubuntu
+ service="/usr/sbin/service"
++ chkconfig="/usr/sbin/chkconfig"
++elif [ -x /sbin/rc-service ]; then
++ # OpenRC
++ service="/sbin/rc-service"
++ chkconfig="/usr/bin/rc-config"
+ fi
+
+ var_list="CVMFS_USER CVMFS_NFILES CVMFS_CACHE_BASE CVMFS_MOUNT_DIR CVMFS_QUOTA_LIMIT \
+@@ -116,9 +122,9 @@
+ fi
+
+ if [ $noservice -eq 0 ]; then
+- /sbin/chkconfig --list cvmfs > /dev/null 2>&1
++ $chkconfig --list cvmfs > /dev/null 2>&1
+ if [ $? -ne 0 ]; then
+- /sbin/chkconfig --add cvmfs
++ $chkconfig --add cvmfs
+ fi
+ fi
+
+@@ -580,8 +586,8 @@
+ for cmd in 'uname -a' 'cat /etc/issue' 'hostname -f' 'ifconfig -a' 'cvmfs2 --version' \
+ 'grep cvmfs2 /var/log/messages' 'grep cvmfs2 /var/log/syslog' \
+ "eval find ${CVMFS_CACHE_BASE} -maxdepth 1 -exec ls -lah \{\} \;" \
+- 'service cvmfs probe' 'mount' 'df -h' 'ps -ef' \
+- 'service cvmfs status' 'cvmfs_config showconfig' \
++ "${service}\ cvmfs\ probe" 'mount' 'df -h' 'ps -ef' \
++ "${service}\ cvmfs\ status" 'cvmfs_config showconfig' \
+ 'cvmfs_config chksetup' 'cvmfs_config stat -v' \
+ 'cat /etc/fuse.conf' 'ls -la /usr/bin/fusermount' 'ls -la /bin/fusermount' \
+ 'cat /etc/auto.master' 'cat /etc/sysconfig/autofs' 'cat /etc/fstab'
+diff -Nur cvmfs-2.0.19.orig/cvmfs/src/cvmfs_server cvmfs-2.0.19/cvmfs/src/cvmfs_server
+--- cvmfs-2.0.19.orig/cvmfs/src/cvmfs_server 2011-11-30 11:26:55.000000000 +0000
++++ cvmfs-2.0.19/cvmfs/src/cvmfs_server 2012-07-23 23:31:32.000000000 +0100
+@@ -1,5 +1,13 @@
+ #!/bin/bash
+
++service=$(type -P service)
++chconfig=$(type -P chkconfig)
++if [ -n ${service} ]; then
++ # OpenRC
++ service="rc-service"
++ chkconfig="echo > /dev/null"
++fi
++
+ create_master_key() {
+ local name; name=$1
+ master_key="/etc/cvmfs/keys/$name.masterkey"
+@@ -161,8 +169,8 @@
+ create_whitelist $name
+
+ echo -n "Starting services... "
+- service cvmfsd start > /dev/null
+- chkconfig cvmfsd on
++ $service cvmfsd start > /dev/null
++ $chkconfig cvmfsd on
+ echo "New CernVM-FS repository for $name" > /cvmfs/${name}/empty
+ usermod -s /bin/bash cvmfs
+ publish $name > /dev/null
+@@ -182,8 +190,8 @@
+
+ echo -n "Stopping services... "
+ usermod -s /sbin/nologin cvmfs
+- service cvmfsd stop > /dev/null
+- chkconfig cvmfsd off
++ $service cvmfsd stop > /dev/null
++ $chkconfig cvmfsd off
+ echo "done"
+
+ echo -n "Unmounting CernVM-FS Area... "
diff --git a/net-fs/cvmfs/files/cvmfs-2.0.19-spinlock.patch b/net-fs/cvmfs/files/cvmfs-2.0.19-spinlock.patch
new file mode 100644
index 000000000000..b3a6bbce3eeb
--- /dev/null
+++ b/net-fs/cvmfs/files/cvmfs-2.0.19-spinlock.patch
@@ -0,0 +1,15 @@
+Use macro since SPIN_LOCK_UNLOCKED has been obsolete in kernel since 2007
+
+bicatali@gentoo.org 07/2012
+
+--- cvmfs-2.0.19.orig/kernel/cvmfsflt/src/cvmfsflt_data.c
++++ cvmfs-2.0.19/kernel/cvmfsflt/src/cvmfsflt_data.c
+@@ -5,7 +5,7 @@
+ int rbuf_head, rbuf_tail; /* Current positions in ring buffer */
+ struct semaphore rbuf_full, rbuf_empty; /* semaphores for producer-consumer synchronization */
+ struct cvmfsflt_logline *ll_current = NULL;
+-static spinlock_t rbuf_wlock = SPIN_LOCK_UNLOCKED;
++DEFINE_SPINLOCK(rbuf_wlock);
+ atomic_t cvmfsflt_noll = ATOMIC_INIT(0); /* number of loglines in the ring buffer */
+
+
diff --git a/net-fs/cvmfs/files/cvmfs.initd b/net-fs/cvmfs/files/cvmfs.initd
new file mode 100644
index 000000000000..75f45b7f1558
--- /dev/null
+++ b/net-fs/cvmfs/files/cvmfs.initd
@@ -0,0 +1,195 @@
+#!/sbin/runscript
+
+extra_commands="probe status"
+extra_started_commands="reload flush restart_clean"
+description="The CernVM-FS init script"
+
+init() {
+ # Initialization, read config
+ [ -x /etc/cernvm/config ] && /etc/cernvm/config
+ if [ -f /etc/cvmfs/config.sh ]; then
+ . /etc/cvmfs/config.sh
+ else
+ exit 1
+ fi
+
+ cvmfs_readconfig
+ [ -f /etc/cernvm/repositories.sh ] && . /etc/cernvm/repositories.sh
+ export LANG=C LC_ALL=C
+ [ -f /etc/cernvm/custom/init.sh ] && . /etc/cernvm/custom/init.sh
+}
+
+depend() {
+ need net fuse autofs
+ after logger
+}
+
+list_mounts() {
+ mount -t fuse | grep "^cvmfs2[[:space:]]"
+}
+
+repository_status() {
+ local fqrn=$1 ret=0 pid
+ if list_mounts | grep ${CVMFS_MOUNT_DIR}/${fqrn} > /dev/null; then
+ pid=$(cvmfs-talk -c "${CVMFS_CACHE_BASE}" -i "${fqrn}" pid)
+ ret=$(echo ${pid} | grep ^[0-9]*$ > /dev/null)
+ if [ ${ret} -eq 0 ]; then
+ einfo "CernVM-FS mounted on ${CVMFS_MOUNT_DIR}/${fqrn} with pid ${pid}"
+ else
+ ewarn "CernVM-FS running with process ${pid}"
+ fi
+ else
+ einfo "CernVM-FS not mounted on ${CVMFS_MOUNT_DIR}/${fqrn}"
+ fi
+ return ${ret}
+}
+
+repository_flush() {
+ local fqrn=$1
+ ebegin "Flushing ${fqrn}"
+ stat ${CVMFS_MOUNT_DIR}/${fqrn}/. > /dev/null 2>&1 && \
+ cvmfs-talk -c "${CVMFS_CACHE_BASE}" -i "${fqrn}" cleanup 0 > /dev/null
+ eend $?
+}
+
+repository_reload() {
+ local fqrn=$1 ret=0 hosts
+ if cvmfs-talk -i ${fqrn} pid > /dev/null 2>&1; then
+ ebegin "Reloading ${fqrn}"
+ [[ $(cvmfs-talk -i ${fqrn} timeout set ${CVMFS_TIMEOUT} ${CVMFS_TIMEOUT_DIRECT} 2>&1) == OK ]]
+ ret=$((ret + $?))
+ [[ $(cvmfs-talk -i ${fqrn} proxy set ${CVMFS_HTTP_PROXY} 2>&1) == OK ]]
+ ret=$((ret + $?))
+ hosts=$(echo ${CVMFS_SERVER_URL} | sed -e "s/@org@/$(cvmfs_getorg ${fqrn})/g" -e "s/@fqrn@/${fqrn}/g")
+ [[ $(cvmfs-talk -i ${fqrn} host set ${hosts} 2>&1) == OK ]]
+ ret=$((ret + $?))
+ [[ $(cvmfs-talk -i ${fqrn} max ttl set ${CVMFS_MAX_TTL:-0} 2>&1) == OK ]]
+ eend $?
+ ret=$((ret + $?))
+ else
+ einfo "${frqn} not mounted"
+ fi
+ return ${ret}
+}
+
+repository_wipe() {
+ local fqrn=$1
+ ebegin "Wiping out ${CVMFS_CACHE_BASE}/${fqrn}"
+ [ ! -d "${CVMFS_CACHE_BASE}/${fqrn}" ] || rm -rf "${CVMFS_CACHE_BASE}/${fqrn}"
+ eend $?
+}
+
+repository_probe() {
+ local fqrn=$1
+ ebegin "Probing ${CVMFS_MOUNT_DIR}/${fqrn}"
+ df -P "${CVMFS_MOUNT_DIR}/${fqrn}" 2>&1 | grep -q ^cvmfs2
+ eend $?
+}
+
+cvmfs_action() {
+ local action=$1 org fqrn
+ for org in ${CVMFS_REPOSITORIES/,/ /}; do
+ case ${org} in
+ none)
+ ;;
+ *)
+ . /etc/cvmfs/config.sh
+ cvmfs_readconfig
+ fqrn=$(cvmfs_mkfqrn ${org})
+ cvmfs_readconfig ${fqrn}
+ [[ $(type -t "${action}") == "function" ]] && ${action} ${fqrn}
+ ;;
+ esac
+ done
+}
+
+start() {
+ ebegin "Starting CernVM-FS"
+ cvmfs_action repository_start
+ eend $?
+}
+
+stop() {
+ local m ret=0
+ # FIXME: do we need to unmount here or?
+ for m in $(list_mounts | awk '{print $3}'); do
+ ebegin "Unmounting ${m}"
+ umount ${m} 2>/dev/null
+ eend $?
+ if [ $? -ne 0 ]; then
+ ret=$((ret + $?))
+ fuser -m -a -v ${m}
+ fi
+ done
+ if [ ${ret} -eq 0 ]; then
+ ebegin "Shutting down CernVM-FS"
+ cvmfs_action repository_stop
+ eend $?
+ ret=$((ret + $?))
+ fi
+ return ${ret}
+}
+
+status() {
+ ebegin "Checking status on CernVM-FS"
+ cvmfs_action repository_status
+
+ local org processed repo ret=0
+
+ for org in ${CVMFS_REPOSITORIES/,/ /}; do
+ case ${org} in
+ none)
+ ;;
+ *)
+ . /etc/cvmfs/config.sh # start with fresh repository_... functions
+ cvmfs_readconfig
+ fqrn=$(cvmfs_mkfqrn ${org})
+ processed="${fqrn} ${processed}"
+ cvmfs_readconfig ${fqrn}
+
+ # in an action?
+ list_mounts | grep ${CVMFS_MOUNT_DIR}/${fqrn} > /dev/null
+ if [ $? -eq 0 ]; then
+ local pid=$(/usr/bin/cvmfs-talk -c "${CVMFS_CACHE_BASE}" -i "${fqrn}" pid)
+ if echo ${pid} | grep ^[0-9]*$ > /dev/null; then
+ einfo "CernVM-FS mounted on ${CVMFS_MOUNT_DIR}/${fqrn} with pid ${pid}"
+ else
+ ret=$((ret + $?))
+ ewarn "CernVM-FS running with process ${pid}"
+ fi
+ else
+ einfo "CernVM-FS not mounted on ${CVMFS_MOUNT_DIR}/${fqrn}"
+ fi
+ ;;
+ esac
+ done
+
+ for repo in $(list_mounts | awk '{print $3}'); do
+ repo=$(basename "${repo}")
+ echo "${processed}" | grep -q "${repo}" || \
+ ewarn "CernVM-FS mounted on ${CVMFS_MOUNT_DIR}/${repo} (not in CVMFS_REPOSITORIES)"
+ done
+ eend ${ret}
+}
+
+flush() {
+ cvmfs_action repository_flush
+}
+
+reload() {
+ cvmfs_action repository_reload
+}
+
+restart_clean() {
+ stop
+ local ret=$?
+ cvmfs_action repository_wipe
+ ret=$((ret + $?))
+ [[ ${ret} == 0 ]] && start
+ ret=$((ret + $?))
+ return ${ret}
+}
+
+probe() {
+ cvmfs_action repository_probe
+}
diff --git a/net-fs/cvmfs/files/cvmfsd.confd b/net-fs/cvmfs/files/cvmfsd.confd
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/net-fs/cvmfs/files/cvmfsd.confd
diff --git a/net-fs/cvmfs/files/cvmfsd.initd b/net-fs/cvmfs/files/cvmfsd.initd
new file mode 100644
index 000000000000..bc0c604dd95d
--- /dev/null
+++ b/net-fs/cvmfs/files/cvmfsd.initd
@@ -0,0 +1,191 @@
+#!/sbin/runscript
+
+. /etc/cvmfs/server.conf
+[[ -f /etc/cvmfs/server.local ]] && . /etc/cvmfs/server.local
+
+extra_commands="checkconfig"
+extra_started_commands="pause flush resume"
+
+description="Background daemon that writes the cvmfs character device into a log file"
+description_checkconfig="Check configuration file validity"
+description_pause="Pause the transactions (not a full stop)"
+description_flush="Flush the CernVM-FS change log"
+description_resume="Resume transactions after a pause"
+
+pidfile="/var/run/cvmfsd.pid"
+subsysfile="/var/lock/subsys/cvmfsd"
+
+checkconfig() {
+ local var ret=0
+ for var in SHADOW_DIR PUB_DIR LOG_FILE; do
+ eval value=\$$var
+ if [[ -z ${value} ]]; then
+ eerror "You need to set a value for ${var} in /etc/cvmfs/server.local"
+ ret=$((ret + $?))
+ fi
+ done
+ return ${ret}
+}
+
+depend() {
+ after localmount
+ use net
+}
+
+# returns: 0 (stopped), 1 (running), 2 (paused)
+check_status() {
+ if [ -f ${pidfile} ]; then
+ [ $(cat /sys/fs/redirfs/filters/cvmfsflt/lockdown) -eq 1 ] && return 2
+ return 1
+ fi
+ return 0
+}
+
+# FIXME: could we use start-stop-daemon instead of listen/unlisten?
+
+listen() {
+ ebegin "Starting journal writer"
+ nohup cat /dev/cvmfs >> "${LOG_FILE}" 2>/dev/null </dev/null &
+ [ $? -eq 0 ] && echo $! > ${pidfile}
+ eend $?
+}
+
+unlisten() {
+ ebegin "Stopping journal writer"
+ local pid=$(cat ${pidfile})
+ kill ${pid}
+ local killed=0 retries=0
+ while [ ${killed} -eq 0 ]; do
+ sleep 1
+ kill -0 ${pid} 2>/dev/null
+ killed=$?
+ retries=$((retries + 1))
+ [ ${retries} -eq 3 ] && kill -9 ${pid}
+ done
+ eend $?
+}
+
+start() {
+ checkconfig || return 1
+
+ if [ ! -d ${SHADOW_DIR} ]; then
+ eerror "Missing ${SHADOW_DIR}"
+ return 1
+ fi
+
+ if mkdir -p "$(echo "${LOG_FILE}" | grep -o '\([^\/]*\/\)*')"; then
+ eerror "Could not create file system journal in ${LOG_FILE}"
+ return 1
+ fi
+
+ ebegin "Loading cvmfsflt kernel module"
+ modprobe -q redirfs && modprobe -q cvmfsflt
+ eend $? || return 1
+
+ ebegin "Linking to character device"
+ rm -f /dev/cvmfs
+ mknod /dev/cvmfs c $(awk '/cvmfs/ {print $1}' /proc/devices) 0 > /dev/null 2>&1
+ chmod 0600 /dev/cvmfs
+ eend $? || return 1
+
+ ebegin "Setting filter path to ${SHADOW_DIR}"
+ echo -n "a:i:${SHADOW_DIR}" > /sys/fs/redirfs/filters/cvmfsflt/paths
+ eend $? || return 1
+
+ listen || return 1
+ ebegin "Starting CernVM-FS daemon"
+ touch ${subsysfile}
+ eend $?
+}
+
+
+pause() {
+ check_status
+ local ret=$?
+ if [ ${ret} -eq 0 ]; then
+ eerror "CernVM-FS daemon is stopped"
+ return 1
+ fi
+ if [ ${ret} -eq 2 ]; then
+ ewarn "CernVM-FS daemon is already paused"
+ return 1
+ fi
+
+ ebegin "Locking down ${SHADOW_DIR}"
+ echo -n "1" > /sys/fs/redirfs/filters/cvmfsflt/lockdown
+ eend $? || return 1
+
+ ebegin "Waiting for pending operations on ${SHADOW_DIR}"
+ local nowops noll
+ while true; do
+ nowops=$(cat /sys/fs/redirfs/filters/cvmfsflt/nowops)
+ [ $? -ne 0 ] && eend 1 && return 1
+ [ ${nowops} -eq 0 ] && break
+ sleep 1
+ done
+ eend $?
+
+ ebegin "Waiting for pending messages in call buffer"
+ local noll
+ while true; do
+ noll=$(cat /sys/fs/redirfs/filters/cvmfsflt/noll)
+ [ $? -ne 0 ] && eend 1 && return 1
+ [ ${noll} -eq 0 ] && break
+ sleep 1
+ done
+ eend $? || return 1
+ unlisten || return 1
+ mark_service_stopped cvmfsd
+}
+
+resume() {
+ check_status
+ local ret=$?
+ if [ ${ret} -eq 0 ]; then
+ eerror "CernVM-FS daemon is stopped"
+ return 1
+ fi
+ if [ $retval -eq 1 ]; then
+ ewarn "CernVM-FS daemon is already running"
+ return 1
+ fi
+
+ listen || return 1
+
+ ebegin "Open up ${SHADOW_DIR}"
+ echo -n "0" > /sys/fs/redirfs/filters/cvmfsflt/lockdown
+ eend $? || return 1
+ mark_service_started cvmfsd
+}
+
+
+stop() {
+ check_status
+ local ret=$?
+ if [ ${ret} -eq 0 ]; then
+ ewarn "CernVM-FS daemon is already stopped"
+ return 2
+ fi
+
+ if [ ${ret} -eq 1 ]; then
+ pause
+ ret=$?
+ [ ${ret} -ne 0 ] && return ${ret}
+ fi
+
+ ebegin "Unloading cvmfsflt kernel module"
+ echo -n "c\0" > /sys/fs/redirfs/filters/cvmfsflt/paths || ret=$((ret + 1))
+ echo -n "1\0" > /sys/fs/redirfs/filters/cvmfsflt/unregister || ret=$((ret + 1))
+ rmmod cvmfsflt || ret=$((ret + 1))
+ eend ${ret} || return 1
+
+ ebegin "Shutting down CernVM-FS daemon"
+ rm -f ${pidfile} ${subsysfile}
+ eend $?
+}
+
+flush() {
+ ebegin "Flushing CernVM-FS server file system change log"
+ cat /dev/null > "${LOG_FILE}"
+ eend $?
+}
diff --git a/net-fs/cvmfs/metadata.xml b/net-fs/cvmfs/metadata.xml
new file mode 100644
index 000000000000..b33579ead77e
--- /dev/null
+++ b/net-fs/cvmfs/metadata.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer>
+ <email>bicatali@gentoo.org</email>
+</maintainer>
+<longdescription lang='en'>
+ The CernVM File System is a client-server file system developed to
+ deliver software stacks onto virtual machines in a fast, scalable,
+ and reliable way. CernVM-FS is implemented as a FUSE module. It
+ makes a specially prepared directory tree stored on a web server
+ look like a local read-only file system on the virtual
+ machine. CernVM-FS uses outgoing HTTP connections only, thereby it
+ avoids most of the firewall issues of other network file systems. It
+ transfers data file by file on demand, verifying the content by
+ SHA-1 keys.
+</longdescription>
+<use>
+ <flag name='client'>Install the cvmfs client programs and init script</flag>
+ <flag name='server'>Install the cvmfsd program and init script</flag>
+</use>
+</pkgmetadata>