summaryrefslogtreecommitdiff
blob: a5f3391fc0c7b092d368a2f6c5fe7aacd1b19764 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-fs/submount/submount-0.9-r1.ebuild,v 1.2 2004/10/13 01:06:10 latexer Exp $

inherit eutils kernel-mod

IUSE=""

DESCRIPTION="Submount is a new attempt to solve the removable media problem for Linux."
HOMEPAGE="http://submount.sourceforge.net/"

DEPEND="virtual/linux-sources"

SLOT="${KV}"

LICENSE="GPL-2"
KEYWORDS="~x86 ~alpha ~ppc ~sparc ~amd64"

if [ "${KV_MINOR}" == "4" ]
then
	EXTRA_V="-2.4"
else
	EXTRA_V=""
	RESTRICT=nouserpriv
fi

MY_P="${PN}${EXTRA_V}-${PV}"
S="${WORKDIR}/${MY_P}"
KMOD_SOURCES="${MY_P}.tar.gz"

SRC_URI="mirror://sourceforge/${PN}/${KMOD_SOURCES}"

src_unpack()
{
	unpack ${A}
	cd ${S}
	kernel-mod_getversion

	if [ "${KV_MINOR}" -gt 5 ]
	then
		if [ "${KV_PATCH}" -gt 5 ]
		then
			sed -i "s:SUBDIRS=:M=:" \
				${S}/subfs${EXTRA_V}-${PV}/Makefile
		else
			eerror "This version of submount requires a kernel of 2.6.6 or greater"
			die "Too old of a kernel found."
		fi
	fi
}

src_compile ()
{
	cd ${S}/subfs${EXTRA_V}-${PV}
	set_arch_to_kernel
	emake KDIR=${ROOT}/usr/src/linux || die
	set_arch_to_portage

	cd ${S}/submountd${EXTRA_V}-${PV}
	econf \
	--sbindir=/sbin \
	|| die "Confugure error"

	make || die "Make error"
}

src_install ()
{
	local KV_OBJ
	if [ "${KV_MINOR}" -gt 4 ]
	then
		KV_OBJ=ko
	else
		KV_OBJ=o
	fi

	cd ${S}/submountd${EXTRA_V}-${PV}
	make install DESTDIR=${D} mandir=/usr/share/man

	cd ${S}/subfs${EXTRA_V}-${PV}

	insinto /lib/modules/${KV}/fs/subfs

	doins subfs.$KV_OBJ

	cd ${S}
	./rename-docs ${PV}
	dodoc README* COPYING INSTALL*
}

pkg_postinst ()
{
	if [ "${ROOT}" = / ]
	then
	[ -x /usr/sbin/update-modules ] && /usr/sbin/update-modules
	fi
}