Magellan Linux

Contents of /trunk/deprecated/nxserver-freeedition/nxserver-freeedition-4.0.181-r2.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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