Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 12138 - (hide annotations) (download)
Tue May 8 11:18:00 2012 UTC (12 years, 1 month ago) by niro
Original Path: trunk/extras/nxserver-freeedition/nxserver-freeedition-4.0.181-r2.smage2
File size: 15284 byte(s)
-serveral fixes, fixed authorized_keyfile handling, included required config files in the patchset, fixed nx/nxhttpd user issues
1 niro 12138 # $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     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     # 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     for i in asound crypto expat fontconfig fontenc freetype gif jpeg ogg png qt speex \
227     speexdsp ssl theora vorbis vorbisenc vorbisfile vpx z
228     do
229     mcopy -a lib/lib${i}.so\* /usr/NX/lib || die
230     done
231     fi
232    
233     # other components
234     mcopy -R scripts /usr/NX || die
235     mcopy -R share /usr/NX || die
236     # fix permissions
237     mchmod 0755 /usr/NX/scripts/setup/nxclient || die
238    
239     # global config
240     minstalldir /etc/NX/server/localhost || die
241     minstallfile scripts/etc/localhost/client.cfg /etc/NX/server/localhost || die
242    
243     # install some desktop icons
244     minstallpixmap share/icons/48x48/NoMachine-icon.png nxclient.png
245     minstall_desktop_icon \
246     --name NXClient \
247     --comment "NoMachine NX Client" \
248     --file "nxclient" \
249     --exec "nxclient" \
250     --icon "nxclient.png" \
251     --categories Network \
252     || die
253    
254     minstallpixmap share/icons/48x48/NoMachine-admin.png nxadmin.png
255     minstall_desktop_icon \
256     --name NXAdmin \
257     --comment "NoMachine NX Administration Console" \
258     --file "nxadmin" \
259     --exec "nxclient --admin" \
260     --icon "nxadmin.png" \
261     --categories Network \
262     || die
263    
264     minstallpixmap share/icons/48x48/NoMachine-icon.png nxwizard.png
265     minstall_desktop_icon \
266     --name NXWizard \
267     --comment "NoMachine NX Configuration Wizard" \
268     --file "nxwizard" \
269     --exec "nxclient --wizard" \
270     --icon "nxwizard.png" \
271     --categories Network \
272     || die
273     }
274    
275     src_install_nxnode()
276     {
277     cd ${SRCDIR}/src-nxnode/NX
278     local i
279    
280     # bin
281     minstalldir /usr/NX/bin || die
282     for i in nxadministrator{,.bin} nxagent nxkbcomp nxnode{,.bin} nxprint nxsensor nxspool
283     do
284     minstallexec bin/${i} /usr/NX/bin || die
285     done
286    
287     # other components
288     for i in home lib scripts share
289     do
290     mcopy -R ${i} /usr/NX || die
291     done
292     # fix permissions
293     mchown -R nx:root /usr/NX/home/nx || die
294     mchmod 0700 /usr/NX/home/nx || die
295     mchmod 0755 /usr/NX/scripts/setup/nxnode || die
296    
297     # etc
298     minstalldir /usr/NX/etc || die
299     minstallfile etc/node-magellan.cfg.sample /usr/NX/etc || die
300     minstallfile etc/node-magellan.cfg.sample.personal /usr/NX/etc || die
301     minstallfile etc/node.lic.sample /usr/NX/etc || die
302    
303     # global config
304     minstalldir /etc/NX/server/localhost || die
305     minstallfile scripts/etc/localhost/node.cfg /etc/NX/server/localhost || die
306     minstallexec scripts/etc/nxnode /etc/NX || die
307     }
308    
309     src_install_nxserver-freeedition()
310     {
311     cd ${SRCDIR}/src-nxserver/NX
312     local i
313    
314     # bin
315     minstalldir /usr/NX/bin || die
316     for i in nxhttpd{,.bin} nxserver{,.bin} nxstat{,.bin}
317     do
318     minstallexec bin/${i} /usr/NX/bin || die
319     done
320    
321     # other components
322     for i in lib scripts share var
323     do
324     mcopy -R ${i} /usr/NX || die
325     done
326     # fix permissions
327     mchmod 0755 /usr/NX/scripts/setup/nxserver || die
328    
329     # ssh-keys
330     minstalldir /usr/NX/etc || die
331     mcopy -R etc/keys /usr/NX/etc || die
332    
333     # http-server cert
334     minstallfile etc/httpd.crt /usr/NX/etc || die
335     minstallfile etc/httpd.key /usr/NX/etc || die
336    
337     # mimetypes and magic
338     minstallfile etc/magic /usr/NX/etc || die
339     minstallfile etc/mime.types /usr/NX/etc || die
340    
341     # some sample configs
342     minstallfile etc/administrators.db.sample /usr/NX/etc || die
343     minstallfile etc/guests.db.sample /usr/NX/etc || die
344     minstallfile etc/httpd.cfg.sample /usr/NX/etc || die
345     minstallfile etc/passwords.db.sample /usr/NX/etc || die
346     minstallfile etc/profiles.db.sample /usr/NX/etc || die
347     minstallfile etc/users.db.sample /usr/NX/etc || die
348     minstallfile etc/server.lic.sample /usr/NX/etc || die
349     minstallfile etc/server-magellan.cfg.sample /usr/NX/etc || die
350    
351     # global config
352     minstalldir /etc/NX/server/localhost || die
353     minstallfile scripts/etc/localhost/server.cfg /etc/NX/server/localhost || die
354     minstallexec scripts/etc/nxserver /etc/NX || die
355     }
356    
357     src_install_nxmanager()
358     {
359     cd ${SRCDIR}/src-nxmanager/NX
360     local i
361    
362     # bin
363     minstalldir /usr/NX/bin || die
364     for i in nxmanager{,.bin}
365     do
366     minstallexec bin/${i} /usr/NX/bin || die
367     done
368    
369     # other components
370     for i in lib scripts share var
371     do
372     mcopy -R ${i} /usr/NX || die
373     done
374     # fix permissions
375     mchmod 0755 /usr/NX/scripts/setup/nxmanager || die
376    
377     # configs
378     minstalldir /usr/NX/etc || die
379     minstallfile etc/manager.cfg.sample /usr/NX/etc || die
380     minstallfile etc/manager.inc.sample /usr/NX/etc || die
381    
382     # global config
383     minstalldir /etc/NX/server/localhost || die
384     minstallfile scripts/etc/localhost/manager.cfg /etc/NX/server/localhost || die
385     minstallexec scripts/etc/nxmanager /etc/NX || die
386     }
387    
388     src_install_nxplayer()
389     {
390     cd ${SRCDIR}/src-nxplayer/NX
391     local i
392    
393     # bin
394     minstalldir /usr/bin || die
395     minstalldir /usr/NX/bin || die
396     minstallexec bin/nxplayer.bin /usr/NX/bin || die
397     for i in nxesd nxplayer
398     do
399     minstallexec -s nxclient-wrapper /usr/bin/${i} || die
400     minstallexec bin/${i} /usr/NX/bin || die
401     done
402    
403     # other components
404     mcopy -R scripts /usr/NX || die
405     mcopy -R share /usr/NX || die
406     # fix permissions
407     mchmod 0755 /usr/NX/scripts/setup/nxplayer || die
408    
409     # global config
410     minstalldir /etc/NX/server/localhost || die
411     minstallfile scripts/etc/localhost/player.cfg /etc/NX/server/localhost || die
412    
413     # install some desktop icons
414     minstallpixmap share/icons/48x48/nxplayer-icon.png nxplayer.png
415     minstall_desktop_icon \
416     --name NXPlayer \
417     --comment "NoMachine NX Client Player" \
418     --file "nxplayer" \
419     --exec "nxplayer" \
420     --icon "nxplayer.png" \
421     --categories Network \
422     || die
423     }
424    
425     src_install_nxwebplayer()
426     {
427     cd ${SRCDIR}/src-nxwebplayer/NX
428     local i
429    
430     # bin
431     minstalldir /usr/NX/bin || die
432     for i in nxwebclient{,.bin} nxwebplayer{,.bin}
433     do
434     minstallexec bin/${i} /usr/NX/bin || die
435     done
436    
437     # other components
438     for i in lib scripts share var
439     do
440     mcopy -R ${i} /usr/NX || die
441     done
442     # fix permissions
443     mchmod 0755 /usr/NX/scripts/setup/nxwebplayer || die
444    
445     # configs
446     minstalldir /usr/NX/etc || die
447     minstallfile etc/webplayer.cfg.sample /usr/NX/etc || die
448     minstallfile etc/webplayer.inc.sample /usr/NX/etc || die
449    
450     # global config
451     minstalldir /etc/NX/server/localhost || die
452     minstallfile scripts/etc/localhost/webplayer.cfg /etc/NX/server/localhost || die
453     minstallexec scripts/etc/nxwebplayer /etc/NX || die
454     }
455    
456     preinstall_nxnode()
457     {
458     ${MLIBDIR}/mgroupadd nx
459     ${MLIBDIR}/museradd -o "-g nx -s /usr/NX/bin/nxserver -d /usr/NX/home/nx" nx
460     }
461    
462     preinstall_nxserver-freeedition()
463     {
464     # abort install if freenx is installed
465     if [[ -n $(magequery -n nxserver-freenx) ]]
466     then
467     echo
468     echo "You have 'net-misc/nxserver-freenx' installed on your system."
469     echo
470     echo "Both ${PCAT}/${PNAME} and 'net-misc/nxserver-freenx'"
471     echo "cannot be installed at the same time. Please uninstall nxserver-freenx first!"
472     echo
473     die "net-misc/nxserver-freenx found."
474     fi
475    
476     ${MLIBDIR}/mgroupadd nxhttpd
477     ${MLIBDIR}/museradd -o "-g nxhttpd -s /bin/false -d /usr/NX/share/htdocs" nxhttpd
478     }
479    
480     postinstall_nxclient()
481     {
482     if [[ -f /usr/NX/etc/client.cfg ]]
483     then
484     echo "Running NoMachine's update script"
485     ${MROOT}/usr/NX/scripts/setup/nxclient --update
486     else
487     echo "Running NoMachine's setup script"
488     ${MROOT}/usr/NX/scripts/setup/nxclient --install
489     fi
490     }
491    
492     postinstall_nxnode()
493     {
494     # autoscramble nx system-user password if none was set
495     if [[ -n $(passwd -S nx | grep '[[:space:]][N|L][P| ]') ]]
496     then
497     usermod -p $(openssl passwd -1 $(mktemp -u | cut -d. -f2)) nx
498     fi
499    
500     if [[ ! -d /usr/NX/home/nx ]]
501     then
502     install /usr/NX/home/nx
503     fi
504     chown -R nx:root /usr/NX/home/nx
505     chmod 0700 /usr/NX/home/nx
506    
507     if [[ ! -f /usr/NX/etc/node.lic ]]
508     then
509     cp ${MROOT}/usr/NX/etc/node.lic.sample ${MROOT}/usr/NX/etc/node.lic || die
510     chown nx:root ${MROOT}/usr/NX/etc/node.lic
511     chmod 0400 ${MROOT}/usr/NX/etc/node.lic
512     fi
513    
514     if [[ -f /usr/NX/etc/node.cfg ]]
515     then
516     echo "Running NoMachine's update script"
517     ${MROOT}/usr/NX/scripts/setup/nxnode --update
518     else
519     echo "Running NoMachine's setup script"
520     ${MROOT}/usr/NX/scripts/setup/nxnode --install
521     fi
522     }
523    
524     postinstall_nxserver-freeedition()
525     {
526     # autoscramble nxhttpd system-user password if none was set
527     if [[ -n $(passwd -S nxhttpd | grep '[[:space:]][N|L][P| ]') ]]
528     then
529     usermod -p $(openssl passwd -1 $(mktemp -u | cut -d. -f2)) nxhttpd
530     fi
531    
532     # only run install when no configuration file is found
533     if [[ -f /usr/NX/etc/server.cfg ]]
534     then
535     echo "Running NoMachine's update script"
536     ${MROOT}/usr/NX/scripts/setup/nxserver --update
537     else
538     echo "Running NoMachine's setup script"
539     ${MROOT}/usr/NX/scripts/setup/nxserver --install
540     fi
541    
542     echo
543     echo "You also need to set a password for the user nx or pam permits ssh logins."
544     echo "To add a NX user run '/usr/NX/bin/nxserver --useradd [username]'"
545     echo "and set a password with '/usr/NX/bin/nxserver --passwd [username]'."
546     echo
547     }
548    
549     postinstall_nxmanager()
550     {
551     if [[ -f /usr/NX/etc/manager.cfg ]]
552     then
553     echo "Running NoMachine's update script"
554     ${MROOT}/usr/NX/scripts/setup/nxmanager --update
555     else
556     echo "Running NoMachine's setup script"
557     ${MROOT}/usr/NX/scripts/setup/nxmanager --install
558     fi
559    
560     # restart nx
561     if [[ ! -z $(/etc/NX/nxserver --status | grep "nxserver enabled") ]]
562     then
563     /etc/NX/nxserver --restart
564     fi
565     }
566    
567     postinstall_nxplayer()
568     {
569     if [[ -f /usr/NX/etc/player.cfg ]]
570     then
571     echo "Running NoMachine's update script"
572     ${MROOT}/usr/NX/scripts/setup/nxplayer --update
573     else
574     echo "Running NoMachine's setup script"
575     ${MROOT}/usr/NX/scripts/setup/nxplayer --install
576     fi
577     }
578    
579     postinstall_nxwebplayer()
580     {
581     if [[ -f /usr/NX/etc/webplayer.cfg ]]
582     then
583     echo "Running NoMachine's update script"
584     ${MROOT}/usr/NX/scripts/setup/nxwebplayer --update
585     else
586     echo "Running NoMachine's setup script"
587     ${MROOT}/usr/NX/scripts/setup/nxwebplayer --install
588     fi
589    
590     # restart nx
591     if [[ ! -z $(/etc/NX/nxserver --status | grep "nxserver enabled") ]]
592     then
593     /etc/NX/nxserver --restart
594     fi
595     }