/[gentoo-x86]/eclass/nxserver_1.5.eclass
Gentoo

Contents of /eclass/nxserver_1.5.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (show annotations) (download)
Mon Nov 30 04:19:36 2009 UTC (4 years, 10 months ago) by abcd
Branch: MAIN
CVS Tags: HEAD
Changes since 1.7: +1 -1 lines
FILE REMOVED
Remove eclasses that have been marked as deprecated for >=2 years; schedule other deprecated eclasses for removal

1 # Copyright 1999-2004 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/nxserver_1.5.eclass,v 1.7 2007/07/02 14:24:27 peper Exp $
4 #
5 # DEPRECATED
6 # eclass for handling the different nxserver binaries available
7 # from nomachine's website
8 #
9 # now handles freenx as well
10
11 inherit rpm eutils
12
13 HOMEPAGE="http://www.nomachine.com/"
14 IUSE="prebuilt cups"
15 LICENSE="nomachine"
16 SLOT="0"
17 RESTRICT="mirror strip fetch"
18
19 SRC_URI="nxserver-${MY_PV}.i386.rpm"
20 DEPEND="
21 x11-proto/xproto
22 x11-proto/xf86vidmodeproto
23 x11-proto/glproto
24 x11-proto/videoproto
25 x11-proto/xextproto
26 x11-proto/fontsproto
27 x11-libs/libX11
28 x11-libs/libFS
29 x11-libs/libXvMC
30 media-libs/mesa
31 x11-misc/xdialog
32 sys-apps/shadow
33 net-misc/openssh
34 !prebuilt? (
35 =net-misc/nxssh-1.5*
36 =net-misc/nxproxy-1.5*
37 =net-misc/nx-x11-1.5*
38 )
39 prebuilt? (
40 !net-misc/nxssh
41 !net-misc/nxproxy
42 !net-misc/nx-x11
43 !net-misc/nxcomp
44 )"
45
46 RDEPEND="media-libs/jpeg
47 sys-libs/zlib
48 net-misc/openssh
49 dev-lang/perl
50 =net-misc/nxclient-1.5*"
51
52 S="${WORKDIR}"
53
54 DESCRIPTION="an X11/RDP/VNC proxy server especially well suited to low bandwidth links such as wireless, WANS, and worse"
55
56 EXPORT_FUNCTIONS pkg_setup src_install pkg_postinst pkg_nofetch
57
58 nxserver_1.5_pkg_nofetch() {
59 eerror "Please download the $MY_EDITION edition of NXServer from:"
60 eerror
61 eerror " $MY_DOWNLOAD"
62 eerror
63 eerror "and save it onto this machine as:"
64 eerror
65 eerror " ${DISTDIR}/nxserver-${MY_EDITION}-${MY_PV}.i386.rpm"
66 eerror
67 eerror "** NOTE the change in filename! **"
68 }
69
70 nxserver_1.5_pkg_setup() {
71 einfo "Adding user 'nx' for the NX server"
72 enewuser nx -1 -1 /usr/NX/home/nx
73 }
74
75 nxserver_1.5_src_install() {
76 einfo "Installing"
77
78 # remove the pre-compiled binaries and libraries, if we are not
79 # to use the !M prebuilt files
80 if ! useq prebuilt ; then
81 find usr/NX/lib -type l -exec rm {} \;
82
83 for x in nxagent nxdesktop nxpasswd nxviewer ; do
84 if [ -f usr/NX/bin/$x ]; then
85 rm -f usr/NX/bin/$x
86 fi
87 done
88
89 # remove libraries installed by other packages
90 for x in usr/NX/lib/*.so.* ; do
91 if [ -f $x ]; then
92 rm -f $x
93 fi
94 done
95 fi
96
97 tar -cf - * | ( cd ${D} ; tar -xf - )
98
99 dodir /usr/NX/var
100 keepdir /usr/NX/var/sessions
101
102 doenvd ${FILESDIR}/1.3.0/50nxserver
103 }
104
105 nxserver_1.5_pkg_postinst() {
106
107 NX_ROOT=/usr/NX
108
109 # the 'nx' user's home directory, from release to release
110 #
111 # release user homedir
112 # 1.2.2 nx /usr/NX/home/nx
113 # 1.3.0 nx /usr/NX/home
114 # 1.3.2 nx /usr/NX/home/nx
115 # 1.4.0 nx /usr/NX/home/nx
116 # 1.5.0 nx /usr/NX/home/nx
117
118 # we do this to move the home directory of older installs
119 NX_HOME=${NX_ROOT}/home/nx
120 einfo "Setting home directory of user 'nx' to ${NX_HOME}"
121 usermod -d ${NX_HOME} nx
122
123 # move the passwords file if necessary
124 #
125 # release passwords file
126 # 1.4.0 /usr/NX/etc/passwords
127 # 1.5.0 /usr/NX/etc/passwords.db
128
129 NX_OLD_PASSWORD_DB="${NX_ROOT}/etc/passwords"
130 NX_PASSWORD_DB="${NX_ROOT}/etc/passwords.db"
131
132 if [[ -f ${NX_OLD_PASSWORD_DB} ]]; then
133 mv ${NX_OLD_PASSWORD_DB} ${NX_PASSWORD_DB} || die "Unable to move passwords file"
134 else
135 einfo "Creating an empty password database"
136 touch ${NX_PASSWORD_DB}
137 fi
138
139 chmod 0600 ${NX_PASSWORD_DB}
140 chown nx:root ${NX_PASSWORD_DB}
141
142 # move/generate the keys if necessary
143 #
144 # release keys file
145 # 1.4.0 /usr/NX/etc/users.id_dsa
146 # 1.5.0 /usr/NX/etc/node.localhost.id_dsa.pub
147
148 NX_OLD_SERVER_SSHKEY="${NX_ROOT}/etc/users.id_dsa"
149 NX_SERVER_SSHKEY="${NX_ROOT}/etc/node.localhost.id_dsa.pub"
150
151 if [[ -f ${NX_OLD_SERVER_SSHKEY} ]]; then
152 einfo "Re-using existing SSH key"
153 mv ${NX_OLD_SERVER_SSHKEY} ${NX_SERVER_SSHKEY} || die "Unable to move SSH key"
154 else
155 einfo "Generating SSH key for the 'nx' user"
156 ssh-keygen -q -t dsa -N '' -f ${NX_SERVER_SSHKEY}
157 fi
158 chmod 0600 ${NX_SERVER_SSHKEY}
159 chown nx:root ${NX_SERVER_SSHKEY}
160
161 # the user's database also moves around
162 #
163 # release location
164 # 1.4.0 /usr/NX/etc/users
165 # 1.5.0 /usr/NX/etc/users.db
166
167 NX_OLD_USERS_DB="${NX_ROOT}/etc/users"
168 NX_USERS_DB="${NX_ROOT}/etc/users.db"
169
170 if [[ -f ${NX_OLD_USERS_DB} ]] ; then
171 einfo "Re-using existing users database"
172 mv ${NX_OLD_USERS_DB} ${NX_USERS_DB} || die "Unable to move users database"
173 else
174 einfo "Creating an empty users database"
175 touch ${NX_USERS_DB}
176 fi
177
178 chmod 0600 ${NX_USERS_DB}
179 chown nx:root ${NX_USERS_DB}
180
181 # the license key file moves too
182 #
183 # release location
184 # 1.4.0 /usr/NX/etc/key.txt
185 # 1.5.0 /usr/NX/etc/server.lic
186
187 NX_OLD_LICENSE_KEY="${NX_ROOT}/etc/key.txt"
188 NX_LICENSE_KEY="${NX_ROOT}/etc/server.lic"
189
190 if [[ -f ${NX_OLD_LICENSE_KEY} ]]; then
191 einfo "Re-using existing license key"
192 mv ${NX_OLD_LICENSE_KEY} ${NX_LICENSE_KEY} || die "Unable to move license key file"
193 chmod 0400 ${NX_LICENSE_KEY}
194 chown nx:root ${NX_LICENSE_KEY}
195 fi
196
197 # end of upgrade support
198
199 # now that nxserver has been installed, we can change the shell
200 # of the nx user to be the correct one
201
202 echo "Setting nx's homedir to /usr/NX/bin/nxserver"
203 chsh -s /usr/NX/bin/nxserver nx
204
205 einfo "Changing permissions for files under /usr/NX"
206 chown -R nx:root /usr/NX
207 chmod u+x /usr/NX/var/db/*
208 chmod 755 /usr/NX/etc
209
210 # It seems to be default.id_dsa.pub in 1.5.0
211 cp -pf /usr/NX/home/nx/.ssh/default.id_dsa.pub /usr/NX/home/nx/.ssh/authorized_keys2
212 chown nx:root /usr/NX/home/nx/.ssh/authorized_keys2
213 chmod 0600 /usr/NX/home/nx/.ssh/authorized_keys2
214
215 # TODO:
216 # what does the broadcast.txt file really do?
217 if [ ! -f /usr/NX/var/broadcast.txt ]; then
218 einfo "Creating NX user registration database"
219 touch /usr/NX/var/broadcast.txt
220 chown nx:root /usr/NX/var/broadcast.txt
221
222 ewarn "None of your system users are registered to use the NX Server."
223 ewarn "To authorise a user, run:"
224 ewarn "'/usr/NX/bin/nxserver --useradd <username>'"
225 fi
226
227 if [[ ! -f ${NX_LICENSE_KEY} ]] ; then
228 ewarn
229 ewarn "You need to place your NX key.txt file into /usr/NX/etc/"
230 ewarn "If you don't have one already, you can get an evaluation"
231 ewarn "key, or purchase a full license, from www.nomachine.com"
232 ewarn
233 ewarn "The key.txt file must be chmod'd 0400 and must owned by"
234 ewarn "by the 'nx' user."
235 fi
236
237 if [[ ! -f ${NX_ROOT}/etc/node.cfg ]] ; then
238 ewarn
239 ewarn "To complete the installation, you must create a file called"
240 ewarn "'/usr/NX/etc/node.cfg'. An example configuration file can"
241 ewarn "be found in /usr/NX/etc"
242 fi
243 }

  ViewVC Help
Powered by ViewVC 1.1.20