aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorponce <matteo.bernardini@sns.it>2010-12-09 10:29:01 -0600
committerRobby Workman <rworkman@slackbuilds.org>2010-12-09 10:29:01 -0600
commitc8cbc6a05cd2c057761c473574aefff409751c4c (patch)
tree7d7e44b78e7c3d27d22f5e9eb5dd70de34583bd3
parent8cb50d13eaa0a31273698f99bd5f668cb75edd66 (diff)
network/freenx: Added (Free implementation of the NX Server)
Thanks to Eric Hameleers (alienBOB) for the original script on which this one is based. Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
-rw-r--r--network/freenx/README15
-rw-r--r--network/freenx/doinst.sh111
-rw-r--r--network/freenx/freenx.SlackBuild132
-rw-r--r--network/freenx/freenx.info10
-rw-r--r--network/freenx/freenx.logrotate8
-rw-r--r--network/freenx/nomachine.id_dsa.key13
-rw-r--r--network/freenx/patches/authkeys.patch12
-rw-r--r--network/freenx/patches/netcat.patch24
-rw-r--r--network/freenx/patches/nxpaths.diff64
-rw-r--r--network/freenx/patches/nxserver_multimedia.diff29
-rw-r--r--network/freenx/preinstall.sh36
-rw-r--r--network/freenx/slack-desc19
12 files changed, 473 insertions, 0 deletions
diff --git a/network/freenx/README b/network/freenx/README
new file mode 100644
index 0000000000000..8598f1074d897
--- /dev/null
+++ b/network/freenx/README
@@ -0,0 +1,15 @@
+freenx (Free implementation of the NX Server)
+
+Freenx is an application/thin-client server based on nx technology.
+NoMachine nx is the next-generation X compression and roundtrip suppression
+scheme. It can operate remote X11 sessions over 56k modem dialup links or
+anything better. This package contains a free (GPL) implementation of the
+nxserver component.
+
+Because a nx user with some default settings is needed for the server to
+build, a script, preinstall.sh, is provided to be executed (sh preinstall.sh)
+before running the slackbuild: it's pretty straightforward in his functions,
+have a look at it. Also, after installation, you will need to run (as root)
+"nxsetup --install" to complete the setup process.
+
+This requires nx.
diff --git a/network/freenx/doinst.sh b/network/freenx/doinst.sh
new file mode 100644
index 0000000000000..440c22901fb21
--- /dev/null
+++ b/network/freenx/doinst.sh
@@ -0,0 +1,111 @@
+config() {
+ for infile in $1; do
+ NEW="$infile"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ if [ ! -r $OLD ]; then
+ mv $NEW $OLD
+ elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
+ rm $NEW
+ fi
+ done
+}
+preserve_perms() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ if [ -e $OLD ]; then
+ cp -a $OLD ${NEW}.incoming
+ cat $NEW > ${NEW}.incoming
+ mv ${NEW}.incoming $NEW
+ fi
+ config $NEW
+}
+
+config etc/nxserver/node.conf.new
+config etc/logrotate.d/freenx-server.new
+preserve_perms etc/rc.d/rc.freenx.new
+
+chroot . <<EOCR 2>/dev/null
+export \$(grep ^NX_DIR usr/bin/nxloadconfig)
+export \$(grep ^NX_HOME_DIR usr/bin/nxloadconfig)
+export \$(grep ^NX_SESS_DIR usr/bin/nxloadconfig)
+export \$(grep ^NX_ETC_DIR usr/bin/nxloadconfig)
+export \$(grep ^NX_LOGFILE usr/bin/nxloadconfig)
+export \$(grep ^SSH_AUTHORIZED_KEYS usr/bin/nxloadconfig)
+
+touch \${NX_ETC_DIR}/passwords \${NX_ETC_DIR}/passwords.orig \${NX_LOGFILE}
+chmod 600 \${NX_ETC_DIR}/pass* \${NX_LOGFILE}
+
+if [ ! -e \${NX_ETC_DIR}/users.id_dsa ]; then
+ ssh-keygen -f \${NX_ETC_DIR}/users.id_dsa -t dsa -N "" > /dev/null 2>&1
+fi
+
+if [ -e \${NX_HOME_DIR}/.ssh/client.id_dsa.key ] && \
+ [ -e \${NX_HOME_DIR}/.ssh/server.id_dsa.pub.key ]; then
+ # There is a pre-existing NX installation. We use the ~nx/.ssh files.
+ echo "Copying existing nx ssh keys to \${NX_ETC_DIR} ."
+ cp -af \${NX_HOME_DIR}/.ssh/client.id_dsa.key \
+ \${NX_ETC_DIR}/client.id_dsa.key
+ cp -af \${NX_HOME_DIR}/.ssh/server.id_dsa.pub.key \
+ \${NX_ETC_DIR}/server.id_dsa.pub.key
+fi
+
+if [ ! -e \${NX_ETC_DIR}/client.id_dsa.key ] || \
+ [ ! -e \${NX_ETC_DIR}/server.id_dsa.pub.key ]; then
+ # We are going to create a new SSH key for the FreeNX server.
+ # The NX client must import this key into it's configuration to be able to
+ # connect to the FreeNX server.
+ # If you're security minded, use this key exclusively, and remove the
+ # NoMachine key from ${NX_HOME_DIR}/.ssh/authorized_keys.
+ echo "Creating a new SSH key for the FreeNX server."
+ rm -f \${NX_ETC_DIR}/client.id_dsa.key
+ rm -f \${NX_ETC_DIR}/server.id_dsa.pub.key
+ ssh-keygen -q -t dsa -N '' -f \${NX_ETC_DIR}/local.id_dsa
+ mv \${NX_ETC_DIR}/local.id_dsa \${NX_ETC_DIR}/client.id_dsa.key
+ mv \${NX_ETC_DIR}/local.id_dsa.pub \${NX_ETC_DIR}/server.id_dsa.pub.key
+
+ # Put our fresh key files in place.
+ cp -f \${NX_ETC_DIR}/client.id_dsa.key \
+ \${NX_HOME_DIR}/.ssh/client.id_dsa.key
+ cp -f \${NX_ETC_DIR}/server.id_dsa.pub.key \
+ \${NX_HOME_DIR}/.ssh/server.id_dsa.pub.key
+ chmod 600 \
+ \${NX_ETC_DIR}/client.id_dsa.key \
+ \${NX_ETC_DIR}/server.id_dsa.pub.key \
+ \${NX_HOME_DIR}/.ssh/client.id_dsa.key \
+ \${NX_HOME_DIR}/.ssh/server.id_dsa.pub.key
+ echo -n "no-port-forwarding,no-X11-forwarding,no-agent-forwarding,command=\"/usr/bin/nxserver\" "\
+ > \${NX_HOME_DIR}/.ssh/authorized_keys
+ cat \${NX_HOME_DIR}/.ssh/server.id_dsa.pub.key \
+ >> \${NX_HOME_DIR}/.ssh/authorized_keys
+ chmod 640 \${NX_HOME_DIR}/.ssh/authorized_keys
+ echo -n "127.0.0.1 " > \${NX_HOME_DIR}/.ssh/known_hosts
+ cat etc/ssh/ssh_host_rsa_key.pub >> \${NX_HOME_DIR}/.ssh/known_hosts
+
+ # Add the Nomachine pubkey to ${NX_HOME_DIR}/.ssh/authorized_keys
+ # This way, any NX client can connect to our FreeNX server without
+ # having to import our own FreeNX private key.
+ # If you want an "out-of-the-box" experience, leave the NoMachine key in
+ # ${NX_HOME_DIR}/.ssh/authorized_keys. If you're paranoid, remove
+ # this pubkey and accept only clients who have our custom FreeNX key.
+ cat <<_EOT_ >> \${NX_HOME_DIR}/.ssh/authorized_keys
+no-port-forwarding,no-X11-forwarding,no-agent-forwarding,command="/usr/bin/nxserver" ssh-dss AAAAB3NzaC1kc3MAAACBAJe/0DNBePG9dYLWq7cJ0SqyRf1iiZN/IbzrmBvgPTZnBa5FT/0Lcj39sRYt1paAlhchwUmwwIiSZaON5JnJOZ6jKkjWIuJ9MdTGfdvtY1aLwDMpxUVoGwEaKWOyin02IPWYSkDQb6cceuG9NfPulS9iuytdx0zIzqvGqfvudtufAAAAFQCwosRXR2QA8OSgFWSO6+kGrRJKiwAAAIEAjgvVNAYWSrnFD+cghyJbyx60AAjKtxZ0r/Pn9k94Qt2rvQoMnGgt/zU0v/y4hzg+g3JNEmO1PdHh/wDPVOxlZ6Hb5F4IQnENaAZ9uTZiFGqhBO1c8Wwjiq/MFZy3jZaidarLJvVs8EeT4mZcWxwm7nIVD4lRU2wQ2lj4aTPcepMAAACANlgcCuA4wrC+3Cic9CFkqiwO/Rn1vk8dvGuEQqFJ6f6LVfPfRTfaQU7TGVLk2CzY4dasrwxJ1f6FsT8DHTNGnxELPKRuLstGrFY/PR7KeafeFZDf+fJ3mbX5nxrld3wi5titTnX+8s4IKv29HJguPvOK/SI7cjzA+SqNfD7qEo8= root@nettuno
+_EOT_
+fi # end "no pre-existing NX ssh keys"
+
+if [ -e var/lib/nxserver/running ]; then
+ mv var/lib/nxserver/running/* \${NX_SESS_DIR}/running
+ mv var/lib/nxserver/closed/* \${NX_SESS_DIR}/closed
+ mv var/lib/nxserver/failed/* \${NX_SESS_DIR}/failed
+ rm -rf var/lib/nxserver/running
+ rm -rf var/lib/nxserver/closed
+ rm -rf var/lib/nxserver/failed
+fi
+
+chown -R nx:root var/lib/nxserver
+chown -R nx:root \${NX_SESS_DIR}
+chown -R nx:root \${NX_ETC_DIR}
+chown -R nx:root \${NX_HOME_DIR}
+chown nx:root \${NX_LOGFILE}
+
+EOCR
+
diff --git a/network/freenx/freenx.SlackBuild b/network/freenx/freenx.SlackBuild
new file mode 100644
index 0000000000000..99d62a49bab4d
--- /dev/null
+++ b/network/freenx/freenx.SlackBuild
@@ -0,0 +1,132 @@
+#!/bin/sh
+# $Id: freenx.SlackBuild,v 1.10 2009/01/27 20:22:26 root Exp root $
+# Copyright (c) 2008, 2009 Eric Hameleers, Eindhoven, The Netherlands
+# All rights reserved.
+#
+# Permission to use, copy, modify, and distribute this software for
+# any purpose with or without fee is hereby granted, provided that
+# the above copyright notice and this permission notice appear in all
+# copies.
+#
+# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+# 24/sep/2010 by ponce <matteo.bernardini@sns.it>
+# * ported to SBo.
+
+PRGNAM=freenx
+VERSION=${VERSION:-0.7.3}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i486 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+CWD=$(pwd)
+
+if [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
+DOCS="AUTHORS COPYING ChangeLog CONTRIB nxcheckload.sample nxacl.sample \
+ $CWD/nomachine.id_dsa.key"
+
+bailout() {
+ printf "\n\tYou must have an \"nx\" user and group to run this script.\n"
+ printf "\tSee $(pwd)/preinstall.sh for details (or just execute it).\n\n"
+ exit 1
+}
+
+if ! getent group nx 1>/dev/null ; then
+ bailout
+elif ! getent passwd nx 1>/dev/null ; then
+ bailout
+fi
+
+set -e
+
+mkdir -p $TMP/tmp-$PRGNAM $PKG $OUTPUT
+rm -rf $TMP/tmp-$PRGNAM/* $PKG/*
+
+cd $TMP/tmp-$PRGNAM
+tar xvf $CWD/${PRGNAM}-server-${VERSION}.tar.gz
+cd ${PRGNAM}-server-${VERSION}
+chown -R root:root .
+chmod -R u+w,go+r-w,a-s .
+
+patch -p1 < $CWD/patches/authkeys.patch
+patch -p1 < $CWD/patches/netcat.patch
+patch -p1 < $CWD/patches/nxserver_multimedia.diff
+patch -p1 < $CWD/patches/nxpaths.diff
+
+sed -i -e "s#/usr/lib\$#/usr/lib${LIBDIRSUFFIX}#" \
+ -e "s#/usr/lib/#/usr/lib${LIBDIRSUFFIX}/#g" \
+ $(grep -lr '/usr/lib' *)
+
+mkdir -p ${PKG}/usr/lib${LIBDIRSUFFIX}/cups/backend
+mkdir -p ${PKG}/var/lib/nxserver/db/{closed,running,failed}
+mkdir -p ${PKG}/etc/{logrotate.d,nxserver,rc.d}
+mkdir -p ${PKG}/usr/bin
+
+make -C nxserver-helper
+cd nxviewer-passwd ; xmkmf ; make World ; cd ..
+make -C nxredir install DESTDIR=$PKG
+
+chmod 0755 ${PKG}/var/lib/nxserver
+chmod 0700 ${PKG}/var/lib/nxserver/*
+chmod 0700 ${PKG}/var/lib/nxserver/db/*
+
+install -m 0755 nxserver-helper/nxserver-helper $PKG/usr/bin
+install -m 0755 nxviewer-passwd/nxpasswd/nxpasswd $PKG/usr/bin
+install -m 0755 \
+ nxcups-gethost nxdesktop_helper nxdialog nxkeygen nxloadconfig \
+ nxnode nxnode-login nxprint nxserver nxsetup nxviewer_helper \
+ $PKG/usr/bin
+
+install -m 0644 node.conf.sample $PKG/etc/nxserver
+cp -a $PKG/etc/nxserver/node.conf.{sample,new}
+install -m 0755 init.d/freenx-server $PKG/etc/rc.d/rc.freenx.new
+
+# Add a logrotate script:
+install -m 644 $CWD/freenx.logrotate $PKG/etc/logrotate.d/freenx-server.new
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION || true
+cat $CWD/$(basename $0) > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+chown -R root:root $PKG/usr/doc/$PRGNAM-$VERSION
+find $PKG/usr/doc -type f -exec chmod 644 {} \;
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
diff --git a/network/freenx/freenx.info b/network/freenx/freenx.info
new file mode 100644
index 0000000000000..b75eccc9797a0
--- /dev/null
+++ b/network/freenx/freenx.info
@@ -0,0 +1,10 @@
+PRGNAM="freenx"
+VERSION="0.7.3"
+HOMEPAGE="http://freenx.berlios.de"
+DOWNLOAD="http://download.berlios.de/freenx/freenx-server-0.7.3.tar.gz"
+MD5SUM="856f597e139018f7ed62713c9d6c9ed5"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+MAINTAINER="ponce"
+EMAIL="matteo.bernardini@sns.it"
+APPROVED="rworkman"
diff --git a/network/freenx/freenx.logrotate b/network/freenx/freenx.logrotate
new file mode 100644
index 0000000000000..3342cc437c8b7
--- /dev/null
+++ b/network/freenx/freenx.logrotate
@@ -0,0 +1,8 @@
+/var/log/nxserver.log {
+ rotate 4
+ size=4M
+ notifempty
+ missingok
+ sharedscripts
+ copytruncate
+}
diff --git a/network/freenx/nomachine.id_dsa.key b/network/freenx/nomachine.id_dsa.key
new file mode 100644
index 0000000000000..4aa1778801d45
--- /dev/null
+++ b/network/freenx/nomachine.id_dsa.key
@@ -0,0 +1,13 @@
+-----BEGIN DSA PRIVATE KEY-----
+MIIBuwIBAAKBgQCXv9AzQXjxvXWC1qu3CdEqskX9YomTfyG865gb4D02ZwWuRU/9
+C3I9/bEWLdaWgJYXIcFJsMCIkmWjjeSZyTmeoypI1iLifTHUxn3b7WNWi8AzKcVF
+aBsBGiljsop9NiD1mEpA0G+nHHrhvTXz7pUvYrsrXcdMyM6rxqn77nbbnwIVALCi
+xFdHZADw5KAVZI7r6QatEkqLAoGBAI4L1TQGFkq5xQ/nIIciW8setAAIyrcWdK/z
+5/ZPeELdq70KDJxoLf81NL/8uIc4PoNyTRJjtT3R4f8Az1TsZWeh2+ReCEJxDWgG
+fbk2YhRqoQTtXPFsI4qvzBWct42WonWqyyb1bPBHk+JmXFscJu5yFQ+JUVNsENpY
++Gkz3HqTAoGANlgcCuA4wrC+3Cic9CFkqiwO/Rn1vk8dvGuEQqFJ6f6LVfPfRTfa
+QU7TGVLk2CzY4dasrwxJ1f6FsT8DHTNGnxELPKRuLstGrFY/PR7KeafeFZDf+fJ3
+mbX5nxrld3wi5titTnX+8s4IKv29HJguPvOK/SI7cjzA+SqNfD7qEo8CFDIm1xRf
+8xAPsSKs6yZ6j1FNklfu
+-----END DSA PRIVATE KEY-----
+
diff --git a/network/freenx/patches/authkeys.patch b/network/freenx/patches/authkeys.patch
new file mode 100644
index 0000000000000..7633cee459d4c
--- /dev/null
+++ b/network/freenx/patches/authkeys.patch
@@ -0,0 +1,12 @@
+diff -uarN freenx-server-0.7.3.orig/nxloadconfig freenx-server-0.7.3/nxloadconfig
+--- freenx-server-0.7.3.orig/nxloadconfig 2008-08-22 02:44:43.000000000 +0200
++++ freenx-server-0.7.3/nxloadconfig 2008-11-16 01:28:14.000000000 +0100
+@@ -70,7 +70,7 @@
+ APPLICATION_LIBRARY_PRELOAD="" #Calculated
+
+ # the name of the authorized keys file for ssh
+-SSH_AUTHORIZED_KEYS="authorized_keys2"
++SSH_AUTHORIZED_KEYS="authorized_keys"
+
+ # retest values like xauth, netcat and checks for nxdesktop/nxviewer availability
+ # set to 0 if you are sure, you set the right values
diff --git a/network/freenx/patches/netcat.patch b/network/freenx/patches/netcat.patch
new file mode 100644
index 0000000000000..91475d272a20c
--- /dev/null
+++ b/network/freenx/patches/netcat.patch
@@ -0,0 +1,24 @@
+diff -uarN freenx-server-0.7.3.orig/node.conf.sample freenx-server-0.7.3/node.conf.sample
+--- freenx-server-0.7.3.orig/node.conf.sample 2008-08-22 02:44:43.000000000 +0200
++++ freenx-server-0.7.3/node.conf.sample 2008-11-16 01:26:58.000000000 +0100
+@@ -539,7 +539,7 @@
+ #COMMAND_SMBUMOUNT_CIFS=/sbin/umount.cifs
+
+ # The key that contains the name of the complete path of the 'netcat' command.
+-#COMMAND_NETCAT=netcat
++#COMMAND_NETCAT=nc
+
+ # The key that contains the name of the complete path of the 'ssh' and
+ # 'ssh-keygen' command.
+diff -uarN freenx-server-0.7.3.orig/nxloadconfig freenx-server-0.7.3/nxloadconfig
+--- freenx-server-0.7.3.orig/nxloadconfig 2008-08-22 02:44:43.000000000 +0200
++++ freenx-server-0.7.3/nxloadconfig 2008-11-16 01:26:18.000000000 +0100
+@@ -195,7 +195,7 @@
+ COMMAND_SMBUMOUNT=smbumount
+ COMMAND_SMBMOUNT_CIFS=/sbin/mount.cifs
+ COMMAND_SMBUMOUNT_CIFS=/sbin/umount.cifs
+-COMMAND_NETCAT=netcat
++COMMAND_NETCAT=nc
+ COMMAND_SSH=ssh
+ COMMAND_SSH_KEYGEN=ssh-keygen
+ COMMAND_CUPSD=/usr/sbin/cupsd
diff --git a/network/freenx/patches/nxpaths.diff b/network/freenx/patches/nxpaths.diff
new file mode 100644
index 0000000000000..2273ff55edbe5
--- /dev/null
+++ b/network/freenx/patches/nxpaths.diff
@@ -0,0 +1,64 @@
+diff -uarN freenx-server-0.7.3.orig/node.conf.sample freenx-server-0.7.3/node.conf.sample
+--- freenx-server-0.7.3.orig/node.conf.sample 2008-08-22 02:44:43.000000000 +0200
++++ freenx-server-0.7.3/node.conf.sample 2009-01-27 21:03:36.000000000 +0100
+@@ -498,12 +498,12 @@
+ # and .Xsession
+ # Depending on distribution DEFAULT_X_SESSION might be /etc/X11/xdm/Xsession,
+ # /etc/X11/Sessions/Xsession or /etc/X11/xinit/xinitrc
+-#USER_X_STARTUP_SCRIPT=.Xclients
+-#DEFAULT_X_SESSION=/etc/X11/xdm/Xsession
++#USER_X_STARTUP_SCRIPT=.xinitrc
++#DEFAULT_X_SESSION=/etc/X11/xinit/xinitrc
+
+ # The key that contains the name of the script that starts a KDE session.
+ # It's run when a 'unix-kde' session is requested by the client.
+-#COMMAND_START_KDE=startkde
++#COMMAND_START_KDE=/etc/X11/xinit/xinitrc.kde
+
+ # The key that contains the name of the script that starts a gnome session.
+ # It's run when a 'unix-gnome' session is requested by the client.
+diff -uarN freenx-server-0.7.3.orig/nxloadconfig freenx-server-0.7.3/nxloadconfig
+--- freenx-server-0.7.3.orig/nxloadconfig 2008-08-22 02:44:43.000000000 +0200
++++ freenx-server-0.7.3/nxloadconfig 2009-01-27 21:01:57.000000000 +0100
+@@ -56,8 +56,8 @@
+ NX_LICENSE="OS (GPL, using backend: %BACKEND%)"
+
+ # Where can different nx components be found
+-NX_DIR=/usr
+-PATH_BIN=$NX_DIR/bin # if you change that, be sure to also change the public keys
++NX_DIR=/usr/lib/NX
++PATH_BIN=/usr/bin # if you change that, be sure to also change the public keys
+ PATH_LIB=$NX_DIR/lib
+ NX_ETC_DIR=/etc/nxserver
+ NX_SESS_DIR=/var/lib/nxserver/db
+@@ -184,9 +184,9 @@
+
+ DEFAULT_X_WM=""
+ KILL_DEFAULT_X_WM="1"
+-USER_X_STARTUP_SCRIPT=.Xclients
+-DEFAULT_X_SESSION=/etc/X11/xdm/Xsession
+-COMMAND_START_KDE=startkde
++USER_X_STARTUP_SCRIPT=.xinitrc
++DEFAULT_X_SESSION=/etc/X11/xinit/xinitrc
++COMMAND_START_KDE=/etc/X11/xinit/xinitrc.kde
+ COMMAND_START_GNOME=gnome-session
+ COMMAND_START_CDE=cdwm
+ COMMAND_XTERM=xterm
+@@ -317,7 +317,7 @@
+ [ -z "$APPLICATION_LIBRARY_PATH" ] && APPLICATION_LIBRARY_PATH=$PATH_LIB
+ [ -z "$APPLICATION_LIBRARY_PRELOAD" ] && APPLICATION_LIBRARY_PRELOAD="$APPLICATION_LIBRARY_PATH/libX11.so.6.2:$APPLICATION_LIBRARY_PATH/libXext.so.6.4:$APPLICATION_LIBRARY_PATH/libXcomp.so:$APPLICATION_LIBRARY_PATH/libXcompext.so:$APPLICATION_LIBRARY_PATH/libXrender.so.1.2"
+
+-NX_BACKEND_VERSION=$(strings $PATH_BIN/nxagent 2>/dev/null | egrep 'NXAGENT - Version' | sed 's/.*Version //g')
++NX_BACKEND_VERSION=$(strings $NX_DIR/nxagent 2>/dev/null | egrep 'NXAGENT - Version' | sed 's/.*Version //g')
+
+ [ "$ENABLE_1_5_0_BACKEND" = "1" ] && NX_BACKEND_VERSION="1.5.0" # forced the backend
+
+@@ -606,7 +606,7 @@
+ [ -z $(echo "$ENABLE_ROOTLESS_MODE" | egrep "^[0|1]$") ] && \
+ ERROR="yes" && echo "Error: Invalid value \"ENABLE_ROOTLESS_MODE=$ENABLE_ROOTLESS_MODE\""
+
+- [ -z "$(strings $PATH_BIN/nxagent | egrep 'NXAGENT - Version 1.5.0|NXAGENT - Version 2.[01].0|NXAGENT - Version 3.[012].0')" ] && \
++ [ -z "$(strings $NX_DIR/nxagent | egrep 'NXAGENT - Version 1.5.0|NXAGENT - Version 2.[01].0|NXAGENT - Version 3.[012].0')" ] && \
+ WARNING="yes" && echo "Error: Could not find 1.5.0 or 2.[01].0 or 3.[01].0 version string in nxagent. NX 1.5.0 or 2.[01].0 or 3.[012].0 backend is needed for this version of FreeNX."
+
+ [ -z $(echo "$ENABLE_USESSION" | egrep "^[0|1]$") ] && \
diff --git a/network/freenx/patches/nxserver_multimedia.diff b/network/freenx/patches/nxserver_multimedia.diff
new file mode 100644
index 0000000000000..6f16bf9c24baf
--- /dev/null
+++ b/network/freenx/patches/nxserver_multimedia.diff
@@ -0,0 +1,29 @@
+--- freenx-server-0.7.3/nxserver.orig 2008-12-30 21:21:40.000000000 +0100
++++ freenx-server-0.7.3/nxserver 2008-12-30 21:22:50.000000000 +0100
+@@ -1447,7 +1447,7 @@
+ # Now check for the other enabled services
+
+ let SAMBA_DISPLAY=$SESS_DISPLAY+3000
+- if [ "$(getparam 'samba')" = 1 ] && $COMMAND_NETCAT -z "$SERVER_HOST" $SAMBA_DISPLAY
++ if [ "$(getparam 'samba')" = 1 ] && $COMMAND_NETCAT -z "$SERVER_HOST" $SAMBA_DISPLAY 2>/dev/null
+ then
+ log 2 "Warning: Skipping $SERVER_HOST:$AGENT_DISPLAY as samba port is not free."
+ let SESS_DISPLAY=$SESS_DISPLAY+1
+@@ -1455,7 +1455,7 @@
+ fi
+
+ let MEDIA_DISPLAY=$SESS_DISPLAY+7000
+- if [ "$(getparam 'media')" = 1 ] && $COMMAND_NETCAT -z "$SERVER_HOST" $MEDIA_DISPLAY
++ if [ "$(getparam 'media')" = 1 ] && $COMMAND_NETCAT -z "$SERVER_HOST" $MEDIA_DISPLAY 2>/dev/null
+ then
+ log 2 "Warning: Skipping $SERVER_HOST:$AGENT_DISPLAY as media port is not free."
+ let SESS_DISPLAY=$SESS_DISPLAY+1
+@@ -1464,7 +1464,7 @@
+
+
+ let CUPS_DISPLAY=$SESS_DISPLAY+9000
+- if [ "$(getparam 'cups')" = 1 ] && $COMMAND_NETCAT -z "$SERVER_HOST" $CUPS_DISPLAY
++ if [ "$(getparam 'cups')" = 1 ] && $COMMAND_NETCAT -z "$SERVER_HOST" $CUPS_DISPLAY 2>/dev/null
+ then
+ log 2 "Warning: Skipping $SERVER_HOST:$AGENT_DISPLAY as cups port is not free."
+ let SESS_DISPLAY=$SESS_DISPLAY+1
diff --git a/network/freenx/preinstall.sh b/network/freenx/preinstall.sh
new file mode 100644
index 0000000000000..00287a7e2b818
--- /dev/null
+++ b/network/freenx/preinstall.sh
@@ -0,0 +1,36 @@
+#!/usr/bin/bash
+# freenx preinstall script
+# excerpted from alien bob's doinst.sh
+# mixed by ponce <matteo.bernardini@sns.it>
+
+set -e
+
+if ! /sbin/pidof sshd >/dev/null ; then
+ echo ""
+ echo "WARNING: The SSH daemon is not running, but without SSH, NX will not work."
+fi
+
+if ! which nc 1>/dev/null 2>/dev/null ; then
+ echo ""
+ echo "WARNING: FreeNX needs the 'netcat' program to be installed."
+fi
+
+if ! which expect 1>/dev/null 2>/dev/null ; then
+ echo ""
+ echo "WARNING: FreeNX needs the 'expect' program to be installed."
+fi
+
+# create the $HOME/.ssh directory for the nx user and give it 700 permission.
+mkdir -p /var/lib/nxserver/home/.ssh
+chmod 700 /var/lib/nxserver/home/.ssh
+
+# create the nx user and group
+groupadd -g 243 nx
+useradd -m -d /var/lib/nxserver/home -s /usr/bin/nxserver -u 243 -g 243 nx
+
+# assign the nx user a random password of 30 alphanumeric chars to avoid problems
+# with unlocking: http://alien.slackbook.org/dokuwiki/doku.php?id=slackware:nx
+usermod -p $(echo $RANDOM$(date)$RANDOM | md5sum | cut -b 2-32) nx
+passwd -u nx 1>/dev/null
+
+echo "nx user/group added."
diff --git a/network/freenx/slack-desc b/network/freenx/slack-desc
new file mode 100644
index 0000000000000..9fc49760c5ffe
--- /dev/null
+++ b/network/freenx/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description. Line
+# up the first '|' above the ':' following the base package name, and the '|'
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':'.
+
+ |-----handy-ruler------------------------------------------------------|
+freenx: freenx (Free implementation of the NX Server)
+freenx:
+freenx: Freenx is an application/thin-client server based on nx technology.
+freenx: NoMachine nx is the next-generation X compression and roundtrip
+freenx: suppression scheme. It can operate remote X11 sessions over 56k modem
+freenx: dialup links or anything better. This package contains a free (GPL)
+freenx: implementation of the nxserver component.
+freenx:
+freenx: freenx home: http://freenx.berlios.de/
+freenx:
+freenx: