1 |
# Copyright 1999-2009 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_p102.ebuild,v 1.3 2009/03/20 16:39:05 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 |
RESTRICT="strip" |
20 |
IUSE="arts cups esd +nxclient rdesktop vnc" |
21 |
|
22 |
DEPEND="x11-misc/gccmakedep |
23 |
x11-misc/imake" |
24 |
RDEPEND="dev-tcltk/expect |
25 |
media-fonts/font-misc-misc |
26 |
media-fonts/font-cursor-misc |
27 |
net-analyzer/gnu-netcat |
28 |
>=net-misc/nx-2.1.0 |
29 |
sys-apps/gawk |
30 |
virtual/ssh |
31 |
x11-apps/xauth |
32 |
x11-apps/xrdb |
33 |
x11-apps/sessreg |
34 |
arts? ( kde-base/arts ) |
35 |
cups? ( net-print/cups ) |
36 |
esd? ( media-sound/esound ) |
37 |
nxclient? ( net-misc/nxclient ) |
38 |
!nxclient? ( !net-misc/nxclient |
39 |
|| ( x11-misc/xdialog |
40 |
x11-apps/xmessage ) ) |
41 |
rdesktop? ( net-misc/rdesktop ) |
42 |
vnc? ( x11-misc/x11vnc |
43 |
|| ( net-misc/tightvnc net-misc/vnc ) ) |
44 |
!net-misc/nxserver-freeedition |
45 |
!net-misc/nxserver-2xterminalserver" |
46 |
|
47 |
S=${WORKDIR}/${MY_PN} |
48 |
|
49 |
export NX_HOME_DIR=/var/lib/nxserver/home |
50 |
|
51 |
pkg_setup () { |
52 |
enewuser nx -1 -1 ${NX_HOME_DIR} |
53 |
} |
54 |
|
55 |
src_unpack() { |
56 |
unpack ${A} |
57 |
cd "${S}" |
58 |
|
59 |
epatch "${FILESDIR}"/${P}-nxloadconfig.patch |
60 |
epatch "${FILESDIR}"/${P}-cflags.patch |
61 |
epatch "${FILESDIR}"/${PN}-0.7.2-cups.patch |
62 |
|
63 |
sed -e "/PATH_LIB=/s/lib/$(get_libdir)/g" \ |
64 |
-e "s#REAL_PATH_LIB#/usr/$(get_libdir)/NX/bin#" \ |
65 |
-i nxloadconfig || die "nxloadconfig sed failed" |
66 |
|
67 |
# Change the defaults in nxloadconfig to meet the users needs. |
68 |
if use arts ; then |
69 |
einfo "Enabling arts support." |
70 |
sed -i '/ENABLE_ARTSD_PRELOAD=/s/"0"/"1"/' nxloadconfig || die |
71 |
sed -i '/ENABLE_ARTSD_PRELOAD=/s/"0"/"1"/' node.conf.sample || die |
72 |
fi |
73 |
if use esd ; then |
74 |
einfo "Enabling esd support." |
75 |
sed -i '/ENABLE_ESD_PRELOAD=/s/"0"/"1"/' nxloadconfig || die |
76 |
sed -i '/ENABLE_ESD_PRELOAD=/s/"0"/"1"/' node.conf.sample || die |
77 |
fi |
78 |
if use cups ; then |
79 |
einfo "Enabling cups support." |
80 |
sed -i '/ENABLE_KDE_CUPS=/s/"0"/"1"/' nxloadconfig || die |
81 |
sed -i '/ENABLE_KDE_CUPS=/s/"0"/"1"/' node.conf.sample || die |
82 |
fi |
83 |
} |
84 |
|
85 |
src_compile() { |
86 |
emake CC=$(tc-getCC) CDEBUGFLAGS="${CFLAGS}" || die "compilation failed" |
87 |
} |
88 |
|
89 |
src_install() { |
90 |
export NX_ETC_DIR=/etc/nxserver |
91 |
export NX_SESS_DIR=/var/lib/nxserver/db |
92 |
|
93 |
emake DESTDIR="${D}" install || die "install failed" |
94 |
|
95 |
# This should be renamed to remove the blocker on net-misc/nxclient |
96 |
use nxclient && rm "${D}"/usr/bin/nxprint |
97 |
|
98 |
mv "${D}"/etc/nxserver/node.conf.sample "${D}"/etc/nxserver/node.conf || |
99 |
die "cannot find default configuration file" |
100 |
|
101 |
dodir ${NX_ETC_DIR} |
102 |
for x in passwords passwords.orig ; do |
103 |
touch "${D}"${NX_ETC_DIR}/$x |
104 |
chmod 600 "${D}"${NX_ETC_DIR}/$x |
105 |
done |
106 |
|
107 |
dodir ${NX_HOME_DIR} |
108 |
|
109 |
for x in closed running failed ; do |
110 |
keepdir ${NX_SESS_DIR}/$x |
111 |
fperms 0700 ${NX_SESS_DIR}/$x |
112 |
done |
113 |
|
114 |
newinitd "${FILESDIR}"/nxserver.init nxserver |
115 |
} |
116 |
|
117 |
pkg_postinst () { |
118 |
# Other NX servers ebuilds may have already created the nx account |
119 |
# However they use different login shell/home directory paths |
120 |
if [[ ${ROOT} == "/" ]]; then |
121 |
usermod -s /usr/bin/nxserver nx || die "Unable to set login shell of nx user!!" |
122 |
usermod -d ${NX_HOME_DIR} nx || die "Unable to set home directory of nx user!!" |
123 |
usermod -a -G utmp nx || die "Unable to add nx user to utmp group!!" |
124 |
else |
125 |
elog "If you had another NX server installed before, please make sure" |
126 |
elog "the nx user account is correctly set to:" |
127 |
elog " * login shell: /usr/bin/nxserver" |
128 |
elog " * home directory: ${NX_HOME_DIR}" |
129 |
elog " * supplementary groups: utmp" |
130 |
fi |
131 |
|
132 |
elog "To complete the installation, run:" |
133 |
elog " nxsetup --install --setup-nomachine-key --clean --purge" |
134 |
elog "This will use the default Nomachine SSH key" |
135 |
} |