]> Pileus Git - ~andy/sunrise/blob - sys-fs/aufs/aufs-20080422.ebuild
1939ad4d46e4dddf984d84bb995a5569dee1f373
[~andy/sunrise] / sys-fs / aufs / aufs-20080422.ebuild
1 # Copyright 1999-2010 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 inherit eutils linux-mod
6
7 DESCRIPTION="An entirely re-designed and re-implemented Unionfs."
8 HOMEPAGE="http://aufs.sourceforge.net/"
9 SRC_URI="http://dev.gentooexperimental.org/~tommy/${P}.tar.bz2
10         http://dev.gentoo.org/~tommy/distfiles/${P}.tar.bz2"
11
12 LICENSE="GPL-2"
13 SLOT="0"
14 KEYWORDS="~amd64 ~x86"
15 IUSE="debug fuse hinotify nfsexport robr"
16
17 S="${WORKDIR}"/aufs
18
19 MODULE_NAMES="aufs(misc:${S})"
20
21 pkg_setup() {
22         # kernel version check
23         if kernel_is lt 2 6 16 ; then
24                 eerror "${PN} is being developed and tested on linux-2.6.16 and later."
25                 eerror "Make sure you have a proper kernel version!"
26                 die "Wrong kernel version"
27         fi
28
29         if kernel_is ge 2 6 24 && linux_chkconfig_present "SECURITY" ; then
30                 APPLY_SEC_PERM_PATCH="n"
31                 if ! grep -qs "EXPORT_SYMBOL(security_inode_permission);" "${KV_DIR}/security/security.c" ; then
32                         APPLY_SEC_PERM_PATCH="y"
33                 fi
34
35                 # make sure the user is allowing this to happen
36                 if [[ APPLY_SEC_PERM_PATCH = "y" ]] ; then
37                         eerror "${PN} requires that all kernels with CONFIG_SECURITY enabled >= 2.6.24"
38                         eerror "be patched.  Please enable visit ${HOMEPAGE} and read"
39                         eerror "about the sec_perm patch to enable ${PN} support."
40                         die "Invalid kernel configuration, we won't compile if CONFIG_SECURITY is enabled"
41                 fi
42         fi
43
44         linux-mod_pkg_setup
45 }
46
47 src_unpack(){
48         unpack ${A}
49         cd "${S}"
50
51         # Enable hinotify in priv_def.mk
52         if use hinotify && kernel_is ge 2 6 18 ; then
53                 echo "CONFIG_AUFS_HINOTIFY = y" >> priv_def.mk || die "setting hinotify in priv_def.mk failed!"
54         fi
55
56         # Disable SYSAUFS for kernel less than 2.6.18
57         if kernel_is lt 2 6 18 ; then
58                 echo "CONFIG_AUFS_SYSAUFS = " >> priv_def.mk || die "unsetting sysaufs in priv_def.mk failed!"
59         fi
60
61         # Enable nfsexport in priv_def.mk
62         if use nfsexport && kernel_is ge 2 6 18 ; then
63                 echo "CONFIG_AUFS_EXPORT = y" >> priv_def.mk || die "setting export in priv_def.mk failed!"
64         fi
65
66         # Enable aufs readonly-branch in priv_def.mk
67         if use robr ; then
68                 echo "CONFIG_AUFS_ROBR = y" >> priv_def.mk || die "setting robr in priv_def.mk failed!"
69         fi
70
71         # Enable FUSE workaround for AUFS
72         if use fuse ; then
73                 echo "CONFIG_AUFS_WORKAROUND_FUSE = y" >> priv_def.mk || die "setting workaround_fuse in priv_def.mk failed!"
74         fi
75
76         # Enable / Disable debugging
77         if use debug ; then
78                 echo "CONFIG_AUFS_DEBUG = y" >> priv_def.mk || die "setting debug in priv_dev.mk failed!"
79         else
80                 echo "CONFIG_AUFS_DEBUG = " >> priv_def.mk || die "setting debug in priv_dev.mk failed!"
81         fi
82
83         # Check if a vserver-kernel is installed
84         if [[ -e ${KV_DIR}/include/linux/vserver ]] ; then
85                 einfo "vserver kernel seems to be installed"
86                 einfo "using vserver patch"
87                 echo "AUFS_DEF_CONFIG = -DVSERVER" >> priv_def.mk || die "setting vserver in priv_def.mk failed!"
88         fi
89 }
90
91 src_compile() {
92         use x86 && ARCH=i386
93         use amd64 && ARCH=x86_64
94         emake KDIR=${KV_DIR} SUBLEVEL=${KV_PATCH} -f local.mk || die "emake failed"
95 }
96
97 src_install() {
98         cd util
99         exeinto /sbin
100         exeopts -m0500
101         doexe mount.aufs umount.aufs auplink aulchown || die
102         doman aufs.5 || die
103         linux-mod_src_install
104 }
105
106 pkg_postinst() {
107         elog "To be able to use aufs, you have to load the kernel module by typing:"
108         elog "modprobe aufs"
109         elog "For further information refer to the aufs man page"
110
111         linux-mod_pkg_postinst
112 }