Skip to content

Instantly share code, notes, and snippets.

@jnankin
Created July 25, 2012 17:09
Show Gist options
  • Save jnankin/3177301 to your computer and use it in GitHub Desktop.
Save jnankin/3177301 to your computer and use it in GitHub Desktop.
Updated freenx install script
#!/bin/bash
ARC=`uname -m`
if [[ `echo $ARC | egrep 'i[3456]86'` ]]; then
ARC=i386
else
ARC=x86_64
fi
# NOMACHINE NX binary packages
URL_NXCLIENT=http://64.34.173.142/download/3.5.0/Linux/nxclient-3.5.0-7.${ARC}.tar.gz
PKG_NXCLIENT=nxclient-3.5.0-7.${ARC}.tar.gz
URL_NXNODE=http://64.34.173.142/download/3.5.0/Linux/nxnode-3.5.0-9.${ARC}.tar.gz
PKG_NXNODE=nxnode-3.5.0-9.${ARC}.tar.gz
URL_NXSERVER=http://64.34.173.142/download/3.5.0/Linux/FE/nxserver-3.5.0-11.x86_64.tar.gz
PKG_NXSERVER=nxserver-3.5.0-11.${ARC}.tar.gz
# FREENX-SERVER source package
URL_FREENX=http://aarnet.dl.sourceforge.net/project/freenx.berlios/freenx-server-0.7.3.tar.gz
PKG_FREENX=freenx-server-0.7.3.tar.gz
DIR_FREENX=freenx-server-0.7.3
# Install required packages
echo "Installing required packages: ssh patch expect smbfs xutils-dev..."
sudo apt-get update
sudo apt-get install -y ssh patch expect smbfs xutils-dev
# Create a temp working directory
CUR_DIR=`pwd`
TMP_DIR=`mktemp -d`
# Install nomachine nxclient package
echo -n "Downloading nomachine ${URL_NXCLIENT}..."
cd $TMP_DIR
wget $URL_NXCLIENT || exit 1
echo "done"
echo "Extracting ${PKG_NXCLIENT} to /usr/NX..."
cd /usr
sudo tar -zxvf ${TMP_DIR}/${PKG_NXCLIENT}
cd $TMP_DIR
# Install nomachine nxnode package
echo -n "Downloading nomachine ${URL_NXNODE}..."
cd $TMP_DIR
wget $URL_NXNODE || exit 1
echo "done"
echo "Extracting ${PKG_NXNODE} to /usr/NX..."
cd /usr
sudo tar -zxvf ${TMP_DIR}/${PKG_NXNODE}
cd $TMP_DIR
# Install nomachine nxserver package
echo -n "Downloading nomachine ${URL_NXSERVER}..."
cd $TMP_DIR
wget $URL_NXSERVER || exit 1
echo "done"
echo "Extracting ${PKG_NXSERVER} to /usr/NX..."
cd /usr
sudo tar -zxvf ${TMP_DIR}/${PKG_NXSERVER}
cd $TMP_DIR
# Install freenx-server
echo -n "Downloading ${URL_FREENX}..."
cd $TMP_DIR
wget ${URL_FREENX}
echo "done"
echo "Extracting ${PKG_FREENX}..."
cd ${TMP_DIR}
tar zxvf ${TMP_DIR}/${PKG_FREENX}
# Patch the source files: nxloadconfig Makefile node.conf.sample
cd ${TMP_DIR}/${DIR_FREENX}
patch -p0 < gentoo-nomachine.diff
sed -e "s/3\.\[012\]/3\.\[012345\]/g" -i.bak nxloadconfig
sed -e "s/foomatic-ppdfile/foomatic/g" -i.bak nxloadconfig
sed -e "s/etc\/cups\//usr\/share\/cups\/mime/g" -i.bak nxloadconfig
sed -e "s/PATH_BIN PATH_LIB CUPS_BACKEND NX_VERSION/& NX_ETC_DIR/g" -i.bak Makefile
sed -e "s/sample \$(DESTDIR)\/\$\$NX_ETC_DIR\//&node.conf/g" -i.bak Makefile
sed -e "s/#COMMAND_MD5SUM=\"openssl md5\"/COMMAND_MD5SUM=\"md5sum\"/g" -i.bak node.conf.sample
sed -e "s/foomatic-ppdfile/foomatic/g" -i.bak node.conf.sample
sed -e "s/etc\/cups/usr\/share\/cups\/mime/g" -i.bak node.conf.sample
sed -e "s/#COMMAND_SMBUMOUNT=smbumount/COMMAND_SMBUMOUNT=umount/g" -i.bak node.conf.sample
sed -e "s/#COMMAND_SMBUMOUNT_CIFS=\/sbin\/umount.cifs/COMMAND_SMBUMOUNT=\/bin\/umount/g" -i.bak node.conf.sample
[[ -f /usr/share/xsessions/ubuntu-2d.desktop ]] && sed -e "s/#COMMAND_START_GNOME=gnome-session/COMMAND_START_GNOME=\"gnome-session --session=ubuntu-2d\"/g" -i.bak node.conf.sample
ln -s /usr/NX/lib/libXrender.so.1.2.2 /usr/NX/lib/libXrender.so.1.2
rm *.bak
# Compile and install
make
sudo make install
# Run nxsetup
sudo /usr/NX/bin/nxsetup --install --setup-nomachine-key
# Install starup script
cd /etc/init.d
sudo wget -O freenx http://computingplugs.com/files/nxserver
sudo chmod +x freenx
sudo update-rc.d freenx defaults
# Clean up
cd $CUR_DIR
#rm -fr $TMP_DIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment