1 |
# Copyright 1999-2010 Gentoo Foundation |
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# $Header: /var/cvsroot/gentoo-x86/net-misc/hamachi/hamachi-0.9.9.9_p20-r5.ebuild,v 1.3 2010/10/28 10:03:16 ssuominen Exp $ |
4 |
|
5 |
inherit eutils linux-info |
6 |
|
7 |
# gHamachi GUI |
8 |
|
9 |
MY_PV=${PV/_p/-} |
10 |
MY_P=${PN}-${MY_PV}-lnx |
11 |
|
12 |
DESCRIPTION="Hamachi is a secure mediated peer to peer." |
13 |
HOMEPAGE="http://hamachi.cc" |
14 |
LICENSE="as-is" |
15 |
SRC_URI="sse? ( http://files.hamachi.cc/linux/${MY_P}.tar.gz ) |
16 |
!sse? ( http://files.hamachi.cc/linux/${MY_P}-pentium.tar.gz )" |
17 |
SLOT="0" |
18 |
KEYWORDS="-* ~amd64 ~x86" |
19 |
IUSE="sse" |
20 |
RESTRICT="mirror" |
21 |
QA_PRESTRIPPED="/opt/${PN}/bin/hamachi" |
22 |
|
23 |
pkg_preinst() { |
24 |
# Add group "hamachi" & user "hamachi" |
25 |
enewgroup ${PN} |
26 |
enewuser ${PN} -1 -1 /dev/null ${PN} |
27 |
} |
28 |
|
29 |
pkg_setup() { |
30 |
einfo "Checking your kernel configuration for TUN/TAP support." |
31 |
CONFIG_CHECK="~TUN" |
32 |
check_extra_config |
33 |
# Set workdir for both hamachi versions |
34 |
if use sse; then |
35 |
S=${WORKDIR}/${MY_P} |
36 |
else |
37 |
S=${WORKDIR}/${MY_P}-pentium |
38 |
fi |
39 |
} |
40 |
|
41 |
src_compile() { |
42 |
# Patching Makefile and tuncfg source code |
43 |
epatch "${FILESDIR}"/tuncfg-forcebuild.patch |
44 |
# forcing compile of tuncfg |
45 |
rm -f "${S}"/tuncfg/tuncfg |
46 |
# Compile Tuncfg |
47 |
emake -sC "${S}"/tuncfg || die "Compiling of tunecfg failed" |
48 |
} |
49 |
|
50 |
src_install() { |
51 |
# Hamachi |
52 |
einfo "Installing Hamachi" |
53 |
dodir /opt/${PN}/bin |
54 |
insinto /opt/${PN}/bin |
55 |
insopts -m0755 |
56 |
doins hamachi || die "Couldn't Install hamachi" |
57 |
dosym /opt/${PN}/bin/hamachi /usr/bin/hamachi || die "Couldn't create hamachi symlinks" |
58 |
dosym /opt/${PN}/bin/hamachi /usr/bin/hamachi-init || die "Couldn't create hamachi symlinks" |
59 |
|
60 |
# Tuncfg |
61 |
einfo "Installing Tuncfg" |
62 |
insopts -m0700 |
63 |
doins tuncfg/tuncfg |
64 |
dosym /opt/${PN}/bin/tuncfg /usr/sbin/tuncfg |
65 |
|
66 |
# Create log directory |
67 |
dodir /var/log/${PN} |
68 |
|
69 |
# Config files |
70 |
einfo "Installing config files" |
71 |
newinitd "${FILESDIR}"/tuncfg.initd tuncfg |
72 |
newconfd "${FILESDIR}"/hamachi.confd hamachi |
73 |
newinitd "${FILESDIR}"/hamachi.initd.2 hamachi |
74 |
|
75 |
# Docs |
76 |
dodir /opt/${PN}/licenses |
77 |
insinto /opt/${PN}/licenses |
78 |
insopts -m0644 |
79 |
doins LICENSE LICENSE.openssh LICENSE.openssl LICENSE.tuncfg |
80 |
dodoc CHANGES README |
81 |
|
82 |
} |
83 |
|
84 |
pkg_postinst() { |
85 |
einfo "To start Hamachi just type:" |
86 |
einfo "/etc/init.d/hamachi start" |
87 |
|
88 |
# added for bug #218481 |
89 |
einfo "If the 'hamachi' command shows no output, use the following command" |
90 |
einfo "to extract the hamachi executable either with app-arch/upx or" |
91 |
einfo "app-arch/upx-ucl:" |
92 |
einfo "/opt/bin/upx -d /opt/${PN}/bin/hamachi" |
93 |
} |