1 # Copyright 1999-2010 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 inherit eutils linux-mod
9 DESCRIPTION="An entirely re-designed and re-implemented Unionfs."
10 HOMEPAGE="http://aufs.sourceforge.net/"
11 SRC_URI="http://www.fh-kl.de/~torsten.kockler/gentoo/${P}.tar.bz2"
15 KEYWORDS="~amd64 ~x86"
16 IUSE="hinotify ksize nfs nfsexport"
18 MODULE_NAMES="aufs(addon/fs/${PN}:)"
19 BUILD_PARAMS="KDIR=${KV_DIR} -f local.mk"
25 # Check if ksize Patch has to be applied
28 # If ksize patch is not applied
29 if ! grep -qs "EXPORT_SYMBOL(ksize);" "${KV_DIR}/mm/slab.c" ; then
34 # Check if lhash Patch has to be applied
35 if use nfs && kernel_is ge 2 6 19 ; then
37 # If lhash patch is not applied
38 if ! grep -qs "EXPORT_SYMBOL(__lookup_hash);" "${KV_DIR}/fs/namei.c" \
39 && ! grep -qs "struct dentry * __lookup_hash(struct qstr *name, struct dentry
40 * base, struct nameidata *nd);" "${KV_DIR}/fs/namei.h" ; then
47 # kernel version check
48 if kernel_is lt 2 6 16 ; then
49 eerror "${PN} is being developed and tested on linux-2.6.16 and later."
50 eerror "Make sure you have a proper kernel version!"
51 die "Wrong kernel version"
56 # If a patch has to be applied
57 if [[ ${APPLY_KSIZE_PATCH} == "y" ]] || [[ ${APPLY_LHASH_PATCH} == "y" ]] ; then
58 ewarn "Patching your kernel..."
62 # If the ksize patch has to be applied
63 if [[ ${APPLY_KSIZE_PATCH} == "y" ]] ; then
64 epatch "${FILESDIR}"/${P}-ksize.patch
67 # If the lhash patch has to be applied
68 if [[ ${APPLY_LHASH_PATCH} == "y" ]] ; then
69 epatch "${FILESDIR}"/${P}-lhash.patch
79 # Enable ksize Patch in priv_def.mk
81 echo "CONFIG_AUFS_KSIZE_PATCH = y" >> priv_def.mk || die "setting ksize in priv_def.mk failed!"
84 # Enable lhash Patch in priv_def.mk
85 if use nfs && kernel_is ge 2 6 19 ; then
86 echo "CONFIG_AUFS_LHASH_PATCH = y" >> priv_def.mk || die "setting lhash in priv_def.mk failed!"
89 # Enable hinotify in priv_def.mk
90 if use hinotify && kernel_is ge 2 6 18 ; then
91 echo "CONFIG_AUFS_HINOTIFY = y" >> priv_def.mk || die "setting hinotify in priv_def.mk failed!"
94 # Enable nfsexport in priv_def.mk
95 if use nfsexport && kernel_is ge 2 6 18 ; then
96 echo "CONFIG_AUFS_EXPORT = y" >> priv_def.mk || die "setting nfsexport in priv_def.mk failed!"
99 # Disable SYSAUFS for kernel less than 2.6.18
100 if kernel_is lt 2 6 18 ; then
101 echo "CONFIG_AUFS_SYSAUFS = " >> priv_def.mk || die "unsetting sysaufs in priv_def.mk failed!"
104 # Check if a vserver-kernel is installed
105 if [[ -e ${KV_DIR}/include/linux/vserver ]] ; then
106 einfo "vserver kernel seems to be installed"
107 einfo "using vserver patch"
108 echo "AUFS_DEF_CONFIG = -DVSERVER" >> priv_def.mk || die "setting vserver in priv_def.mk failed!"
115 doexe mount.aufs umount.aufs auplink aulchown || die
117 linux-mod_src_install
121 elog "To be able to use aufs, you have to load the kernel module by typing:"
123 elog "For further information refer to the aufs man page"
125 # Tell the user to recompile his kernel
126 if [[ ${APPLY_KSIZE_PATCH} == "y" ]] || [[ ${APPLY_LHASH_PATCH} == "y" ]] ; then
128 ewarn "Remember to re-compile your kernel to make the patch(es) work"
132 linux-mod_pkg_postinst
136 [[ $(has_version "${CATEGORY}/${PF}"[ksize]) || $(has_version
137 "${CATEGORY}"/"${PF}"[nfs]) ]] && DO_CHECK="y"
141 # Tell the user that his kernel has already been patched
142 if [[ DO_CHECK == "y" ]] ; then
144 if [[ ${APPLY_KSIZE_PATCH} == "n" ]] || [[ ${APPLY_LHASH_PATCH} == "n" ]] ; then
145 ewarn "Your kernel has been patched previously by this ebuild."
146 ewarn "You can undo the patches by executing the following:"
148 ewarn "cd ${KV_DIR}; make mrproper, re-emerge and re-compile your kernel - ${KV_FULL}"