# $Id$ PNAME="nxserver-freeedition" PVER="4.0.181" PBUILD="r2" PCAT="net-misc" SPLIT_PACKAGES="nxcommon nxclient nxplayer nxnode nxserver-freeedition nxmanager nxwebplayer" STATE="unstable" HOMEPAGE="http://www.nomachine.com/" # use system-wide libs or include the provided one # 1=enabled, 0=disabled USE_SYSTEMWIDE_LIBS=0 COMMON_DEPEND=">= virtual/glibc >= sys-libs/libgcc-4.6 >= sys-libs/libstdc++-4.6" CLIENT_DEPEND="${COMMON_DEPEND} >= dev-libs/openssl-1" if [[ ${USE_SYSTEMWIDE_LIBS} = 1 ]] then CLIENT_DEPEND="${COMMON_DEPEND} >= dev-libs/expat-2 >= media-libs/alsa-lib-1.0.25 >= media-libs/fontconfig-2.9 >= media-libs/giflib-4.1 >= media-libs/libtheora-1.1 >= media-libs/libvorbis-1.3 >= media-libs/speex-1.1 >= sys-libs/zlib-1.2 >= x11-libs/libfontenc-1.1" fi # todo: gdsu NODE_DEPEND="${COMMON_DEPEND} >= sys-apps/gawk-4.0 >= sys-apps/coreutils-8 >= sys-apps/lsof-4.86 >= sys-apps/sed-4 >= sys-apps/procps-3.2 >= sys-apps/sysvinit-tools-2.88 >= x11-apps/xdpyinfo-1.3 >= x11-apps/xmodmap-1 >= x11-apps/xkbcomp-1.2 >= net-misc/openssh-6.0 >= net-misc/rdesktop-1.7 >= virtual/vnc-client" SERVER_DEPEND="${COMMON_DEPEND} >= x11-apps/xauth-1 >= media-fonts/font-misc-misc-1 >= media-fonts/font-cursor-misc-1" MANAGER_DEPEND="${COMMON_DEPEND}" PLAYER_DEPEND="${COMMON_DEPEND} >= media-sound/pulseaudio-x11-1.1" WEBPLAYER_DEPEND="${COMMON_DEPEND}" SDEPEND="${CLIENT_DEPEND} ${NODE_DEPEND} ${SERVER_DEPEND} ${MANAGER_DEPEND} ${PLAYER_DEPEND} ${WEBPLAYER_DEPEND}" NXPVER="${PVER}-2" SRCFILE_x86="nxserver-${NXPVER}.i686.tar.gz" SRCFILE_x86_64="nxserver-${NXPVER}.x86_64.tar.gz" SRCFILE="$(marchsrcfile)" SRCDIR="${BUILDDIR}/NX" sminclude mtools xdg SRC_URI=( http://64.34.161.181/download/${PVER%.*}/Linux/S/${SRCFILE_x86} http://64.34.161.181/download/${PVER%.*}/Linux/S/${SRCFILE_x86_64} mirror://${PNAME}/${SRCFILE_x86} mirror://${PNAME}/${SRCFILE_x86_64} mirror://${PNAME}/nxclient-wrapper mirror://${PNAME}/${PNAME}-${PVER}-nxclient-magellan.patch mirror://${PNAME}/${PNAME}-${PVER}-nxnode-magellan-2.patch mirror://${PNAME}/${PNAME}-${PVER}-nxserver-magellan-2.patch mirror://${PNAME}/${PNAME}-${PVER}-nxmanager-magellan.patch mirror://${PNAME}/${PNAME}-${PVER}-nxplayer-magellan.patch mirror://${PNAME}/${PNAME}-${PVER}-nxwebplayer-magellan.patch ) UP2DATE="updatecmd ${HOMEPAGE}/sources.php | grep nx-X11 | sed 's/.*nx-X11-\(.*\)-.*/\1/;q'" split_info_nxcommon() { DESCRIPTION="Common files for NX." DEPEND="" } split_info_nxclient() { DESCRIPTION="A client for NX servers." DEPEND="== net-misc/nxcommon-${PVER} ${CLIENT_DEPEND}" } split_info_nxplayer() { DEPEND="== net-misc/nxcommon-${PVER} == net-misc/nxclient-${PVER} ${PLAYER_DEPEND}" } split_info_nxnode() { DESCRIPTION="Shared NX components for several NX Server Editions." # nxclient includes the server certificate requiered by nxnode DEPEND="== net-misc/nxcommon-${PVER} == net-misc/nxclient-${PVER} ${NODE_DEPEND}" } split_info_nxserver-freeedition() { DESCRIPTION="NoMachine NX Free Edition server." DEPEND="== net-misc/nxcommon-${PVER} == net-misc/nxnode-${PVER} ${SERVER_DEPEND}" } split_info_nxmanager() { DESCRIPTION="Webinterface to manage NX servers." DEPEND="== net-misc/nxcommon-${PVER} == net-misc/nxclient-${PVER} == net-misc/nxnode-${PVER} == net-misc/nxserver-freeedition-${PVER} ${MANAGER_DEPEND}" } split_info_nxwebplayer() { DEPEND="== net-misc/nxcommon-${PVER} == net-misc/nxclient-${PVER} == net-misc/nxnode-${PVER} == net-misc/nxserver-freeedition-${PVER} == net-misc/nxplayer-${PVER} ${WEBPLAYER_DEPEND}" } src_prepare() { munpack ${SRCFILE} || die cd ${SRCDIR} # all packages are provided by this tarball install -d ${SRCDIR}/src-nxclient || die tar xvzf etc/NX/server/packages/nxclient.tar.gz -C src-nxclient || die install -d ${SRCDIR}/src-nxnode || die tar xvzf etc/NX/server/packages/nxnode.tar.gz -C src-nxnode || die install -d ${SRCDIR}/src-nxserver || die tar xvzf etc/NX/server/packages/nxserver.tar.gz -C src-nxserver || die install -d ${SRCDIR}/src-nxmanager || die tar xvzf etc/NX/server/packages/nxmanager.tar.gz -C src-nxmanager || die install -d ${SRCDIR}/src-nxplayer || die tar xvzf etc/NX/server/packages/nxplayer.tar.gz -C src-nxplayer || die install -d ${SRCDIR}/src-nxwebplayer || die tar xvzf etc/NX/server/packages/nxwebplayer.tar.gz -C src-nxwebplayer || die # patch everything to be magellan compatible cd ${SRCDIR}/src-nxclient mpatch ${PNAME}-${PVER}-nxclient-magellan.patch || die cd ${SRCDIR}/src-nxnode mpatch ${PNAME}-${PVER}-nxnode-magellan-2.patch || die cd ${SRCDIR}/src-nxserver mpatch ${PNAME}-${PVER}-nxserver-magellan-2.patch || die cd ${SRCDIR}/src-nxmanager mpatch ${PNAME}-${PVER}-nxmanager-magellan.patch || die cd ${SRCDIR}/src-nxplayer mpatch ${PNAME}-${PVER}-nxplayer-magellan.patch || die cd ${SRCDIR}/src-nxwebplayer mpatch ${PNAME}-${PVER}-nxwebplayer-magellan.patch || die } src_install_nxcommon() { cd ${SRCDIR} minstalldir /etc/env.d || die local MCONFIG=/etc/env.d/50nx mclearconfig || die maddconfig 'NX_MPKG_PACKAGE="server"' || die maddconfig 'CONFIG_PROTECT_MASK="/etc/NX"' || die } src_install_nxclient() { cd ${SRCDIR}/src-nxclient/NX local i # bin minstalldir /usr/bin || die minstalldir /usr/NX/bin || die minstallexec bin/nxclient.bin /usr/NX/bin || die for i in nxauth nxclient nxexec nxmpeg nxsh do minstallexec -s nxclient-wrapper /usr/bin/${i} || die minstallexec bin/${i} /usr/NX/bin || die done # libs minstalldir /usr/NX/lib || die for i in nx nxcomp nxcompau nxcompde nxcompim nxdisp nxdispfb nxdispft nxdispex nxslavcf do mcopy -a lib/lib${i}.so\* /usr/NX/lib || die done if [[ ${USE_SYSTEMWIDE_LIBS} = 0 ]] then # do not install libcrypto and libssl or the local ssh-server may fail for i in asound expat fontconfig fontenc freetype gif jpeg ogg png qt \ speex speexdsp theora vorbis vorbisenc vorbisfile vpx z do mcopy -a lib/lib${i}.so\* /usr/NX/lib || die done fi # other components mcopy -R scripts /usr/NX || die mcopy -R share /usr/NX || die # fix permissions mchmod 0755 /usr/NX/scripts/setup/nxclient || die # global config minstalldir /etc/NX/server/localhost || die minstallfile scripts/etc/localhost/client.cfg /etc/NX/server/localhost || die # install some desktop icons minstallpixmap share/icons/48x48/NoMachine-icon.png nxclient.png minstall_desktop_icon \ --name NXClient \ --comment "NoMachine NX Client" \ --file "nxclient" \ --exec "nxclient" \ --icon "nxclient.png" \ --categories Network \ || die minstallpixmap share/icons/48x48/NoMachine-admin.png nxadmin.png minstall_desktop_icon \ --name NXAdmin \ --comment "NoMachine NX Administration Console" \ --file "nxadmin" \ --exec "nxclient --admin" \ --icon "nxadmin.png" \ --categories Network \ || die minstallpixmap share/icons/48x48/NoMachine-icon.png nxwizard.png minstall_desktop_icon \ --name NXWizard \ --comment "NoMachine NX Configuration Wizard" \ --file "nxwizard" \ --exec "nxclient --wizard" \ --icon "nxwizard.png" \ --categories Network \ || die } src_install_nxnode() { cd ${SRCDIR}/src-nxnode/NX local i # bin minstalldir /usr/NX/bin || die for i in nxadministrator{,.bin} nxagent nxkbcomp nxnode{,.bin} nxprint nxsensor nxspool do minstallexec bin/${i} /usr/NX/bin || die done # other components for i in home lib scripts share do mcopy -R ${i} /usr/NX || die done # fix permissions mchown -R nx:root /usr/NX/home/nx || die mchmod 0700 /usr/NX/home/nx || die mchmod 0755 /usr/NX/scripts/setup/nxnode || die # etc minstalldir /usr/NX/etc || die minstallfile etc/node-magellan.cfg.sample /usr/NX/etc || die minstallfile etc/node-magellan.cfg.sample.personal /usr/NX/etc || die minstallfile etc/node.lic.sample /usr/NX/etc || die # global config minstalldir /etc/NX/server/localhost || die minstallfile scripts/etc/localhost/node.cfg /etc/NX/server/localhost || die minstallexec scripts/etc/nxnode /etc/NX || die } src_install_nxserver-freeedition() { cd ${SRCDIR}/src-nxserver/NX local i # bin minstalldir /usr/NX/bin || die for i in nxhttpd{,.bin} nxserver{,.bin} nxstat{,.bin} do minstallexec bin/${i} /usr/NX/bin || die done # other components for i in lib scripts share var do mcopy -R ${i} /usr/NX || die done # fix permissions mchmod 0755 /usr/NX/scripts/setup/nxserver || die # ssh-keys minstalldir /usr/NX/etc || die mcopy -R etc/keys /usr/NX/etc || die # http-server cert minstallfile etc/httpd.crt /usr/NX/etc || die minstallfile etc/httpd.key /usr/NX/etc || die # mimetypes and magic minstallfile etc/magic /usr/NX/etc || die minstallfile etc/mime.types /usr/NX/etc || die # some sample configs minstallfile etc/administrators.db.sample /usr/NX/etc || die minstallfile etc/guests.db.sample /usr/NX/etc || die minstallfile etc/httpd.cfg.sample /usr/NX/etc || die minstallfile etc/passwords.db.sample /usr/NX/etc || die minstallfile etc/profiles.db.sample /usr/NX/etc || die minstallfile etc/users.db.sample /usr/NX/etc || die minstallfile etc/server.lic.sample /usr/NX/etc || die minstallfile etc/server-magellan.cfg.sample /usr/NX/etc || die # global config minstalldir /etc/NX/server/localhost || die minstallfile scripts/etc/localhost/server.cfg /etc/NX/server/localhost || die minstallexec scripts/etc/nxserver /etc/NX || die } src_install_nxmanager() { cd ${SRCDIR}/src-nxmanager/NX local i # bin minstalldir /usr/NX/bin || die for i in nxmanager{,.bin} do minstallexec bin/${i} /usr/NX/bin || die done # other components for i in lib scripts share var do mcopy -R ${i} /usr/NX || die done # fix permissions mchmod 0755 /usr/NX/scripts/setup/nxmanager || die # configs minstalldir /usr/NX/etc || die minstallfile etc/manager.cfg.sample /usr/NX/etc || die minstallfile etc/manager.inc.sample /usr/NX/etc || die # global config minstalldir /etc/NX/server/localhost || die minstallfile scripts/etc/localhost/manager.cfg /etc/NX/server/localhost || die minstallexec scripts/etc/nxmanager /etc/NX || die } src_install_nxplayer() { cd ${SRCDIR}/src-nxplayer/NX local i # bin minstalldir /usr/bin || die minstalldir /usr/NX/bin || die minstallexec bin/nxplayer.bin /usr/NX/bin || die for i in nxesd nxplayer do minstallexec -s nxclient-wrapper /usr/bin/${i} || die minstallexec bin/${i} /usr/NX/bin || die done # other components mcopy -R scripts /usr/NX || die mcopy -R share /usr/NX || die # fix permissions mchmod 0755 /usr/NX/scripts/setup/nxplayer || die # global config minstalldir /etc/NX/server/localhost || die minstallfile scripts/etc/localhost/player.cfg /etc/NX/server/localhost || die # install some desktop icons minstallpixmap share/icons/48x48/nxplayer-icon.png nxplayer.png minstall_desktop_icon \ --name NXPlayer \ --comment "NoMachine NX Client Player" \ --file "nxplayer" \ --exec "nxplayer" \ --icon "nxplayer.png" \ --categories Network \ || die } src_install_nxwebplayer() { cd ${SRCDIR}/src-nxwebplayer/NX local i # bin minstalldir /usr/NX/bin || die for i in nxwebclient{,.bin} nxwebplayer{,.bin} do minstallexec bin/${i} /usr/NX/bin || die done # other components for i in lib scripts share var do mcopy -R ${i} /usr/NX || die done # fix permissions mchmod 0755 /usr/NX/scripts/setup/nxwebplayer || die # configs minstalldir /usr/NX/etc || die minstallfile etc/webplayer.cfg.sample /usr/NX/etc || die minstallfile etc/webplayer.inc.sample /usr/NX/etc || die # global config minstalldir /etc/NX/server/localhost || die minstallfile scripts/etc/localhost/webplayer.cfg /etc/NX/server/localhost || die minstallexec scripts/etc/nxwebplayer /etc/NX || die } preinstall_nxnode() { ${MLIBDIR}/mgroupadd nx ${MLIBDIR}/museradd -o "-g nx -s /usr/NX/bin/nxserver -d /usr/NX/home/nx" nx } preinstall_nxserver-freeedition() { # abort install if freenx is installed if [[ -n $(magequery -n nxserver-freenx) ]] then echo echo "You have 'net-misc/nxserver-freenx' installed on your system." echo echo "Both ${PCAT}/${PNAME} and 'net-misc/nxserver-freenx'" echo "cannot be installed at the same time. Please uninstall nxserver-freenx first!" echo die "net-misc/nxserver-freenx found." fi ${MLIBDIR}/mgroupadd nxhttpd ${MLIBDIR}/museradd -o "-g nxhttpd -s /bin/false -d /usr/NX/share/htdocs" nxhttpd } postinstall_nxclient() { if [[ -f /usr/NX/etc/client.cfg ]] then echo "Running NoMachine's update script" ${MROOT}/usr/NX/scripts/setup/nxclient --update else echo "Running NoMachine's setup script" ${MROOT}/usr/NX/scripts/setup/nxclient --install fi } postinstall_nxnode() { # autoscramble nx system-user password if none was set if [[ -n $(passwd -S nx | grep '[[:space:]][N|L][P| ]') ]] then usermod -p $(openssl passwd -1 $(mktemp -u | cut -d. -f2)) nx fi if [[ ! -d /usr/NX/home/nx ]] then install /usr/NX/home/nx fi chown -R nx:root /usr/NX/home/nx chmod 0700 /usr/NX/home/nx if [[ ! -f /usr/NX/etc/node.lic ]] then cp ${MROOT}/usr/NX/etc/node.lic.sample ${MROOT}/usr/NX/etc/node.lic || die chown nx:root ${MROOT}/usr/NX/etc/node.lic chmod 0400 ${MROOT}/usr/NX/etc/node.lic fi if [[ -f /usr/NX/etc/node.cfg ]] then echo "Running NoMachine's update script" ${MROOT}/usr/NX/scripts/setup/nxnode --update else echo "Running NoMachine's setup script" ${MROOT}/usr/NX/scripts/setup/nxnode --install fi } postinstall_nxserver-freeedition() { # autoscramble nxhttpd system-user password if none was set if [[ -n $(passwd -S nxhttpd | grep '[[:space:]][N|L][P| ]') ]] then usermod -p $(openssl passwd -1 $(mktemp -u | cut -d. -f2)) nxhttpd fi # only run install when no configuration file is found if [[ -f /usr/NX/etc/server.cfg ]] then echo "Running NoMachine's update script" ${MROOT}/usr/NX/scripts/setup/nxserver --update else echo "Running NoMachine's setup script" ${MROOT}/usr/NX/scripts/setup/nxserver --install fi echo echo "You also need to set a password for the user nx or pam permits ssh logins." echo "To add a NX user run '/usr/NX/bin/nxserver --useradd [username]'" echo "and set a password with '/usr/NX/bin/nxserver --passwd [username]'." echo } postinstall_nxmanager() { if [[ -f /usr/NX/etc/manager.cfg ]] then echo "Running NoMachine's update script" ${MROOT}/usr/NX/scripts/setup/nxmanager --update else echo "Running NoMachine's setup script" ${MROOT}/usr/NX/scripts/setup/nxmanager --install fi # restart nx if [[ ! -z $(/etc/NX/nxserver --status | grep "nxserver enabled") ]] then /etc/NX/nxserver --restart fi } postinstall_nxplayer() { if [[ -f /usr/NX/etc/player.cfg ]] then echo "Running NoMachine's update script" ${MROOT}/usr/NX/scripts/setup/nxplayer --update else echo "Running NoMachine's setup script" ${MROOT}/usr/NX/scripts/setup/nxplayer --install fi } postinstall_nxwebplayer() { if [[ -f /usr/NX/etc/webplayer.cfg ]] then echo "Running NoMachine's update script" ${MROOT}/usr/NX/scripts/setup/nxwebplayer --update else echo "Running NoMachine's setup script" ${MROOT}/usr/NX/scripts/setup/nxwebplayer --install fi # restart nx if [[ ! -z $(/etc/NX/nxserver --status | grep "nxserver enabled") ]] then /etc/NX/nxserver --restart fi }