1 |
# Copyright 1999-2012 Gentoo Foundation |
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# $Header: /var/cvsroot/gentoo-x86/net-misc/neatx/neatx-0.3.1_p59-r1.ebuild,v 1.9 2012/12/18 13:58:43 voyageur Exp $ |
4 |
|
5 |
EAPI="3" |
6 |
|
7 |
PYTHON_DEPEND="2" |
8 |
inherit eutils autotools python multilib user |
9 |
|
10 |
DESCRIPTION="Google implementation of NX server" |
11 |
HOMEPAGE="http://code.google.com/p/neatx/" |
12 |
SRC_URI="mirror://gentoo/${P}.tar.bz2" |
13 |
|
14 |
LICENSE="GPL-2" |
15 |
SLOT="0" |
16 |
KEYWORDS="amd64 x86" |
17 |
IUSE="" |
18 |
|
19 |
DEPEND="dev-python/docutils" |
20 |
RDEPEND="dev-python/pexpect |
21 |
dev-python/simplejson |
22 |
>=dev-python/pygtk-2.14 |
23 |
>=dev-python/pygobject-2.14:2 |
24 |
app-portage/portage-utils |
25 |
media-fonts/font-misc-misc |
26 |
media-fonts/font-cursor-misc |
27 |
|| ( net-analyzer/gnu-netcat |
28 |
net-analyzer/netcat |
29 |
net-analyzer/netcat6 ) |
30 |
net-misc/nx" |
31 |
|
32 |
S=${WORKDIR}/${PN} |
33 |
|
34 |
pkg_setup () { |
35 |
# configure script looks for latest python2 only, |
36 |
# no multiple versions support |
37 |
python_set_active_version 2 |
38 |
python_pkg_setup |
39 |
|
40 |
if [ -z "${NX_HOME_DIR}" ]; |
41 |
then |
42 |
export NX_HOME_DIR=/var/lib/neatx/home |
43 |
fi |
44 |
enewuser nx -1 -1 ${NX_HOME_DIR} |
45 |
} |
46 |
|
47 |
src_prepare() { |
48 |
sed -i -e "s/rst2html]/rst2html.py]/" configure.ac \ |
49 |
|| die "configure.ac sed failed" |
50 |
sed -e "s#/lib/neatx#/neatx#" \ |
51 |
-e "/^docdir/s#\$(PACKAGE)#${PF}#" \ |
52 |
-e "s#-Werror##" \ |
53 |
-i Makefile.am \ |
54 |
|| die "Makefile.am sed failed" |
55 |
sed -e "/DATA_DIR =/s#/lib/neatx#/neatx#" \ |
56 |
-i lib/constants.py || die "constants.py sed failed" |
57 |
|
58 |
eautoreconf |
59 |
|
60 |
echo "#!/bin/sh" > autotools/py-compile |
61 |
} |
62 |
|
63 |
src_compile() { |
64 |
default_src_compile |
65 |
# Scripts are automatically generated, fix them here |
66 |
python_convert_shebangs 2 src/nx* |
67 |
} |
68 |
|
69 |
src_install() { |
70 |
emake install DESTDIR="${D}" || die "Failed to install" |
71 |
fperms 777 /var/lib/neatx/sessions |
72 |
dodir ${NX_HOME_DIR}/.ssh |
73 |
fowners nx:nx ${NX_HOME_DIR} |
74 |
fowners nx:nx ${NX_HOME_DIR}/.ssh |
75 |
|
76 |
insinto /etc |
77 |
newins doc/neatx.conf.example neatx.conf |
78 |
|
79 |
# nc or netcat6 or netcat? |
80 |
if has_version net-analyzer/gnu-netcat; then |
81 |
nc_path="/usr/bin/netcat" |
82 |
elif has_version net-analyzer/netcat6; then |
83 |
nc_path="/usr/bin/nc6" |
84 |
else |
85 |
nc_path="/usr/bin/nc" |
86 |
fi |
87 |
cat >> "${D}"/etc/neatx.conf << EOF |
88 |
|
89 |
netcat-path = ${nc_path} |
90 |
use-xsession = false |
91 |
start-gnome-command = /etc/X11/Sessions/Gnome |
92 |
EOF |
93 |
|
94 |
insinto ${NX_HOME_DIR}/.ssh |
95 |
insopts -m 600 -o nx |
96 |
newins extras/authorized_keys.nomachine authorized_keys |
97 |
} |
98 |
|
99 |
pkg_postinst () { |
100 |
python_mod_optimize neatx |
101 |
|
102 |
# Other NX servers ebuilds may have already created the nx account |
103 |
# However they use different login shell/home directory paths |
104 |
if [[ ${ROOT} == "/" ]]; then |
105 |
usermod -s /usr/$(get_libdir)/neatx/nxserver-login nx || die "Unable to set login shell of nx user!!" |
106 |
usermod -d ${NX_HOME_DIR} nx || die "Unable to set home directory of nx user!!" |
107 |
else |
108 |
elog "If you had another NX server installed before, please make sure" |
109 |
elog "the nx user account is correctly set to:" |
110 |
elog " * login shell: /usr/$(get_libdir)/neatx/nxserver-login" |
111 |
elog " * home directory: ${NX_HOME_DIR}" |
112 |
fi |
113 |
|
114 |
if has_version net-misc/openssh[-pam]; then |
115 |
elog "" |
116 |
elog "net-misc/openssh was not built with PAM support" |
117 |
elog "You will need to unlock the nx account by setting a password for it" |
118 |
fi |
119 |
|
120 |
elog "If you want to use the default su authentication (rather than ssh)" |
121 |
elog "you must ensure that the nx user is a member of the wheel group." |
122 |
elog "You can add it via \"usermod -a -G wheel nx\"" |
123 |
} |
124 |
|
125 |
pkg_postrm() { |
126 |
python_mod_cleanup neatx |
127 |
} |