# Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils linux-mod linux-info DESCRIPTION="Free open-source disk encryption software for Windows XP/2000/2003 and Linux" HOMEPAGE="http://www.truecrypt.org/" SRC_URI="http://www.truecrypt.org/downloads/truecrypt-${PV}-source-code.tar.gz" LICENSE="truecrypt" SLOT="0" KEYWORDS="~x86 ~amd64" IUSE="" DEPEND="virtual/linux-sources >=sys-fs/device-mapper-1.00.08" RDEPEND="sys-apps/module-init-tools >=sys-fs/device-mapper-1.00.08" BUILD_PARAMS="KSRC=${KV_DIR} NO_WARNINGS=1" BUILD_TARGETS="truecrypt" MODULE_NAMES="truecrypt(extra:${S}/Linux/Kernel)" pkg_setup() { linux-info_pkg_setup dmcrypt_check; } src_unpack() { unpack ${A} cd ${S} linux-mod_pkg_setup } src_compile() { linux-mod_src_compile || die "Truecrypt module compilation failed." cd ${S}/Linux/Cli einfo "Building truecrypt utility" # Make the CLI -- the build breaks if built in parallel, so use -j1 for # MAKEOPTS emake -j1 || die "Compile and/or linking of TrueCrypt Linux CLI application failed." } src_test() { ${S}/Linux/Cli/truecrypt --test } src_install() { # unload truecrypt modules if already loaded /sbin/rmmod truecrypt >&- 2>&- if grep -q "^truecrypt" /proc/modules then die "Please dismount all mounted TrueCrypt volumes" fi cd ${S} # installing files dobin Linux/Cli/truecrypt doman Linux/Cli/Man/truecrypt.1 dodoc Readme.txt # installing kernel module linux-mod_src_install } pkg_postinst() { depmod || die "depmod failed" echo einfo " For TrueCrypt 4.2 to work you have to load a " einfo " kernel module. This can be done in three ways: " einfo einfo " 1. Loading the module automatically by the running kernel. " einfo " For this 'Automatic kernel module loading' needs to be " einfo " enabled (CONFIG_KMOD=y). " einfo " 2. Loading the module manually before mounting the volume. " einfo " Try 'modprobe truecrypt' as root to load the module. " einfo " 3. Load the module during boot by listing it in " einfo " '/etc/modules.autoload.d/kernel-2.6' " } dmcrypt_check() { ebegin "Checking for Device mapper support (BLK_DEV_DM)" linux_chkconfig_present BLK_DEV_DM eend $? if [[ $? -ne 0 ]] ; then ewarn "TrueCrypt requires Device mapper support!" ewarn "Please enable Device mapper support in your kernel config, found at:" ewarn "(for 2.6 kernels)" ewarn ewarn " Device Drivers" ewarn " Multi-Device Support" ewarn " <*> Device mapper support" ewarn ewarn "and recompile your kernel if you want this package to work." epause 10 fi }