summaryrefslogtreecommitdiff
blob: 3a74576e7ab435a4fdba4ec418e2374e57552bed (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
98
99
100
101
102
103
104
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-crypt/bestcrypt/bestcrypt-1.5_p10.ebuild,v 1.4 2005/04/21 17:59:56 blubb Exp $

inherit flag-o-matic eutils linux-mod toolchain-funcs

MY_PN="bcrypt"
DESCRIPTION="commercially licensed transparent filesystem encryption"
HOMEPAGE="http://www.jetico.com/"
SRC_URI="http://www.jetico.com/linux/BestCrypt-${PV/_p/-}.tar.gz
	http://www.carceri.dk/files/bcrypt-rc6-serpent.diff.gz"

LICENSE="bestcrypt"
SLOT="0"
IUSE=""
KEYWORDS="x86 amd64"

DEPEND="virtual/linux-sources"

S=${WORKDIR}/bcrypt

#get-version
MODULE_NAMES="bc(block:${S}/mod)
		bc_des(block:${S}/mod/des)
		bc_3des(block:${S}/mod/3des)
		bc_bf128(block:${S}/mod/bf128)
		bc_bf448(block:${S}/mod/bf448)
		bc_blowfish(block:${S}/mod/blowfish)
		bc_cast(block:${S}/mod/cast)
		bc_gost(block:${S}/mod/gost)
		bc_idea(block:${S}/mod/idea)
		bc_rijn(block:${S}/mod/rijn)
		bc_serpent(block:${S}/mod/serpent)
		bc_rc6(block:${S}/mod/rc6)
		bc_twofish(block:${S}/mod/twofish)"

src_unpack() {
	unpack BestCrypt-${PV/_p/-}.tar.gz
	cd ${S}

	epatch ${DISTDIR}/bcrypt-rc6-serpent.diff.gz
	epatch ${FILESDIR}/${P}-makefile_fix.patch
}

src_compile() {

	filter-flags -fforce-addr

	emake -C kgsha EXTRA_CXXFLAGS="${CXXFLAGS}" || die "library compile failed"
	emake -C src EXTRA_CFLAGS="${CFLAGS}" || die "bctool compile failed"

	# Don't put stack protection in the kernel - it just is bad
	append-flags -fno-stack-protector-all -fno-stack-protector

	emake  -C mod SYMSRC=bc_dev${KV_MAJOR}${KV_MINOR}.c bc_dev.ver EXTRA_CFLAGS="${CFLAGS}" \
		|| die "compile failed"

	emake  -C mod OBJS="bc_dev${KV_MAJOR}${KV_MINOR}.o bc_mgr.o" \
		KERNEL_DIR=${KV_DIR} KEXT=${KV_OBJ} CC=$(tc-getCC) LD=$(tc-getLD) \
		AS=$(tc-getAS) CPP=$(tc-getCXX) EXTRA_CFLAGS="${CFLAGS}" || die "compile failed"
	einfo "Modules compiled"
}

src_install() {
	linux-mod_src_install

	cd ${S}
	dodir /etc
	cp etc/bc.conf ${D}/etc/bc.conf

	dobin bin/bctool
	insinto /usr/bin
	for link in bcumount bcformat bcfsck bcnew bcpasswd bcinfo \
		bclink bcunlink bcmake_hidden bcreencrypt;
	do
		dosym bctool /usr/bin/${link}
	done


	doman man/bctool.8
	newinitd ${FILESDIR}/bcrypt3 bcrypt
	dodoc README LICENSE HIDDEN_PART

	insinto /etc/devfs.d
	doins ${FILESDIR}/bestcrypt.devfs
}


pkg_postinst() {

	einfo "If you are using the serpent or rc6 encryption modules and have any problems,"
	einfo "please submit bugs to http://bugs.gentoo.org because these modules are not part"
	einfo "of the standard distribution of BestCrypt for Linux released by Jetico."
	einfo "For more information on these additional modules:"
	einfo "visit http://www.carceri.dk/index.php?redirect=other_bestcrypt"

	einfo
	ewarn "The BestCrypt drivers are not free - Please purchace a license from "
	ewarn "http://www.jetico.com/"

	if [ -e "${ROOT}/dev/.devfsd" ]; then
		killall -HUP devfsd
	fi
}