# Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils linux-mod DESCRIPTION="Another Unionfs. The Unionfs is originally developed by Erez Zadok and his team. Once aufs was entirely re-designed and re-implemented Unionfs. Enhancing with many original ideas, it becomes totally different software while keeping the basic features." HOMEPAGE="http://aufs.sourceforge.net" SRC_URI="www.fh-kl.de/~torsten.kockler/gentoo/${P}.tar.bz2" LICENSE="GPL-2" KEYWORDS="~x86" IUSE="ksize nfs" SLOT="0" kernel_version_info() { eerror eerror "Aufs is being developed and tested on linux-2.6.16 and later." eerror "Make sure you have a proper kernel version!" eerror } kernel_ksize_patched() { if grep -qs "EXPORT_SYMBOL(ksize);" "${KERNEL_DIR}/mm/slab.c" then einfo "Your kernel has already been patched for ksize" return 0 fi return 1 } ksize_patch() { cd ${KV_DIR} epatch ${S}/ksize.patch ewarn ewarn ewarn "You have to recompile your kernel to make ksize work" ewarn } kernel_lhash_patched() { if grep -qs "EXPORT_SYMBOL(__lookup_hash);" "${KERNEL_DIR}/fs/namei.c" || grep -qs "struct dentry * __lookup_hash(struct qstr *name, struct dentry * base, struct nameidata *nd);" "${KERNEL_DIR}/fs/namei.h" then einfo "Your kernel has already been patched for lhash" return 0 fi return 1 } lhash_patch() { cd ${KV_DIR} epatch ${S}/lhash.patch ewarn ewarn ewarn "You have to recompile your kernel to make the lhash patch for nfs-support work" ewarn } pkg_setup(){ # kernel version check if ! kernel_is gt 2 6 16 then kernel_version_info die fi linux-mod_pkg_setup } src_unpack() { unpack ${A} cd ${S} emake \ ARCH=i386 \ KDIR=${ROOT}/lib/modules/${KV_FULL}/build \ -f local.mk } src_install() { exeinto /sbin exeopts -m0500 doexe mount.aufs umount.aufs auplink aulchown doman aufs.5 MODULE_NAMES="aufs(addon/fs/${PN}:)" BUILD_TARGETS=" " linux-mod_src_install } pkg_postinst() { # ksize Patch if use ksize then kernel_ksize_patched || \ ksize_patch fi #lhash Patch if use nfs && kernel_is ge 2 6 19 then kernel_lhash_patched || \ lhash_patch fi einfo einfo "To be able to use aufs, you have to load the kernel module by typing:" einfo "modprobe aufs" einfo einfo "For further information refer to the aufs manpage" einfo }