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/nxserver-freenx/nxserver-freenx-0.7.3_p104-r2.ebuild,v 1.4 2010/04/11 18:51:54 voyageur Exp $ |
4 |
|
5 |
EAPI=1 |
6 |
|
7 |
inherit multilib eutils toolchain-funcs versionator |
8 |
|
9 |
MAJOR_PV="$(get_version_component_range 1-3)" |
10 |
PATCH_VER="$(get_version_component_range 4)" |
11 |
MY_PN="freenx-server" |
12 |
|
13 |
DESCRIPTION="Free Software Implementation of the NX Server" |
14 |
HOMEPAGE="http://freenx.berlios.de/ https://launchpad.net/~freenx-team" |
15 |
SRC_URI="http://ppa.launchpad.net/freenx-team/ppa/ubuntu/pool/main/f/${MY_PN}/freenx-server_${MAJOR_PV}+teambzr${PATCH_VER/p}.orig.tar.gz" |
16 |
LICENSE="GPL-2" |
17 |
SLOT="0" |
18 |
KEYWORDS="amd64 x86" |
19 |
IUSE="+nxclient rdesktop vnc" |
20 |
|
21 |
DEPEND="x11-misc/gccmakedep |
22 |
x11-misc/imake" |
23 |
RDEPEND="dev-tcltk/expect |
24 |
media-fonts/font-cursor-misc |
25 |
media-fonts/font-misc-misc |
26 |
net-analyzer/gnu-netcat |
27 |
<net-misc/nx-3.4.0 |
28 |
sys-apps/gawk |
29 |
virtual/ssh |
30 |
x11-apps/xauth |
31 |
x11-apps/xrdb |
32 |
x11-apps/sessreg |
33 |
nxclient? ( net-misc/nxclient ) |
34 |
!nxclient? ( !net-misc/nxclient |
35 |
|| ( x11-misc/xdialog |
36 |
x11-apps/xmessage ) ) |
37 |
rdesktop? ( net-misc/rdesktop ) |
38 |
vnc? ( x11-misc/x11vnc |
39 |
|| ( net-misc/tightvnc net-misc/vnc ) )" |
40 |
|
41 |
S=${WORKDIR}/${MY_PN} |
42 |
|
43 |
export NX_HOME_DIR=/var/lib/nxserver/home |
44 |
|
45 |
pkg_setup () { |
46 |
enewuser nx -1 -1 ${NX_HOME_DIR} |
47 |
} |
48 |
|
49 |
src_unpack() { |
50 |
unpack ${A} |
51 |
cd "${S}" |
52 |
|
53 |
epatch "${FILESDIR}"/${P}-pam_ssh.patch |
54 |
epatch "${FILESDIR}"/${P}-nxnode_setup_samba.patch |
55 |
epatch "${FILESDIR}"/${PN}-0.7.3_p102-nxloadconfig.patch |
56 |
epatch "${FILESDIR}"/${PN}-0.7.3_p102-cflags.patch |
57 |
epatch "${FILESDIR}"/${PN}-0.7.2-cups.patch |
58 |
|
59 |
sed -e "/PATH_LIB=/s/lib/$(get_libdir)/g" \ |
60 |
-e "s#REAL_PATH_LIB#/usr/$(get_libdir)/NX/bin#" \ |
61 |
-i nxloadconfig || die "nxloadconfig sed failed" |
62 |
} |
63 |
|
64 |
src_compile() { |
65 |
emake CC=$(tc-getCC) CDEBUGFLAGS="${CFLAGS}" || die "compilation failed" |
66 |
} |
67 |
|
68 |
src_install() { |
69 |
export NX_ETC_DIR=/etc/nxserver |
70 |
export NX_SESS_DIR=/var/lib/nxserver/db |
71 |
|
72 |
emake DESTDIR="${D}" install || die "install failed" |
73 |
|
74 |
# This should be renamed to remove the blocker on net-misc/nxclient |
75 |
use nxclient && rm "${D}"/usr/bin/nxprint |
76 |
|
77 |
mv "${D}"/etc/nxserver/node.conf.sample "${D}"/etc/nxserver/node.conf || |
78 |
die "cannot find default configuration file" |
79 |
|
80 |
dodir ${NX_ETC_DIR} |
81 |
for x in passwords passwords.orig ; do |
82 |
touch "${D}"${NX_ETC_DIR}/$x |
83 |
chmod 600 "${D}"${NX_ETC_DIR}/$x |
84 |
done |
85 |
|
86 |
dodir ${NX_HOME_DIR} |
87 |
|
88 |
for x in closed running failed ; do |
89 |
keepdir ${NX_SESS_DIR}/$x |
90 |
fperms 0700 ${NX_SESS_DIR}/$x |
91 |
done |
92 |
|
93 |
newinitd "${FILESDIR}"/nxserver.init nxserver |
94 |
} |
95 |
|
96 |
pkg_postinst () { |
97 |
# Other NX servers ebuilds may have already created the nx account |
98 |
# However they use different login shell/home directory paths |
99 |
if [[ ${ROOT} == "/" ]]; then |
100 |
usermod -s /usr/bin/nxserver nx || die "Unable to set login shell of nx user!!" |
101 |
usermod -d ${NX_HOME_DIR} nx || die "Unable to set home directory of nx user!!" |
102 |
usermod -a -G utmp nx || die "Unable to add nx user to utmp group!!" |
103 |
else |
104 |
elog "If you had another NX server installed before, please make sure" |
105 |
elog "the nx user account is correctly set to:" |
106 |
elog " * login shell: /usr/bin/nxserver" |
107 |
elog " * home directory: ${NX_HOME_DIR}" |
108 |
elog " * supplementary groups: utmp" |
109 |
fi |
110 |
|
111 |
elog "To complete the installation, run:" |
112 |
elog " nxsetup --install --setup-nomachine-key" |
113 |
elog "This will use the default Nomachine SSH key" |
114 |
elog "If you had older NX servers installed, you may need to add \"--clean --purge\" to the nxsetup command" |
115 |
|
116 |
if ! built_with_use net-misc/openssh pam; then |
117 |
elog "" |
118 |
elog "net-misc/openssh was not built with PAM support" |
119 |
elog "You will need to unlock the nx account by setting a password for it" |
120 |
fi |
121 |
} |