Magellan Linux

Contents of /trunk/extras/nxserver-freeedition/nxserver-freeedition-4.0.181-r1.smage2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 12064 - (show annotations) (download)
Fri May 4 12:14:30 2012 UTC (12 years, 1 month ago) by niro
File size: 14815 byte(s)
-marked unstable
1 # $Id$
2
3 PNAME="nxserver-freeedition"
4 PVER="4.0.181"
5 PBUILD="r1"
6
7 PCAT="net-misc"
8 SPLIT_PACKAGES="nxcommon nxclient nxplayer nxnode nxserver-freeedition nxmanager nxwebplayer"
9
10 STATE="unstable"
11 HOMEPAGE="http://www.nomachine.com/"
12
13 # use system-wide libs or include the provided one
14 # 1=enabled, 0=disabled
15 USE_SYSTEMWIDE_LIBS=0
16
17 COMMON_DEPEND=">= virtual/glibc
18 >= sys-libs/libgcc-4.6
19 >= sys-libs/libstdc++-4.6"
20 CLIENT_DEPEND="${COMMON_DEPEND}"
21 if [[ ${USE_SYSTEMWIDE_LIBS} = 1 ]]
22 then
23 CLIENT_DEPEND="${COMMON_DEPEND}
24 >= dev-libs/expat-2
25 >= dev-libs/openssl-1
26 >= media-libs/alsa-lib-1.0.25
27 >= media-libs/fontconfig-2.9
28 >= media-libs/giflib-4.1
29 >= media-libs/libtheora-1.1
30 >= media-libs/libvorbis-1.3
31 >= media-libs/speex-1.1
32 >= sys-libs/zlib-1.2
33 >= x11-libs/libfontenc-1.1"
34 fi
35 NODE_DEPEND="${COMMON_DEPEND}"
36 SERVER_DEPEND="${COMMON_DEPEND}
37 >= sys-apps/coreutils-8
38 >= x11-apps/xauth-1
39 >= media-fonts/font-misc-misc-1
40 >= media-fonts/font-cursor-misc-1"
41 MANAGER_DEPEND="${COMMON_DEPEND}"
42 PLAYER_DEPEND="${COMMON_DEPEND}"
43 WEBPLAYER_DEPEND="${COMMON_DEPEND}"
44
45 SDEPEND="${CLIENT_DEPEND}
46 ${NODE_DEPEND}
47 ${SERVER_DEPEND}
48 ${MANAGER_DEPEND}
49 ${PLAYER_DEPEND}
50 ${WEBPLAYER_DEPEND}"
51
52 NXPVER="${PVER}-2"
53 SRCFILE_x86="nxserver-${NXPVER}.i686.tar.gz"
54 SRCFILE_x86_64="nxserver-${NXPVER}.x86_64.tar.gz"
55 SRCFILE="$(marchsrcfile)"
56 SRCDIR="${BUILDDIR}/NX"
57
58 sminclude mtools xdg
59
60 SRC_URI=(
61 http://64.34.161.181/download/${PVER%.*}/Linux/S/${SRCFILE_x86}
62 http://64.34.161.181/download/${PVER%.*}/Linux/S/${SRCFILE_x86_64}
63 mirror://${PNAME}/${SRCFILE_x86}
64 mirror://${PNAME}/${SRCFILE_x86_64}
65 mirror://${PNAME}/nxclient-wrapper
66 mirror://${PNAME}/${PNAME}-${PVER}-nxclient-magellan.patch
67 mirror://${PNAME}/${PNAME}-${PVER}-nxnode-magellan.patch
68 mirror://${PNAME}/${PNAME}-${PVER}-nxserver-magellan.patch
69 mirror://${PNAME}/${PNAME}-${PVER}-nxmanager-magellan.patch
70 mirror://${PNAME}/${PNAME}-${PVER}-nxplayer-magellan.patch
71 mirror://${PNAME}/${PNAME}-${PVER}-nxwebplayer-magellan.patch
72 )
73
74 UP2DATE="updatecmd ${HOMEPAGE}/sources.php | grep nx-X11 | sed 's/.*nx-X11-\(.*\)-.*/\1/;q'"
75
76 split_info_nxcommon()
77 {
78 DESCRIPTION="Common files for NX."
79 DEPEND=""
80 }
81
82 split_info_nxclient()
83 {
84 DESCRIPTION="A client for NX servers."
85 DEPEND="== net-misc/nxcommon-${PVER}
86 ${CLIENT_DEPEND}"
87 }
88
89 split_info_nxplayer()
90 {
91 DEPEND="== net-misc/nxcommon-${PVER}
92 == net-misc/nxclient-${PVER}
93 ${PLAYER_DEPEND}"
94 }
95
96 split_info_nxnode()
97 {
98 DESCRIPTION="Shared NX components for several NX Server Editions."
99 DEPEND="== net-misc/nxcommon-${PVER}
100 ${NODE_DEPEND}"
101 }
102
103 split_info_nxserver-freeedition()
104 {
105 DESCRIPTION="NoMachine NX Free Edition server."
106 DEPEND="== net-misc/nxcommon-${PVER}
107 == net-misc/nxnode-${PVER}
108 ${SERVER_DEPEND}"
109 }
110
111 split_info_nxmanager()
112 {
113 DESCRIPTION="Webinterface to manage NX servers."
114 DEPEND="== net-misc/nxcommon-${PVER}
115 == net-misc/nxclient-${PVER}
116 == net-misc/nxnode-${PVER}
117 == net-misc/nxserver-freeedition-${PVER}
118 ${MANAGER_DEPEND}"
119 }
120
121 split_info_nxwebplayer()
122 {
123 DEPEND="== net-misc/nxcommon-${PVER}
124 == net-misc/nxclient-${PVER}
125 == net-misc/nxnode-${PVER}
126 == net-misc/nxserver-freeedition-${PVER}
127 ${WEBPLAYER_DEPEND}"
128 }
129
130 src_prepare()
131 {
132 munpack ${SRCFILE} || die
133 cd ${SRCDIR}
134
135 # all packages are provided by this tarball
136 install -d ${SRCDIR}/src-nxclient || die
137 tar xvzf etc/NX/server/packages/nxclient.tar.gz -C src-nxclient || die
138
139 install -d ${SRCDIR}/src-nxnode || die
140 tar xvzf etc/NX/server/packages/nxnode.tar.gz -C src-nxnode || die
141
142 install -d ${SRCDIR}/src-nxserver || die
143 tar xvzf etc/NX/server/packages/nxserver.tar.gz -C src-nxserver || die
144
145 install -d ${SRCDIR}/src-nxmanager || die
146 tar xvzf etc/NX/server/packages/nxmanager.tar.gz -C src-nxmanager || die
147
148 install -d ${SRCDIR}/src-nxplayer || die
149 tar xvzf etc/NX/server/packages/nxplayer.tar.gz -C src-nxplayer || die
150
151 install -d ${SRCDIR}/src-nxwebplayer || die
152 tar xvzf etc/NX/server/packages/nxwebplayer.tar.gz -C src-nxwebplayer || die
153
154 # patch everything to be magellan compatible
155 cd ${SRCDIR}/src-nxclient
156 mpatch ${PNAME}-${PVER}-nxclient-magellan.patch || die
157
158 cd ${SRCDIR}/src-nxnode
159 mpatch ${PNAME}-${PVER}-nxnode-magellan.patch || die
160
161 cd ${SRCDIR}/src-nxserver
162 mpatch ${PNAME}-${PVER}-nxserver-magellan.patch || die
163
164 cd ${SRCDIR}/src-nxmanager
165 mpatch ${PNAME}-${PVER}-nxmanager-magellan.patch || die
166
167 cd ${SRCDIR}/src-nxplayer
168 mpatch ${PNAME}-${PVER}-nxplayer-magellan.patch || die
169
170 cd ${SRCDIR}/src-nxwebplayer
171 mpatch ${PNAME}-${PVER}-nxwebplayer-magellan.patch || die
172 }
173
174 src_install_nxcommon()
175 {
176 cd ${SRCDIR}
177 minstalldir /etc/env.d || die
178 local MCONFIG=/etc/env.d/50nx
179 mclearconfig || die
180 maddconfig 'NX_MPKG_PACKAGE="server"' || die
181 }
182
183 src_install_nxclient()
184 {
185 cd ${SRCDIR}/src-nxclient/NX
186 local i
187
188 # bin
189 minstalldir /usr/bin || die
190 minstalldir /usr/NX/bin || die
191 minstallexec bin/nxclient.bin /usr/NX/bin || die
192 for i in nxauth nxclient nxexec nxmpeg nxsh
193 do
194 minstallexec -s nxclient-wrapper /usr/bin/${i} || die
195 minstallexec bin/${i} /usr/NX/bin || die
196 done
197
198 # libs
199 minstalldir /usr/NX/lib || die
200 for i in nx nxcomp nxcompau nxcompde nxcompim nxdisp nxdispfb nxdispft nxdispex nxslavcf
201 do
202 mcopy -a lib/lib${i}.so\* /usr/NX/lib || die
203 done
204 if [[ ${USE_SYSTEMWIDE_LIBS} = 0 ]]
205 then
206 for i in asound crypto expat fontconfig fontenc freetype gif jpeg ogg png qt speex \
207 speexdsp ssl theora vorbis vorbisenc vorbisfile vpx z
208 do
209 mcopy -a lib/lib${i}.so\* /usr/NX/lib || die
210 done
211 fi
212
213 # other components
214 mcopy -R scripts /usr/NX || die
215 mcopy -R share /usr/NX || die
216 # fix permissions
217 mchmod 0755 /usr/NX/scripts/setup/nxclient || die
218
219 # global config
220 minstalldir /etc/NX/server/localhost || die
221 minstallfile scripts/etc/localhost/client.cfg /etc/NX/server/localhost || die
222
223 # install some desktop icons
224 minstallpixmap share/icons/48x48/NoMachine-icon.png nxclient.png
225 minstall_desktop_icon \
226 --name NXClient \
227 --comment "NoMachine NX Client" \
228 --file "nxclient" \
229 --exec "nxclient" \
230 --icon "nxclient.png" \
231 --categories Network \
232 || die
233
234 minstallpixmap share/icons/48x48/NoMachine-admin.png nxadmin.png
235 minstall_desktop_icon \
236 --name NXAdmin \
237 --comment "NoMachine NX Administration Console" \
238 --file "nxadmin" \
239 --exec "nxclient --admin" \
240 --icon "nxadmin.png" \
241 --categories Network \
242 || die
243
244 minstallpixmap share/icons/48x48/NoMachine-icon.png nxwizard.png
245 minstall_desktop_icon \
246 --name NXWizard \
247 --comment "NoMachine NX Configuration Wizard" \
248 --file "nxwizard" \
249 --exec "nxclient --wizard" \
250 --icon "nxwizard.png" \
251 --categories Network \
252 || die
253 }
254
255 src_install_nxnode()
256 {
257 cd ${SRCDIR}/src-nxnode/NX
258 local i
259
260 # bin
261 minstalldir /usr/NX/bin || die
262 for i in nxadministrator{,.bin} nxagent nxkbcomp nxnode{,.bin} nxprint nxsensor nxspool
263 do
264 minstallexec bin/${i} /usr/NX/bin || die
265 done
266
267 # other components
268 for i in home lib scripts share
269 do
270 mcopy -R ${i} /usr/NX || die
271 done
272 # fix permissions
273 mchmod 0755 /usr/NX/scripts/setup/nxnode || die
274
275 # etc
276 minstalldir /usr/NX/etc || die
277 minstallfile etc/node-debian.cfg.sample /usr/NX/etc/node-magellan.cfg.sample || die
278 minstallfile etc/node-debian.cfg.sample.personal /usr/NX/etc/node-magellan.cfg.sample.personal || die
279 minstallfile etc/node.lic.sample /usr/NX/etc/node.lic.sample || die
280
281 # fix authorized keys
282 sed -i 's:#SSHAuthorizedKeys .*: SSHAuthorizedKeys $(HOME)/.ssh/authorized_keys:' ${BINDIR}/usr/NX/etc/node-magellan.cfg.sample || die
283 sed -i 's:#SSHAuthorizedKeys .*: SSHAuthorizedKeys $(HOME)/.ssh/authorized_keys:' ${BINDIR}/usr/NX/etc/node-magellan.cfg.sample.personal || die
284
285 # global config
286 minstalldir /etc/NX/server/localhost || die
287 minstallfile scripts/etc/localhost/node.cfg /etc/NX/server/localhost || die
288 minstallexec scripts/etc/nxnode /etc/NX || die
289 }
290
291 src_install_nxserver-freeedition()
292 {
293 cd ${SRCDIR}/src-nxserver/NX
294 local i
295
296 # bin
297 minstalldir /usr/NX/bin || die
298 for i in nxhttpd{,.bin} nxserver{,.bin} nxstat{,.bin}
299 do
300 minstallexec bin/${i} /usr/NX/bin || die
301 done
302
303 # other components
304 for i in lib scripts share var
305 do
306 mcopy -R ${i} /usr/NX || die
307 done
308 # fix permissions
309 mchmod 0755 /usr/NX/scripts/setup/nxserver || die
310
311 # ssh-keys
312 minstalldir /usr/NX/etc || die
313 mcopy -R etc/keys /usr/NX/etc || die
314
315 # http-server cert
316 minstallfile etc/httpd.crt /usr/NX/etc || die
317 minstallfile etc/httpd.key /usr/NX/etc || die
318
319 # mimetypes and magic
320 minstallfile etc/magic /usr/NX/etc || die
321 minstallfile etc/mime.types /usr/NX/etc || die
322
323 # some sample configs
324 minstallfile etc/administrators.db.sample /usr/NX/etc || die
325 minstallfile etc/guests.db.sample /usr/NX/etc || die
326 minstallfile etc/httpd.cfg.sample /usr/NX/etc || die
327 minstallfile etc/passwords.db.sample /usr/NX/etc || die
328 minstallfile etc/profiles.db.sample /usr/NX/etc || die
329 minstallfile etc/users.db.sample /usr/NX/etc || die
330 minstallfile etc/server.lic.sample /usr/NX/etc || die
331 minstallfile etc/server-debian.cfg.sample /usr/NX/etc/server-magellan.cfg.sample || die
332
333 # fix authorized keys
334 sed -i 's:#SSHAuthorizedKeys .*:SSHAuthorizedKeys authorized_keys:' ${BINDIR}/usr/NX/etc/server-magellan.cfg.sample || die
335
336 # global config
337 minstalldir /etc/NX/server/localhost || die
338 minstallfile scripts/etc/localhost/server.cfg /etc/NX/server/localhost || die
339 minstallexec scripts/etc/nxserver /etc/NX || die
340 }
341
342 src_install_nxmanager()
343 {
344 cd ${SRCDIR}/src-nxmanager/NX
345 local i
346
347 # bin
348 minstalldir /usr/NX/bin || die
349 for i in nxmanager{,.bin}
350 do
351 minstallexec bin/${i} /usr/NX/bin || die
352 done
353
354 # other components
355 for i in lib scripts share var
356 do
357 mcopy -R ${i} /usr/NX || die
358 done
359 # fix permissions
360 mchmod 0755 /usr/NX/scripts/setup/nxmanager || die
361
362 # configs
363 minstalldir /usr/NX/etc || die
364 minstallfile etc/manager.cfg.sample /usr/NX/etc || die
365 minstallfile etc/manager.inc.sample /usr/NX/etc || die
366
367 # global config
368 minstalldir /etc/NX/server/localhost || die
369 minstallfile scripts/etc/localhost/manager.cfg /etc/NX/server/localhost || die
370 minstallexec scripts/etc/nxmanager /etc/NX || die
371 }
372
373 src_install_nxplayer()
374 {
375 cd ${SRCDIR}/src-nxplayer/NX
376 local i
377
378 # bin
379 minstalldir /usr/bin || die
380 minstalldir /usr/NX/bin || die
381 minstallexec bin/nxplayer.bin /usr/NX/bin || die
382 for i in nxesd nxplayer
383 do
384 minstallexec -s nxclient-wrapper /usr/bin/${i} || die
385 minstallexec bin/${i} /usr/NX/bin || die
386 done
387
388 # other components
389 mcopy -R scripts /usr/NX || die
390 mcopy -R share /usr/NX || die
391 # fix permissions
392 mchmod 0755 /usr/NX/scripts/setup/nxplayer || die
393
394 # global config
395 minstalldir /etc/NX/server/localhost || die
396 minstallfile scripts/etc/localhost/player.cfg /etc/NX/server/localhost || die
397
398 # install some desktop icons
399 minstallpixmap share/icons/48x48/nxplayer-icon.png nxplayer.png
400 minstall_desktop_icon \
401 --name NXPlayer \
402 --comment "NoMachine NX Client Player" \
403 --file "nxplayer" \
404 --exec "nxplayer" \
405 --icon "nxplayer.png" \
406 --categories Network \
407 || die
408 }
409
410 src_install_nxwebplayer()
411 {
412 cd ${SRCDIR}/src-nxwebplayer/NX
413 local i
414
415 # bin
416 minstalldir /usr/NX/bin || die
417 for i in nxwebclient{,.bin} nxwebplayer{,.bin}
418 do
419 minstallexec bin/${i} /usr/NX/bin || die
420 done
421
422 # other components
423 for i in lib scripts share var
424 do
425 mcopy -R ${i} /usr/NX || die
426 done
427 # fix permissions
428 mchmod 0755 /usr/NX/scripts/setup/nxwebplayer || die
429
430 # configs
431 minstalldir /usr/NX/etc || die
432 minstallfile etc/webplayer.cfg.sample /usr/NX/etc || die
433 minstallfile etc/webplayer.inc.sample /usr/NX/etc || die
434
435 # global config
436 minstalldir /etc/NX/server/localhost || die
437 minstallfile scripts/etc/localhost/webplayer.cfg /etc/NX/server/localhost || die
438 minstallexec scripts/etc/nxwebplayer /etc/NX || die
439 }
440
441 preinstall_nxserver-freeedition()
442 {
443 # abort install if freenx is installed
444 if [[ -n $(magequery -n nxserver-freenx) ]]
445 then
446 echo
447 echo "You have 'net-misc/nxserver-freenx' installed on your system."
448 echo
449 echo "Both ${PCAT}/${PNAME} and 'net-misc/nxserver-freenx'"
450 echo "cannot be installed at the same time. Please uninstall nxserver-freenx first!"
451 echo
452 die "net-misc/nxserver-freenx found."
453 fi
454 }
455
456 postinstall_nxclient()
457 {
458 if [[ -f /usr/NX/etc/client.cfg ]]
459 then
460 echo "Running NoMachine's update script"
461 ${MROOT}/usr/NX/scripts/setup/nxclient --update
462 else
463 echo "Running NoMachine's setup script"
464 ${MROOT}/usr/NX/scripts/setup/nxclient --install
465 fi
466 }
467
468 postinstall_nxnode()
469 {
470 ${MLIBDIR}/mgroupadd nx
471 ${MLIBDIR}/museradd -o "-g nx -s /usr/NX/bin/nxserver -d /usr/NX/home/nx" nx
472
473 # autoscramble nx system-user password if none was set
474 if [[ -n $(passwd -S nx | grep ' NP ') ]]
475 then
476 usermod -p $(openssl passwd -1 $(mktemp -u | cut -d. -f2)) nx
477 fi
478
479 if [[ ! -f /usr/NX/etc/node.lic ]]
480 then
481 cp ${MROOT}/usr/NX/etc/node.lic.sample ${MROOT}/usr/NX/etc/node.lic || die
482 chmod 0400 ${MROOT}/usr/NX/etc/node.lic
483 chown nx:root ${MROOT}/usr/NX/etc/node.lic
484 fi
485
486 if [[ -f /usr/NX/etc/node.cfg ]]
487 then
488 echo "Running NoMachine's update script"
489 ${MROOT}/usr/NX/scripts/setup/nxnode --update
490 else
491 echo "Running NoMachine's setup script"
492 ${MROOT}/usr/NX/scripts/setup/nxnode --install
493 fi
494 }
495
496 postinstall_nxserver-freeedition()
497 {
498 ${MLIBDIR}/mgroupadd nxhttpd
499 ${MLIBDIR}/museradd -o "-g nxhttpd -s /bin/false -d /usr/NX/share/htdocs" nxhttpd
500
501 # autoscramble nxhttpd system-user password if none was set
502 if [[ -n $(passwd -S nxhttpd | grep ' NP ') ]]
503 then
504 usermod -p $(openssl passwd -1 $(mktemp -u | cut -d. -f2)) nxhttpd
505 fi
506
507 # only run install when no configuration file is found
508 if [[ -f /usr/NX/etc/server.cfg ]]
509 then
510 echo "Running NoMachine's update script"
511 ${MROOT}/usr/NX/scripts/setup/nxserver --update
512 else
513 echo "Running NoMachine's setup script"
514 ${MROOT}/usr/NX/scripts/setup/nxserver --install
515 fi
516
517 echo
518 echo "You also need to set a password for the user nx or pam permits ssh logins."
519 echo "To add a NX user run '/usr/NX/bin/nxserver --useradd [username]'"
520 echo "and set a password with '/usr/NX/bin/nxserver --passwd [username]'."
521 echo
522 }
523
524 postinstall_nxmanager()
525 {
526 if [[ -f /usr/NX/etc/manager.cfg ]]
527 then
528 echo "Running NoMachine's update script"
529 ${MROOT}/usr/NX/scripts/setup/nxmanager --update
530 else
531 echo "Running NoMachine's setup script"
532 ${MROOT}/usr/NX/scripts/setup/nxmanager --install
533 fi
534 }
535
536 postinstall_nxplayer()
537 {
538 if [[ -f /usr/NX/etc/player.cfg ]]
539 then
540 echo "Running NoMachine's update script"
541 ${MROOT}/usr/NX/scripts/setup/nxplayer --update
542 else
543 echo "Running NoMachine's setup script"
544 ${MROOT}/usr/NX/scripts/setup/nxplayer --install
545 fi
546 }
547
548 postinstall_nxwebplayer()
549 {
550 if [[ -f /usr/NX/etc/webplayer.cfg ]]
551 then
552 echo "Running NoMachine's update script"
553 ${MROOT}/usr/NX/scripts/setup/nxwebplayer --update
554 else
555 echo "Running NoMachine's setup script"
556 ${MROOT}/usr/NX/scripts/setup/nxwebplayer --install
557 fi
558 }