[X2Go-Commits] x2goserver.git - build-baikal (branch) updated: 3.0.0-1

X2Go dev team git-admin at x2go.org
Fri Jan 3 20:52:05 CET 2014


The branch, build-baikal has been updated
       via  24a8f38963badf1ba8a32276c5f67807cdf5148b (commit)
      from  235238a43856cfb66fb8a2a3ba46d7e54120d0f9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 INSTALL                       |   37 ++++++++++
 debian/README.Debian          |    6 ++
 debian/changelog              |  130 +++++++++++++++++++++++++++++++++
 debian/compat                 |    1 +
 debian/control                |   24 +++++++
 debian/copyright              |   35 +++++++++
 debian/cron.d.ex              |    4 ++
 debian/dirs                   |    4 ++
 debian/emacsen-install.ex     |   45 ++++++++++++
 debian/emacsen-remove.ex      |   15 ++++
 debian/emacsen-startup.ex     |   25 +++++++
 debian/init.d                 |   82 +++++++++++++++++++++
 debian/init.d.ex              |   81 +++++++++++++++++++++
 debian/manpage.1.ex           |   59 +++++++++++++++
 debian/manpage.sgml.ex        |  156 ++++++++++++++++++++++++++++++++++++++++
 debian/manpage.xml.ex         |  148 ++++++++++++++++++++++++++++++++++++++
 debian/menu.ex                |    2 +
 debian/postinst.ex            |   41 +++++++++++
 debian/postrm.ex              |   39 ++++++++++
 debian/preinst                |   97 +++++++++++++++++++++++++
 debian/preinst.ex             |   38 ++++++++++
 debian/prerm.ex               |   40 +++++++++++
 debian/rules                  |  119 ++++++++++++++++++++++++++++++
 debian/watch.ex               |   22 ++++++
 debian/x2goserver-default.ex  |   10 +++
 debian/x2goserver.doc-base.EX |   22 ++++++
 sql                           |    1 +
 x2gocleansessions             |   48 ++++++++++---
 x2gocmdexitmessage            |    7 ++
 x2gocreatebase.sh             |   24 ++++---
 x2golistsessions              |   42 ++++-------
 x2golistsessions_root         |   33 ++-------
 x2golistsessions_sql          |   10 ++-
 x2gomountdirs                 |  160 +++++++++++++++++++++++++++++++++--------
 x2gopgwrapper_local           |   84 ++++++++++++++++++++--
 x2gopgwrapper_net             |  117 +++++++++++++++++++++++++-----
 x2goresume-session            |    3 +-
 x2goruncommand                |   97 +++++++++++++++++++++++--
 x2gostartagent                |   48 ++++++++++---
 x2gosuspend-agent             |   10 +++
 x2gosuspend-session           |    3 +-
 x2goterminate-session         |    5 +-
 x2goumount                    |   18 ++++-
 x2goumount_session            |   24 ++++++-
 44 files changed, 1865 insertions(+), 151 deletions(-)
 create mode 100644 INSTALL
 create mode 100644 debian/README.Debian
 create mode 100644 debian/changelog
 create mode 100644 debian/compat
 create mode 100644 debian/control
 create mode 100644 debian/copyright
 create mode 100644 debian/cron.d.ex
 create mode 100644 debian/dirs
 create mode 100644 debian/docs
 create mode 100644 debian/emacsen-install.ex
 create mode 100644 debian/emacsen-remove.ex
 create mode 100644 debian/emacsen-startup.ex
 create mode 100644 debian/init.d
 create mode 100644 debian/init.d.ex
 create mode 100644 debian/manpage.1.ex
 create mode 100644 debian/manpage.sgml.ex
 create mode 100644 debian/manpage.xml.ex
 create mode 100644 debian/menu.ex
 create mode 100644 debian/postinst.ex
 create mode 100644 debian/postrm.ex
 create mode 100755 debian/preinst
 create mode 100644 debian/preinst.ex
 create mode 100644 debian/prerm.ex
 create mode 100755 debian/rules
 create mode 100644 debian/watch.ex
 create mode 100644 debian/x2goserver-default.ex
 create mode 100644 debian/x2goserver.doc-base.EX
 create mode 100644 sql
 create mode 100755 x2gocmdexitmessage
 create mode 100755 x2gosuspend-agent

The diff of changes is:
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..953cc74
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,37 @@
+install sudo,fuse,sshfs
+
+use visudo and add string in sudoers:
+%users ALL=(ALL) NOPASSWD: /usr/bin/x2gopgwrapper
+
+if you  want to allow only users from group x2gousers use X2GO system, 
+#add group "x2gousers"
+and change in sudoers  %users to %x2gousers
+
+INSTALL server scripts:
+
+mkdir /etc/x2go
+cp sql /etc/x2go/
+copy x2go* in any directory in $PATH
+daemon x2gocleansessions - clean all finished sessions, enable it by system start
+
+IF YOU WANT TO USE LOCAL DATABASE:
+you need to install postgresql
+
+echo -n local > /etc/x2go/sql
+
+use x2gocreatebase.sh to create database for x2go
+
+IF YOU WANT TO USE REMOTE DATABASE:
+echo -n "sqlserver address" > /etc/x2go/sql
+
+you need to creata DSA key for ssh connection with database server
+mkdirhier /root/.x2go/ssh/.pg/
+ssh-keygen -t dsa -f /root/.x2go/ssh/.pg/id_dsa
+press "Enter" for empty passphrase
+
+copy public part "/root/.x2go/ssh/.pg/id_dsa.pub" on computer with running sql server
+(for example with scp)
+and add it to ~postgres/.ssh/authorized_keys
+cat id_dsa.pub >> ~postgres/.ssh/authorized_keys
+
+
diff --git a/debian/README.Debian b/debian/README.Debian
new file mode 100644
index 0000000..8325992
--- /dev/null
+++ b/debian/README.Debian
@@ -0,0 +1,6 @@
+x2goserver for Debian
+---------------------
+
+<possible notes regarding this package - if none, delete this file>
+
+ -- Oleksandr Shneyder <oleksandr.shneyder at obviously-nice.de>  Thu,  8 Feb 2007 15:21:30 +0100
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..c6b7b40
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,130 @@
+x2goserver (3.0.0-1) unstable; urgency=low
+
+  * Printing support (need x2goprint and cups-x2go)
+  * add group x2gousers and configure sudo in preinstall script
+
+ -- Oleksandr Shneyder <oleksandr.shneyder at obviously-nice.de>  Wed, 04 Mar 2009 16:49:59 +0100
+
+x2goserver (2.0.1-19) unstable; urgency=low
+
+  * fixed installinit script break if x2goserver not running 
+
+ -- Oleksandr Shneyder <oleksandr.shneyder at obviously-nice.de>  Fri, 30 Jan 2009 08:38:03 +0100
+
+x2goserver (2.0.1-18) unstable; urgency=low
+
+  * fixed preinst script to work with ubuntu
+
+ -- Oleksandr Shneyder <oleksandr.shneyder at obviously-nice.de>  Thu, 29 Jan 2009 10:09:25 +0100
+
+x2goserver (2.0.1-17) unstable; urgency=low
+
+  * changes in database (start x2gocreatebase.sh):
+  *           session_id - varchar(500)
+  *           column "fsport" for fs tunnel
+  * changes in x2gostartagent: add fsport to session info
+  * changes in x2gopgwrapper_(local/net): fsport in listsessions
+  * changes in x2gomountdirs: mount using reverse ssh tun
+
+ -- Oleksandr Shneyder <oleksandr.shneyder at obviously-nice.de>  Thu, 15 Jan 2009 17:25:54 +0100
+
+x2goserver (2.0.1-16) unstable; urgency=low
+
+  * added x2gosuspend-agent to suspend session on clicking "close" button on x2goagent
+
+ -- Oleksandr Shneyder <oleksandr.shneyder at obviously-nice.de>  Mon, 03 Nov 2008 16:11:56 +0100
+
+x2goserver (2.0.1-15) unstable; urgency=low
+
+  * Fixed: run command with arguments
+  * Error message if command not exists
+
+ -- Oleksandr Shneyder <oleksandr.shneyder at obviously-nice.de>  Thu, 09 Oct 2008 15:42:29 +0000
+
+x2goserver (2.0.1-14) unstable; urgency=low
+
+  * added: list sessions from all servers
+
+ -- Oleksandr Shneyder <oleksandr.shneyder at obviously-nice.de>  Wed, 08 Oct 2008 10:16:18 +0200
+
+x2goserver (2.0.1-13) unstable; urgency=low
+
+  * changes to enable "rootless" mode
+
+ -- Oleksandr Shneyder <oleksandr.shneyder at obviously-nice.de>  Thu, 25 Sep 2008 17:33:18 +0200
+
+x2goserver (2.0.1-12) unstable; urgency=low
+
+  * changes in x2gomount/umount to use with gnome
+
+ -- Oleksandr Shneyder <admin at power.obviously-nice.de>  Fri, 29 Aug 2008 11:18:43 +0200
+
+x2goserver (2.0.1-11) unstable; urgency=low
+
+  * now x2gomountdirs can mount dirs on client hosts with ssh ports other then 22 
+
+ -- Oleksandr Shneyder <oleksandr.shneyder at obviously-nice.de>  Fri, 21 Sep 2007 12:12:34 +0200
+
+x2goserver (2.0.1-10) unstable; urgency=low
+
+  * x2gomountdirs fixed mounting directories with " " in path
+  * changed /bin/sh to /bin/bash in scripts
+  * x2gostartgent append color depth to session's name
+
+ -- Oleksandr Shneyder <oleksandr.shneyder at obviously-nice.de>  Thu, 13 Sep 2007 14:01:17 +0200
+
+x2goserver (2.0.1-9) unstable; urgency=low
+
+  * esd support
+
+ -- Oleksandr Shneyder <oleksandr.shneyder at obviously-nice.de>  Tue,  7 Aug 2007 15:31:51 +0200
+
+x2goserver (2.0.1-8) unstable; urgency=low
+
+  * changed architecture to "all"
+
+ -- Oleksandr Shneyder <oleksandr.shneyder at obviously-nice.de>  Thu, 28 Jun 2007 10:11:10 +0200
+
+x2goserver (2.0.1-7) unstable; urgency=low
+
+  * support for amd64
+
+ -- Oleksandr Shneyder <oleksandr.shneyder at obviously-nice.de>  Tue, 26 Jun 2007 16:32:53 +0200
+
+x2goserver (2.0.1-6) unstable; urgency=low
+
+  * close std file descriptors in daemon
+
+ -- Oleksandr Shneyder <oleksandr.shneyder at obviously-nice.de>  Wed, 25 Apr 2007 10:40:22 +0200
+
+x2goserver (2.0.1-5) unstable; urgency=low
+
+  * fix listsusp in wrapper
+
+ -- Oleksandr Shneyder <oleksandr.shneyder at obviously-nice.de>  Tue, 20 Mar 2007 12:06:00 +0100
+
+x2goserver (2.0.1-4) unstable; urgency=low
+
+  * fix getdisplays and getports in wrapper
+
+ -- Oleksandr Shneyder <oleksandr.shneyder at obviously-nice.de>  Tue, 20 Mar 2007 12:06:54 +0100
+
+x2goserver (2.0.1-3) unstable; urgency=low
+
+  * listallrunning and listsusp in postgress wrapper
+  * changes in database template, unique display and ports
+
+ -- Oleksandr Shneyder <oleksandr.shneyder at obviously-nice.de>  Mon, 19 Mar 2007 15:13:32 +0100
+
+x2goserver (2.0.1-2) unstable; urgency=low
+
+  * get server name with `hostname` in cleansessions
+
+ -- root <root at x2gotest1.x2go.obviously-nice.de>  Wed, 28 Feb 2007 09:49:48 +0100
+
+x2goserver (2.0.1-1) unstable; urgency=low
+
+  * Initial release (Closes: #nnnn)  <nnnn is the bug number of your ITP>
+
+ -- Oleksandr Shneyder <oleksandr.shneyder at obviously-nice.de>  Thu,  8 Feb 2007 15:21:30 +0100
+
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..7ed6ff8
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+5
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..9448d4b
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,24 @@
+Source: x2goserver
+Section: x11
+Priority: extra
+Maintainer: Oleksandr Shneyder <oleksandr.shneyder at obviously-nice.de>
+Build-Depends: debhelper (>= 5)
+Standards-Version: 3.7.2
+
+Package: x2goserver
+Architecture: all
+Depends: x2goagent, sudo, lsof, ssh
+Recommends: sshfs, postgresql
+Description: x2goserver (daemon and tools)
+ x2go is a serverbased computing environment with
+ - session resuming
+ - low bandwith support
+ - LDAP support
+ - client side mass storage mounting support
+ - audio/arts support
+ - authentification by smartcard and usb-stick
+ - kde control-center modules for administration
+ - kde based tools for just in time messaging and client surveillance
+ .
+ x2goserver contains the main daemon and tools for
+ session administrations (scripts).
\ No newline at end of file
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..4a7fdf6
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,35 @@
+This package was debianized by Oleksandr Shneyder <oleksandr.shneyder at obviously-nice.de> on
+Thu,  1 Feb 2007 14:11:03 +0100.
+
+It was downloaded from www.obviously-nice.de
+
+Upstream Author: Oleksandr Shneyder <oleksandr.shneyder at obviously-nice.de>
+
+Copyright (C) 2007  obviously nice - http://www.obviouslynice.de
+
+This program is free software; you can redistribute it and/or modify  
+it under the terms of the GNU General Public License as published by  
+the Free Software Foundation; either version 2 of the License, or     
+(at your option) any later version.                                   
+                                                                      
+This program is distributed in the hope that it will be useful,       
+but WITHOUT ANY WARRANTY; without even the implied warranty of        
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         
+GNU General Public License for more details.                          
+                                                                      
+You should have received a copy of the GNU General Public License     
+along with this program; if not, write to the                         
+Free Software Foundation, Inc.,                                       
+59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             
+
+Copyright (C) 2007  Oleksandr Shneyder
+oleksandr.shneyder at obviously-nice.de
+
+On Debian systems, the complete text of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL'.
+
+
+
+The Debian packaging is (C) 2007, Oleksandr Shneyder <oleksandr.shneyder at obviously-nice.de> and
+is licensed under the GPL, see above.
+
diff --git a/debian/cron.d.ex b/debian/cron.d.ex
new file mode 100644
index 0000000..88d0304
--- /dev/null
+++ b/debian/cron.d.ex
@@ -0,0 +1,4 @@
+#
+# Regular cron jobs for the x2goserver package
+#
+0 4	* * *	root	x2goserver_maintenance
diff --git a/debian/dirs b/debian/dirs
new file mode 100644
index 0000000..b9b8278
--- /dev/null
+++ b/debian/dirs
@@ -0,0 +1,4 @@
+usr/bin
+usr/sbin
+etc/x2go
+usr/lib/x2go/script
diff --git a/debian/docs b/debian/docs
new file mode 100644
index 0000000..e69de29
diff --git a/debian/emacsen-install.ex b/debian/emacsen-install.ex
new file mode 100644
index 0000000..0a9ed36
--- /dev/null
+++ b/debian/emacsen-install.ex
@@ -0,0 +1,45 @@
+#! /bin/sh -e
+# /usr/lib/emacsen-common/packages/install/x2goserver
+
+# Written by Jim Van Zandt <jrv at debian.org>, borrowing heavily
+# from the install scripts for gettext by Santiago Vila
+# <sanvila at ctv.es> and octave by Dirk Eddelbuettel <edd at debian.org>.
+
+FLAVOR=$1
+PACKAGE=x2goserver
+
+if [ ${FLAVOR} = emacs ]; then exit 0; fi
+
+echo install/${PACKAGE}: Handling install for emacsen flavor ${FLAVOR}
+
+#FLAVORTEST=`echo $FLAVOR | cut -c-6`
+#if [ ${FLAVORTEST} = xemacs ] ; then
+#    SITEFLAG="-no-site-file"
+#else
+#    SITEFLAG="--no-site-file"
+#fi
+FLAGS="${SITEFLAG} -q -batch -l path.el -f batch-byte-compile"
+
+ELDIR=/usr/share/emacs/site-lisp/${PACKAGE}
+ELCDIR=/usr/share/${FLAVOR}/site-lisp/${PACKAGE}
+
+# Install-info-altdir does not actually exist. 
+# Maybe somebody will write it.
+if test -x /usr/sbin/install-info-altdir; then
+    echo install/${PACKAGE}: install Info links for ${FLAVOR}
+    install-info-altdir --quiet --section "" "" --dirname=${FLAVOR} /usr/info/${PACKAGE}.info.gz
+fi
+
+install -m 755 -d ${ELCDIR}
+cd ${ELDIR}
+FILES=`echo *.el`
+cp ${FILES} ${ELCDIR}
+cd ${ELCDIR}
+
+cat << EOF > path.el
+(setq load-path (cons "." load-path) byte-compile-warnings nil)
+EOF
+${FLAVOR} ${FLAGS} ${FILES}
+rm -f *.el path.el
+
+exit 0
diff --git a/debian/emacsen-remove.ex b/debian/emacsen-remove.ex
new file mode 100644
index 0000000..7570757
--- /dev/null
+++ b/debian/emacsen-remove.ex
@@ -0,0 +1,15 @@
+#!/bin/sh -e
+# /usr/lib/emacsen-common/packages/remove/x2goserver
+
+FLAVOR=$1
+PACKAGE=x2goserver
+
+if [ ${FLAVOR} != emacs ]; then
+    if test -x /usr/sbin/install-info-altdir; then
+        echo remove/${PACKAGE}: removing Info links for ${FLAVOR}
+        install-info-altdir --quiet --remove --dirname=${FLAVOR} /usr/info/x2goserver.info.gz
+    fi
+
+    echo remove/${PACKAGE}: purging byte-compiled files for ${FLAVOR}
+    rm -rf /usr/share/${FLAVOR}/site-lisp/${PACKAGE}
+fi
diff --git a/debian/emacsen-startup.ex b/debian/emacsen-startup.ex
new file mode 100644
index 0000000..a117cba
--- /dev/null
+++ b/debian/emacsen-startup.ex
@@ -0,0 +1,25 @@
+;; -*-emacs-lisp-*-
+;;
+;; Emacs startup file, e.g.  /etc/emacs/site-start.d/50x2goserver.el
+;; for the Debian x2goserver package
+;;
+;; Originally contributed by Nils Naumann <naumann at unileoben.ac.at>
+;; Modified by Dirk Eddelbuettel <edd at debian.org>
+;; Adapted for dh-make by Jim Van Zandt <jrv at debian.org>
+
+;; The x2goserver package follows the Debian/GNU Linux 'emacsen' policy and
+;; byte-compiles its elisp files for each 'emacs flavor' (emacs19,
+;; xemacs19, emacs20, xemacs20...).  The compiled code is then
+;; installed in a subdirectory of the respective site-lisp directory.
+;; We have to add this to the load-path:
+(let ((package-dir (concat "/usr/share/"
+                           (symbol-name flavor)
+                           "/site-lisp/x2goserver")))
+;; If package-dir does not exist, the x2goserver package must have
+;; removed but not purged, and we should skip the setup.
+  (when (file-directory-p package-dir)
+        (setq load-path (cons package-dir load-path))
+       (autoload 'x2goserver-mode "x2goserver-mode"
+         "Major mode for editing x2goserver files." t)
+       (add-to-list 'auto-mode-alist '("\\.x2goserver$" . x2goserver-mode))))
+
diff --git a/debian/init.d b/debian/init.d
new file mode 100644
index 0000000..c41fe23
--- /dev/null
+++ b/debian/init.d
@@ -0,0 +1,82 @@
+#! /bin/sh
+#
+# skeleton	example file to build /etc/init.d/ scripts.
+#		This file should be used to construct scripts for /etc/init.d.
+#
+#		Written by Miquel van Smoorenburg <miquels at cistron.nl>.
+#		Modified for Debian 
+#		by Ian Murdock <imurdock at gnu.ai.mit.edu>.
+#
+# Version:	@(#)skeleton  1.9  26-Feb-2001  miquels at cistron.nl
+#
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+export HOSTNAME
+DAEMON=/usr/sbin/x2gocleansessions
+NAME=x2goserver
+DESC=x2goserver
+
+test -x $DAEMON || exit 0
+
+# Include x2goserver defaults if available
+if [ -f /etc/default/x2goserver ] ; then
+	. /etc/default/x2goserver
+fi
+
+set -e
+
+case "$1" in
+  start)
+	echo -n "Starting $DESC: "
+	start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
+		--exec $DAEMON -- $DAEMON_OPTS
+	echo "$NAME."
+	;;
+  stop)
+	echo -n "Stopping $DESC: "
+	start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid 
+	
+	echo "$NAME."
+	;;
+  #reload)
+	#
+	#	If the daemon can reload its config files on the fly
+	#	for example by sending it SIGHUP, do it here.
+	#
+	#	If the daemon responds to changes in its config file
+	#	directly anyway, make this a do-nothing entry.
+	#
+	# echo "Reloading $DESC configuration files."
+	# start-stop-daemon --stop --signal 1 --quiet --pidfile \
+	#	/var/run/$NAME.pid --exec $DAEMON
+  #;;
+  force-reload)
+	#
+	#	If the "reload" option is implemented, move the "force-reload"
+	#	option to the "reload" entry above. If not, "force-reload" is
+	#	just the same as "restart" except that it does nothing if the
+	#   daemon isn't already running.
+	# check wether $DAEMON is running. If so, restart
+	start-stop-daemon --stop --test --quiet --pidfile \
+		/var/run/$NAME.pid  \
+	&& $0 restart \
+	|| exit 0
+	;;
+  restart)
+    echo -n "Restarting $DESC: "
+	start-stop-daemon --stop --oknodo --quiet --pidfile \
+		/var/run/$NAME.pid 
+	sleep 1
+	start-stop-daemon --start --quiet --pidfile \
+		/var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
+	echo "$NAME."
+	;;
+  *)
+	N=/etc/init.d/$NAME
+	# echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
+	echo "Usage: $N {start|stop|restart|force-reload}" >&2
+	exit 1
+	;;
+esac
+
+exit 0
diff --git a/debian/init.d.ex b/debian/init.d.ex
new file mode 100644
index 0000000..9d4e4b6
--- /dev/null
+++ b/debian/init.d.ex
@@ -0,0 +1,81 @@
+#! /bin/sh
+#
+# skeleton	example file to build /etc/init.d/ scripts.
+#		This file should be used to construct scripts for /etc/init.d.
+#
+#		Written by Miquel van Smoorenburg <miquels at cistron.nl>.
+#		Modified for Debian 
+#		by Ian Murdock <imurdock at gnu.ai.mit.edu>.
+#
+# Version:	@(#)skeleton  1.9  26-Feb-2001  miquels at cistron.nl
+#
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+DAEMON=/usr/sbin/x2goserver
+NAME=x2goserver
+DESC=x2goserver
+
+test -x $DAEMON || exit 0
+
+# Include x2goserver defaults if available
+if [ -f /etc/default/x2goserver ] ; then
+	. /etc/default/x2goserver
+fi
+
+set -e
+
+case "$1" in
+  start)
+	echo -n "Starting $DESC: "
+	start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
+		--exec $DAEMON -- $DAEMON_OPTS
+	echo "$NAME."
+	;;
+  stop)
+	echo -n "Stopping $DESC: "
+	start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
+		--exec $DAEMON
+	echo "$NAME."
+	;;
+  #reload)
+	#
+	#	If the daemon can reload its config files on the fly
+	#	for example by sending it SIGHUP, do it here.
+	#
+	#	If the daemon responds to changes in its config file
+	#	directly anyway, make this a do-nothing entry.
+	#
+	# echo "Reloading $DESC configuration files."
+	# start-stop-daemon --stop --signal 1 --quiet --pidfile \
+	#	/var/run/$NAME.pid --exec $DAEMON
+  #;;
+  force-reload)
+	#
+	#	If the "reload" option is implemented, move the "force-reload"
+	#	option to the "reload" entry above. If not, "force-reload" is
+	#	just the same as "restart" except that it does nothing if the
+	#   daemon isn't already running.
+	# check wether $DAEMON is running. If so, restart
+	start-stop-daemon --stop --test --quiet --pidfile \
+		/var/run/$NAME.pid --exec $DAEMON \
+	&& $0 restart \
+	|| exit 0
+	;;
+  restart)
+    echo -n "Restarting $DESC: "
+	start-stop-daemon --stop --quiet --pidfile \
+		/var/run/$NAME.pid --exec $DAEMON
+	sleep 1
+	start-stop-daemon --start --quiet --pidfile \
+		/var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
+	echo "$NAME."
+	;;
+  *)
+	N=/etc/init.d/$NAME
+	# echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
+	echo "Usage: $N {start|stop|restart|force-reload}" >&2
+	exit 1
+	;;
+esac
+
+exit 0
diff --git a/debian/manpage.1.ex b/debian/manpage.1.ex
new file mode 100644
index 0000000..343ab46
--- /dev/null
+++ b/debian/manpage.1.ex
@@ -0,0 +1,59 @@
+.\"                                      Hey, EMACS: -*- nroff -*-
+.\" First parameter, NAME, should be all caps
+.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
+.\" other parameters are allowed: see man(7), man(1)
+.TH X2GOSERVER SECTION "Februar  8, 2007"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh        disable hyphenation
+.\" .hy        enable hyphenation
+.\" .ad l      left justify
+.\" .ad b      justify to both left and right margins
+.\" .nf        disable filling
+.\" .fi        enable filling
+.\" .br        insert line break
+.\" .sp <n>    insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+x2goserver \- program to do something
+.SH SYNOPSIS
+.B x2goserver
+.RI [ options ] " files" ...
+.br
+.B bar
+.RI [ options ] " files" ...
+.SH DESCRIPTION
+This manual page documents briefly the
+.B x2goserver
+and
+.B bar
+commands.
+.PP
+.\" TeX users may be more comfortable with the \fB<whatever>\fP and
+.\" \fI<whatever>\fP escape sequences to invode bold face and italics, 
+.\" respectively.
+\fBx2goserver\fP is a program that...
+.SH OPTIONS
+These programs follow the usual GNU command line syntax, with long
+options starting with two dashes (`-').
+A summary of options is included below.
+For a complete description, see the Info files.
+.TP
+.B \-h, \-\-help
+Show summary of options.
+.TP
+.B \-v, \-\-version
+Show version of program.
+.SH SEE ALSO
+.BR bar (1),
+.BR baz (1).
+.br
+The programs are documented fully by
+.IR "The Rise and Fall of a Fooish Bar" ,
+available via the Info system.
+.SH AUTHOR
+x2goserver was written by <upstream author>.
+.PP
+This manual page was written by Oleksandr Shneyder <oleksandr.shneyder at obviously-nice.de>,
+for the Debian project (but may be used by others).
diff --git a/debian/manpage.sgml.ex b/debian/manpage.sgml.ex
new file mode 100644
index 0000000..a1817e6
--- /dev/null
+++ b/debian/manpage.sgml.ex
@@ -0,0 +1,156 @@
+<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
+
+<!-- Process this file with docbook-to-man to generate an nroff manual
+     page: `docbook-to-man manpage.sgml > manpage.1'.  You may view
+     the manual page with: `docbook-to-man manpage.sgml | nroff -man |
+     less'.  A typical entry in a Makefile or Makefile.am is:
+
+manpage.1: manpage.sgml
+	docbook-to-man $< > $@
+
+    
+	The docbook-to-man binary is found in the docbook-to-man package.
+	Please remember that if you create the nroff version in one of the
+	debian/rules file targets (such as build), you will need to include
+	docbook-to-man in your Build-Depends control field.
+
+  -->
+
+  <!-- Fill in your name for FIRSTNAME and SURNAME. -->
+  <!ENTITY dhfirstname "<firstname>FIRSTNAME</firstname>">
+  <!ENTITY dhsurname   "<surname>SURNAME</surname>">
+  <!-- Please adjust the date whenever revising the manpage. -->
+  <!ENTITY dhdate      "<date>Februar  8, 2007</date>">
+  <!-- SECTION should be 1-8, maybe w/ subsection other parameters are
+       allowed: see man(7), man(1). -->
+  <!ENTITY dhsection   "<manvolnum>SECTION</manvolnum>">
+  <!ENTITY dhemail     "<email>oleksandr.shneyder at obviously-nice.de</email>">
+  <!ENTITY dhusername  "Oleksandr Shneyder">
+  <!ENTITY dhucpackage "<refentrytitle>X2GOSERVER</refentrytitle>">
+  <!ENTITY dhpackage   "x2goserver">
+
+  <!ENTITY debian      "<productname>Debian</productname>">
+  <!ENTITY gnu         "<acronym>GNU</acronym>">
+  <!ENTITY gpl         "&gnu; <acronym>GPL</acronym>">
+]>
+
+<refentry>
+  <refentryinfo>
+    <address>
+      &dhemail;
+    </address>
+    <author>
+      &dhfirstname;
+      &dhsurname;
+    </author>
+    <copyright>
+      <year>2003</year>
+      <holder>&dhusername;</holder>
+    </copyright>
+    &dhdate;
+  </refentryinfo>
+  <refmeta>
+    &dhucpackage;
+
+    &dhsection;
+  </refmeta>
+  <refnamediv>
+    <refname>&dhpackage;</refname>
+
+    <refpurpose>program to do something</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>
+    <cmdsynopsis>
+      <command>&dhpackage;</command>
+
+      <arg><option>-e <replaceable>this</replaceable></option></arg>
+
+      <arg><option>--example <replaceable>that</replaceable></option></arg>
+    </cmdsynopsis>
+  </refsynopsisdiv>
+  <refsect1>
+    <title>DESCRIPTION</title>
+
+    <para>This manual page documents briefly the
+      <command>&dhpackage;</command> and <command>bar</command>
+      commands.</para>
+
+    <para>This manual page was written for the &debian; distribution
+      because the original program does not have a manual page.
+      Instead, it has documentation in the &gnu;
+      <application>Info</application> format; see below.</para>
+
+    <para><command>&dhpackage;</command> is a program that...</para>
+
+  </refsect1>
+  <refsect1>
+    <title>OPTIONS</title>
+
+    <para>These programs follow the usual &gnu; command line syntax,
+      with long options starting with two dashes (`-').  A summary of
+      options is included below.  For a complete description, see the
+      <application>Info</application> files.</para>
+
+    <variablelist>
+      <varlistentry>
+        <term><option>-h</option>
+          <option>--help</option>
+        </term>
+        <listitem>
+          <para>Show summary of options.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term><option>-v</option>
+          <option>--version</option>
+        </term>
+        <listitem>
+          <para>Show version of program.</para>
+        </listitem>
+      </varlistentry>
+    </variablelist>
+  </refsect1>
+  <refsect1>
+    <title>SEE ALSO</title>
+
+    <para>bar (1), baz (1).</para>
+
+    <para>The programs are documented fully by <citetitle>The Rise and
+      Fall of a Fooish Bar</citetitle> available via the
+      <application>Info</application> system.</para>
+  </refsect1>
+  <refsect1>
+    <title>AUTHOR</title>
+
+    <para>This manual page was written by &dhusername; &dhemail; for
+      the &debian; system (but may be used by others).  Permission is
+      granted to copy, distribute and/or modify this document under
+      the terms of the &gnu; General Public License, Version 2 any 
+	  later version published by the Free Software Foundation.
+    </para>
+	<para>
+	  On Debian systems, the complete text of the GNU General Public
+	  License can be found in /usr/share/common-licenses/GPL.
+	</para>
+
+  </refsect1>
+</refentry>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:2
+sgml-indent-data:t
+sgml-parent-document:nil
+sgml-default-dtd-file:nil
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+-->
+
+
diff --git a/debian/manpage.xml.ex b/debian/manpage.xml.ex
new file mode 100644
index 0000000..edd79ea
--- /dev/null
+++ b/debian/manpage.xml.ex
@@ -0,0 +1,148 @@
+<?xml version='1.0' encoding='ISO-8859-1'?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
+
+<!--
+
+Process this file with an XSLT processor: `xsltproc \
+-''-nonet /usr/share/sgml/docbook/stylesheet/xsl/nwalsh/\
+manpages/docbook.xsl manpage.dbk'.  A manual page
+<package>.<section> will be generated.  You may view the
+manual page with: nroff -man <package>.<section> | less'.  A
+typical entry in a Makefile or Makefile.am is:
+
+DB2MAN=/usr/share/sgml/docbook/stylesheet/xsl/nwalsh/\
+manpages/docbook.xsl
+XP=xsltproc -''-nonet
+
+manpage.1: manpage.dbk
+        $(XP) $(DB2MAN) $<
+    
+The xsltproc binary is found in the xsltproc package.  The
+XSL files are in docbook-xsl.  Please remember that if you
+create the nroff version in one of the debian/rules file
+targets (such as build), you will need to include xsltproc
+and docbook-xsl in your Build-Depends control field.
+
+-->
+
+  <!-- Fill in your name for FIRSTNAME and SURNAME. -->
+  <!ENTITY dhfirstname "<firstname>FIRSTNAME</firstname>">
+  <!ENTITY dhsurname   "<surname>SURNAME</surname>">
+  <!-- Please adjust the date whenever revising the manpage. -->
+  <!ENTITY dhdate      "<date>Februar  8, 2007</date>">
+  <!-- SECTION should be 1-8, maybe w/ subsection other parameters are
+       allowed: see man(7), man(1). -->
+  <!ENTITY dhsection   "<manvolnum>SECTION</manvolnum>">
+  <!ENTITY dhemail     "<email>oleksandr.shneyder at obviously-nice.de</email>">
+  <!ENTITY dhusername  "Oleksandr Shneyder">
+  <!ENTITY dhucpackage "<refentrytitle>X2GOSERVER</refentrytitle>">
+  <!ENTITY dhpackage   "x2goserver">
+
+  <!ENTITY debian      "<productname>Debian</productname>">
+  <!ENTITY gnu         "<acronym>GNU</acronym>">
+  <!ENTITY gpl         "&gnu; <acronym>GPL</acronym>">
+]>
+
+<refentry>
+  <refentryinfo>
+    <address>
+      &dhemail;
+    </address>
+    <author>
+      &dhfirstname;
+      &dhsurname;
+    </author>
+    <copyright>
+      <year>2003</year>
+      <holder>&dhusername;</holder>
+    </copyright>
+    &dhdate;
+  </refentryinfo>
+  <refmeta>
+    &dhucpackage;
+
+    &dhsection;
+  </refmeta>
+  <refnamediv>
+    <refname>&dhpackage;</refname>
+
+    <refpurpose>program to do something</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>
+    <cmdsynopsis>
+      <command>&dhpackage;</command>
+
+      <arg><option>-e <replaceable>this</replaceable></option></arg>
+
+      <arg><option>--example <replaceable>that</replaceable></option></arg>
+    </cmdsynopsis>
+  </refsynopsisdiv>
+  <refsect1>
+    <title>DESCRIPTION</title>
+
+    <para>This manual page documents briefly the
+      <command>&dhpackage;</command> and <command>bar</command>
+      commands.</para>
+
+    <para>This manual page was written for the &debian; distribution
+      because the original program does not have a manual page.
+      Instead, it has documentation in the &gnu;
+      <application>Info</application> format; see below.</para>
+
+    <para><command>&dhpackage;</command> is a program that...</para>
+
+  </refsect1>
+  <refsect1>
+    <title>OPTIONS</title>
+
+    <para>These programs follow the usual &gnu; command line syntax,
+      with long options starting with two dashes (`-').  A summary of
+      options is included below.  For a complete description, see the
+      <application>Info</application> files.</para>
+
+    <variablelist>
+      <varlistentry>
+        <term><option>-h</option>
+          <option>--help</option>
+        </term>
+        <listitem>
+          <para>Show summary of options.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term><option>-v</option>
+          <option>--version</option>
+        </term>
+        <listitem>
+          <para>Show version of program.</para>
+        </listitem>
+      </varlistentry>
+    </variablelist>
+  </refsect1>
+  <refsect1>
+    <title>SEE ALSO</title>
+
+    <para>bar (1), baz (1).</para>
+
+    <para>The programs are documented fully by <citetitle>The Rise and
+      Fall of a Fooish Bar</citetitle> available via the
+      <application>Info</application> system.</para>
+  </refsect1>
+  <refsect1>
+    <title>AUTHOR</title>
+
+    <para>This manual page was written by &dhusername; &dhemail; for
+      the &debian; system (but may be used by others).  Permission is
+      granted to copy, distribute and/or modify this document under
+      the terms of the &gnu; General Public License, Version 2 any 
+	  later version published by the Free Software Foundation.
+    </para>
+	<para>
+	  On Debian systems, the complete text of the GNU General Public
+	  License can be found in /usr/share/common-licenses/GPL.
+	</para>
+
+  </refsect1>
+</refentry>
+
diff --git a/debian/menu.ex b/debian/menu.ex
new file mode 100644
index 0000000..5fe32c1
--- /dev/null
+++ b/debian/menu.ex
@@ -0,0 +1,2 @@
+?package(x2goserver):needs="X11|text|vc|wm" section="Apps/see-menu-manual"\
+  title="x2goserver" command="/usr/bin/x2goserver"
diff --git a/debian/postinst.ex b/debian/postinst.ex
new file mode 100644
index 0000000..5a6a780
--- /dev/null
+++ b/debian/postinst.ex
@@ -0,0 +1,41 @@
+#!/bin/sh
+# postinst script for x2goserver
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <postinst> `abort-remove'
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    configure)
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
diff --git a/debian/postrm.ex b/debian/postrm.ex
new file mode 100644
index 0000000..791f2d6
--- /dev/null
+++ b/debian/postrm.ex
@@ -0,0 +1,39 @@
+#!/bin/sh
+# postrm script for x2goserver
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postrm> `remove'
+#        * <postrm> `purge'
+#        * <old-postrm> `upgrade' <new-version>
+#        * <new-postrm> `failed-upgrade' <old-version>
+#        * <new-postrm> `abort-install'
+#        * <new-postrm> `abort-install' <old-version>
+#        * <new-postrm> `abort-upgrade' <old-version>
+#        * <disappearer's-postrm> `disappear' <overwriter>
+#          <overwriter-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+    ;;
+
+    *)
+        echo "postrm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
diff --git a/debian/preinst b/debian/preinst
new file mode 100755
index 0000000..1f73c6b
--- /dev/null
+++ b/debian/preinst
@@ -0,0 +1,97 @@
+#!/bin/bash
+# preinst script for x2goserver
+#
+# see: dh_installdeb(1)
+
+#set -e
+
+# summary of how this script can be called:
+#        * <new-preinst> `install'
+#        * <new-preinst> `install' <old-version>
+#        * <new-preinst> `upgrade' <old-version>
+#        * <old-preinst> `abort-upgrade' <new-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+case "$1" in
+    install|upgrade)
+    VERSION=$2
+    V1=`echo $VERSION|awk '{split($0,a,"."); print a[1]}'`
+    V2=`echo $VERSION|awk '{split($0,a,"."); print a[2]}'`
+    DV=`echo $VERSION|awk '{split($0,a,"."); print a[3]}'`
+    V3=`echo $DV|awk '{split($0,a,"-"); print a[1]}'`
+    V4=`echo $DV|awk '{split($0,a,"-"); print a[2]}'`
+    if [ "$V1" == "" ]
+    then
+        V1=0
+    fi
+    
+    if [ "$V2" == "" ]
+    then
+        V2=0
+    fi
+    
+    if [ "$V3" == "" ]
+    then
+        V3=0
+    fi
+    
+    if [ "$V4" == "" ]
+    then
+        V4=0
+    fi
+    
+    VSUM=$(($V1*100000 + $V2*10000 + $V3*100 +$V4))
+    if [ $(( $VSUM < 200117 && $VSUM != 0)) != 0 ] 
+    then
+        echo "
+
+
+
+----------------
+Attention:
+
+you are upgrading to a newer version of x2goserver. Please close all running x2go sessions and make sure that nobody will login during the installation procedure. You'll need to import a new database layout for this version, so please start the import script /usr/lib/x2go/script/x2gocreatebase.sh on your data base server after the packages have been installed.
+----------------
+
+Press Enter to continue
+
+"
+      read
+    fi
+    X2GOGRP=`getent group | grep x2gousers`
+    
+    if [ "$X2GOGRP" == "" ]
+    then 
+         addgroup --system x2gousers
+    fi
+    
+    SUDOCONF=`cat /etc/sudoers | grep x2gopgwrapper | grep x2gousers`
+    if [ "$SUDOCONF" == "" ]
+    then
+          echo "
+#### X2GO section
+%x2gousers ALL=(ALL) NOPASSWD: /usr/bin/x2gopgwrapper
+" >> /etc/sudoers       
+    fi
+
+    echo "Attention: If you want to allow users to log into the x2go system, you'll need to add them to the \"x2gousers\" group"
+    ;;
+
+    abort-upgrade)
+    ;;
+
+    *)
+        echo "preinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
diff --git a/debian/preinst.ex b/debian/preinst.ex
new file mode 100644
index 0000000..cad3fac
--- /dev/null
+++ b/debian/preinst.ex
@@ -0,0 +1,38 @@
+#!/bin/sh
+# preinst script for x2goserver
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <new-preinst> `install'
+#        * <new-preinst> `install' <old-version>
+#        * <new-preinst> `upgrade' <old-version>
+#        * <old-preinst> `abort-upgrade' <new-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    install|upgrade)
+    echo "prev version is $2"
+    ;;
+
+    abort-upgrade)
+    ;;
+
+    *)
+        echo "preinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
diff --git a/debian/prerm.ex b/debian/prerm.ex
new file mode 100644
index 0000000..d78641f
--- /dev/null
+++ b/debian/prerm.ex
@@ -0,0 +1,40 @@
+#!/bin/sh
+# prerm script for x2goserver
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <prerm> `remove'
+#        * <old-prerm> `upgrade' <new-version>
+#        * <new-prerm> `failed-upgrade' <old-version>
+#        * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
+#        * <deconfigured's-prerm> `deconfigure' `in-favour'
+#          <package-being-installed> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    remove|upgrade|deconfigure)
+    ;;
+
+    failed-upgrade)
+    ;;
+
+    *)
+        echo "prerm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..681a023
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,119 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+
+
+
+CFLAGS = -Wall -g
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+	CFLAGS += -O0
+else
+	CFLAGS += -O2
+endif
+
+configure: configure-stamp
+configure-stamp:
+	dh_testdir
+	# Add here commands to configure the package.
+
+	touch configure-stamp
+
+
+build: build-stamp
+
+build-stamp: configure-stamp 
+	dh_testdir
+
+	# Add here commands to compile the package.
+	#docbook-to-man debian/x2goserver.sgml > x2goserver.1
+
+	touch $@
+
+clean:
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp configure-stamp
+
+	# Add here commands to clean up after the build process.
+
+	dh_clean 
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k 
+	dh_installdirs
+
+	# Add here commands to install the package into debian/x2goserver.
+	install  x2gocmdexitmessage  $(CURDIR)/debian/x2goserver/usr/bin/
+	install  x2gogetservers  $(CURDIR)/debian/x2goserver/usr/bin/
+	install  x2golistsessions  $(CURDIR)/debian/x2goserver/usr/bin/
+	install  x2golistsessions_root  $(CURDIR)/debian/x2goserver/usr/bin/
+	install  x2golistsessions_sql  $(CURDIR)/debian/x2goserver/usr/bin/
+	install  x2gomountdirs  $(CURDIR)/debian/x2goserver/usr/bin/
+	install  x2gopgwrapper  $(CURDIR)/debian/x2goserver/usr/bin/
+	install  x2gopgwrapper_local  $(CURDIR)/debian/x2goserver/usr/bin/
+	install  x2gopgwrapper_net  $(CURDIR)/debian/x2goserver/usr/bin/
+	install  x2goresume-session  $(CURDIR)/debian/x2goserver/usr/bin/
+	install  x2goruncommand  $(CURDIR)/debian/x2goserver/usr/bin/
+	install  x2goshowblocks  $(CURDIR)/debian/x2goserver/usr/bin/
+	install  x2gostartagent  $(CURDIR)/debian/x2goserver/usr/bin/
+	install  x2gosuspend-session  $(CURDIR)/debian/x2goserver/usr/bin/
+	install  x2gosuspend-agent  $(CURDIR)/debian/x2goserver/usr/bin/
+	install  x2goterminate  $(CURDIR)/debian/x2goserver/usr/bin/
+	install  x2goterminate-session  $(CURDIR)/debian/x2goserver/usr/bin/
+	install  x2goumount  $(CURDIR)/debian/x2goserver/usr/bin/
+	install  x2goumount_session  $(CURDIR)/debian/x2goserver/usr/bin/
+	cp  sql  $(CURDIR)/debian/x2goserver/etc/x2go/
+	install  x2gocleansessions  $(CURDIR)/debian/x2goserver/usr/sbin/
+	install  x2gocreatebase.sh  $(CURDIR)/debian/x2goserver/usr/lib/x2go/script
+
+
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+	dh_testdir
+	dh_testroot
+	dh_installchangelogs 
+	dh_installdocs
+	dh_installexamples
+#	dh_install
+#	dh_installmenu
+#	dh_installdebconf	
+#	dh_installlogrotate
+#	dh_installemacsen
+#	dh_installpam
+#	dh_installmime
+#	dh_python
+	dh_installinit -R
+#	dh_installcron
+#	dh_installinfo
+	dh_installman
+	dh_link
+	dh_strip
+	dh_compress
+	dh_fixperms
+#	dh_perl
+#	dh_makeshlibs
+	dh_installdeb
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
diff --git a/debian/watch.ex b/debian/watch.ex
new file mode 100644
index 0000000..472c4c7
--- /dev/null
+++ b/debian/watch.ex
@@ -0,0 +1,22 @@
+# Example watch control file for uscan
+# Rename this file to "watch" and then you can run the "uscan" command
+# to check for upstream updates and more.
+# See uscan(1) for format
+
+# Compulsory line, this is a version 3 file
+version=3
+
+# Uncomment to examine a Webpage 
+# <Webpage URL> <string match>
+#http://www.example.com/downloads.php x2goserver-(.*)\.tar\.gz
+
+# Uncomment to examine a Webserver directory
+#http://www.example.com/pub/x2goserver-(.*)\.tar\.gz
+
+# Uncommment to examine a FTP server
+#ftp://ftp.example.com/pub/x2goserver-(.*)\.tar\.gz debian uupdate
+
+# Uncomment to find new files on sourceforge, for debscripts >= 2.9
+# http://sf.net/x2goserver/x2goserver-(.*)\.tar\.gz
+
+
diff --git a/debian/x2goserver-default.ex b/debian/x2goserver-default.ex
new file mode 100644
index 0000000..ad6479a
--- /dev/null
+++ b/debian/x2goserver-default.ex
@@ -0,0 +1,10 @@
+# Defaults for x2goserver initscript
+# sourced by /etc/init.d/x2goserver
+# installed at /etc/default/x2goserver by the maintainer scripts
+
+#
+# This is a POSIX shell fragment
+#
+
+# Additional options that are passed to the Daemon.
+DAEMON_OPTS=""
diff --git a/debian/x2goserver.doc-base.EX b/debian/x2goserver.doc-base.EX
new file mode 100644
index 0000000..7d379a3
--- /dev/null
+++ b/debian/x2goserver.doc-base.EX
@@ -0,0 +1,22 @@
+Document: x2goserver
+Title: Debian x2goserver Manual
+Author: <insert document author here>
+Abstract: This manual describes what x2goserver is
+ and how it can be used to
+ manage online manuals on Debian systems.
+Section: unknown
+
+Format: debiandoc-sgml
+Files: /usr/share/doc/x2goserver/x2goserver.sgml.gz
+
+Format: postscript
+Files: /usr/share/doc/x2goserver/x2goserver.ps.gz
+
+Format: text
+Files: /usr/share/doc/x2goserver/x2goserver.text.gz
+
+Format: HTML
+Index: /usr/share/doc/x2goserver/html/index.html
+Files: /usr/share/doc/x2goserver/html/*.html
+
+  
diff --git a/sql b/sql
new file mode 100644
index 0000000..c2c027f
--- /dev/null
+++ b/sql
@@ -0,0 +1 @@
+local
\ No newline at end of file
diff --git a/x2gocleansessions b/x2gocleansessions
index c23056f..491d634 100755
--- a/x2gocleansessions
+++ b/x2gocleansessions
@@ -34,11 +34,38 @@ sub check_stat
 }
 
 
+sub catch_term
+{
+   unlink("/var/run/x2goserver.pid");
+   exit;
+}
+
 my $uname;
 my $serv=$ENV{'HOSTNAME'};
 
-while(sleep 5)
+my $pid = fork();
+if (not defined $pid) 
+{
+  print "resources not avilable.\n";
+} 
+elsif ($pid != 0) 
 {
+    open (F,">/var/run/x2goserver.pid");
+    print F "$pid\n";
+    close(F);
+}
+elsif ($pid == 0 )
+{
+
+ close(STDIN);
+ close(STDOUT);
+ close(STDERR);
+ 
+ $SIG{TERM}=\&catch_term;
+ 
+ while(sleep 5)
+ {
+  $serv=`hostname`;
   my $outp=`x2golistsessions_sql $serv 2>/dev/null`;
 
   my @outp=split("\n","$outp");
@@ -48,16 +75,16 @@ while(sleep 5)
      my @sinfo=split('\\|',"@outp[$i]");
      if(@sinfo[4]eq 'F')
      {
-	 print "@sinfo[1], is blocked\n";
-	 print "(@sinfo[1])Unmounting all shares\n";	        
-	 system( "su @sinfo[11] -c \"export HOSTNAME && x2goumount_session @sinfo[1]\"");
+	 #print "@sinfo[1], is blocked\n";
+	 #print "(@sinfo[1])Unmounting all shares\n";	        
+	 system( "su @sinfo[11] -c \"export HOSTNAME && x2goumount_session @sinfo[1]\" 2> /dev/null");
      }       
      elsif(! check_pid (@sinfo[0], at sinfo[1], at sinfo[12]))
      {
          system("su @sinfo[11] -c \"sudo x2gopgwrapper changestatus 'F' @sinfo[1] \" > /dev/null");
-	 print "@sinfo[1], pid @sinfo[0] not exist, changing status from @sinfo[4] to F\n";
-	 print "(@sinfo[1])Unmounting all shares\n";	 
-	 system( "su @sinfo[11] -c \"export HOSTNAME && x2goumount_session @sinfo[1]\"");
+	 #print "@sinfo[1], pid @sinfo[0] not exist, changing status from @sinfo[4] to F\n";
+	 #print "(@sinfo[1])Unmounting all shares\n";	 
+	 system( "su @sinfo[11] -c \"export HOSTNAME && x2goumount_session @sinfo[1]\" 2> /dev/null");
      }
      else
      { 
@@ -66,11 +93,12 @@ while(sleep 5)
            if(!check_stat(@sinfo[1], at sinfo[11]))
 	   {
                system("su @sinfo[11] -c  \"sudo x2gopgwrapper changestatus 'S' @sinfo[1] \" > /dev/null");
-	       print "@sinfo[1], is suspended, changing status from @sinfo[4] to S\n";
-	       print "(@sinfo[1])Unmounting all shares\n";	        
-	       system( "su @sinfo[11] -c \"export HOSTNAME && x2goumount_session @sinfo[1]\"");
+	       #print "@sinfo[1], is suspended, changing status from @sinfo[4] to S\n";
+	       #print "(@sinfo[1])Unmounting all shares\n";	        
+	       system( "su @sinfo[11] -c \"export HOSTNAME && x2goumount_session @sinfo[1]\" 2> /dev/null");
            }
        }       
      }
   }
+ }
 }
\ No newline at end of file
diff --git a/x2gocmdexitmessage b/x2gocmdexitmessage
new file mode 100755
index 0000000..29da10e
--- /dev/null
+++ b/x2gocmdexitmessage
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+
+X2GO_ROOT=${HOME}/.x2go
+MESSAGE_FILE=$X2GO_ROOT/C-$1/cmdoutput
+
+cat $MESSAGE_FILE
\ No newline at end of file
diff --git a/x2gocreatebase.sh b/x2gocreatebase.sh
index 9eaf4a1..6bb025d 100755
--- a/x2gocreatebase.sh
+++ b/x2gocreatebase.sh
@@ -1,10 +1,12 @@
 #!/bin/bash
+
+su postgres -c "dropdb x2go_sessions"
 su postgres -c "createdb x2go_sessions"
 su postgres -c "echo \"create table sessions(
-		session_id varchar(100) primary key, 
+		session_id varchar(500) primary key, 
                 display integer not null, 
-		uname varchar(20) not null, 
-		server varchar(20) not null,
+		uname varchar(100) not null, 
+		server varchar(100) not null,
 		client inet,
 		status char(1) not null default 'R',
 		init_time timestamp not null default now(),
@@ -12,26 +14,26 @@ su postgres -c "echo \"create table sessions(
 		cookie char(33),
 		agent_pid int,
 		gr_port int,
-		sound_port int, 
-		unique(display,server)
+		sound_port int,
+		fs_port int,
+		unique(display)
 		)\" | psql x2go_sessions"
 
 su postgres -c "echo \"create table messages(mess_id varchar(20) primary key, message text)\" | psql x2go_sessions"
 
 su postgres -c "echo \"create table user_messages(
                 mess_id varchar(20) not null, 
-		uname varchar(20) not null
+		uname varchar(100) not null
 		)\" | psql x2go_sessions"
 
 su postgres -c "echo \"create table used_ports(
-                server varchar(20) not null,
-		session_id varchar(100) references sessions on delete cascade, 
-		port integer not null, 
-		primary key(server,port)
+                server varchar(100) not null,
+		session_id varchar(500) references sessions on delete cascade, 
+		port integer primary key
 		)\" | psql x2go_sessions"
 
 su postgres -c "echo \"create table mounts(
-                session_id varchar(100) references sessions on delete restrict,
+                session_id varchar(500) references sessions on delete restrict,
 		path varchar(512) not null, 
 		client inet not null, 
 		primary key(path,client)
diff --git a/x2golistsessions b/x2golistsessions
index 9b01454..726cc6d 100755
--- a/x2golistsessions
+++ b/x2golistsessions
@@ -1,24 +1,6 @@
 #!/usr/bin/perl
 use strict;
 
-sub check_pid
-{
-   my $pid=shift;
-   my $sess=shift;
-   my $sec=shift;
-   if($sec < 30)
-   {
-      return 1;
-   }
-   open (F,"</proc/$pid/cmdline") or return 0;
-   my $text=<F>;
-   close (F);
-   if($text =~ m/$sess/)
-   {
-      return 1;
-   }
-   return 0;
-}
 
 sub check_stat
 {
@@ -32,10 +14,22 @@ sub check_stat
    return 1;
 }
 
-
-my $serv=$ENV{'HOSTNAME'};
+my $serv=shift;
+if( ! $serv)
+{
+   $serv=$ENV{'HOSTNAME'};
+}
 my $uname=$ENV{'USER'};
-my $outp=`sudo x2gopgwrapper listsessions $serv`;
+my $outp;
+if($serv eq "--all-servers")
+{
+ $outp=`sudo x2gopgwrapper listsessions_all`;
+}
+else
+{
+ $outp=`sudo x2gopgwrapper listsessions $serv`;
+}
+
 my @outp=split("\n","$outp");
 for(my $i=0;$i<@outp;$i++)
 {
@@ -46,12 +40,6 @@ for(my $i=0;$i<@outp;$i++)
      {
            print "@outp[$i]\n";
      }       
-     elsif(! check_pid (@sinfo[0], at sinfo[1], at sinfo[12]) )
-     {
-
-         system("sudo x2gopgwrapper changestatus 'F' @sinfo[1] > /dev/null");
-         system( "x2goumount_session @sinfo[1]");
-     }
      else
      { 
        if(@sinfo[4]eq 'R')
diff --git a/x2golistsessions_root b/x2golistsessions_root
index 2a069d5..4e128b7 100755
--- a/x2golistsessions_root
+++ b/x2golistsessions_root
@@ -1,24 +1,6 @@
 #!/usr/bin/perl
 use strict;
 
-sub check_pid
-{
-   my $pid=shift;
-   my $sess=shift;
-   my $sec=shift;
-   if($sec < 30)
-   {
-      return 1;
-   }
-   open (F,"</proc/$pid/cmdline") or return 0;
-   my $text=<F>;
-   close (F);
-   if($text =~ m/$sess/)
-   {
-      return 1;
-   }
-   return 0;
-}
 
 sub check_stat
 {
@@ -35,10 +17,15 @@ sub check_stat
 
 
 my $uname;
-my $serv=$ENV{'HOSTNAME'};
+
+my $serv=shift;
+if( ! $serv)
+{
+   $serv=$ENV{'HOSTNAME'};
+}
+
 my $outp=`x2golistsessions_sql $serv 2>/dev/null`;
 
-print $serv;
 
 my @outp=split("\n","$outp");
 
@@ -49,12 +36,6 @@ for(my $i=0;$i<@outp;$i++)
      {
            print "@outp[$i]\n";
      }       
-     elsif(! check_pid (@sinfo[0], at sinfo[1], at sinfo[12]))
-     {
-         system("su - @sinfo[11] -c \"sudo x2gopgwrapper changestatus 'F' @sinfo[1] \" > /dev/null");
-         @outp[$i] =~ s/\|R\|/\|F\|/;
-         @outp[$i] =~ s/\|S\|/\|F\|/;
-     }
      else
      { 
        if(@sinfo[4]eq 'R')
diff --git a/x2golistsessions_sql b/x2golistsessions_sql
index 5f4839b..aa44679 100755
--- a/x2golistsessions_sql
+++ b/x2golistsessions_sql
@@ -1,7 +1,15 @@
 #!/usr/bin/perl
 use strict;
 my $serv=shift;
-my $outp=`sudo x2gopgwrapper listsessionsroot $serv`;
+my $outp;
+if($serv eq "--all-servers")
+{
+ $outp=`sudo x2gopgwrapper listsessionsroot_all`;
+}
+else
+{
+ $outp=`sudo x2gopgwrapper listsessionsroot $serv`;
+}
 $outp =~ s/ //g;
 $outp =~ s/\*/ /g;
 
diff --git a/x2gomountdirs b/x2gomountdirs
index 100de70..6cfc3cd 100755
--- a/x2gomountdirs
+++ b/x2gomountdirs
@@ -5,9 +5,44 @@ my $type=shift;
 my $session=shift;
 my $user=shift;
 my $key=shift;
-my $dirlist=shift;
+my @dl;
+my $i=0;
+ at dl[$i]=shift;
+while(@dl[$i])
+{
+    $i++;
+    @dl[$i]=shift;
+}
+my $dirlist=join(" ", at dl);
+chop($dirlist);
+my $reverse=0;
+my $port="22";
+print "dirs:$dirlist\n";
+if($dirlist =~ m/__REVERSESSH_PORT__/)
+{
+    @dl=split("__REVERSESSH_PORT__","$dirlist");
+    $dirlist=@dl[0];
+    $port=@dl[1];
+    $reverse=1;
+}
+
+if($dirlist =~ m/__SSH_PORT__/)
+{
+   @dl=split("__SSH_PORT__","$dirlist");
+   $dirlist=@dl[0];
+   $port=@dl[1];
+}
 
-my $host=(split(" ",$ENV{'SSH_CLIENT'}))[0];
+print "ssh port:$port\n";
+my $host;
+if($reverse == 0)
+{
+   $host=(split(" ",$ENV{'SSH_CLIENT'}))[0];
+}
+else
+{
+  $host='127.0.0.1';
+}
 print "Host:$host\n";
 print "User:$user\n";
 
@@ -27,47 +62,116 @@ open (F,">$key.ident");
 print F "$host $rsa_identity";
 close(F);
 
-#my $mdir="/tmp/$ENV{'USER'}_media";
-my $mdir="$ENV{'HOME'}/media";
-mkdir($mdir);
+
+my $mdir="/tmp/$ENV{'USER'}_media";
+my $ldir="$ENV{'HOME'}/media";
+my $spooldir_lnk="$ENV{'HOME'}/.x2go/C-$session/spool";
+my $spooldir="/tmp/spool_$ENV{'USER'}";
+
+if(! -e $mdir)
+{
+   mkdir($mdir);
+}
+chmod(0700,$mdir);
+
+if(! -e $spooldir)
+{
+   mkdir($spooldir);
+}
+chmod(0700,$spooldir);
+
+$spooldir="$spooldir/$session";
+if(! -e $spooldir)
+{
+   mkdir($spooldir);
+}
+chmod(0700,$spooldir);
+
+if( -d $ldir)
+{
+    rmdir($ldir);
+}
+
+if( ! -l $ldir)
+{
+   system ("ln -s $mdir $ldir");
+}
+
+if( -d $spooldir_lnk)
+{
+    rmdir($spooldir_lnk);
+}
+
+if( ! -l $spooldir_lnk)
+{
+   system ("ln -s $spooldir $spooldir_lnk");
+}
 
 my $uname=$ENV{'USER'};
 
 my @dirs=split(':',$dirlist);
 for(my $i=0;$i<@dirs;$i++)
 {
-       my $p=@dirs[$i];
-       if($type ne "dir")
+       my $printspool=0;
+       my $mntpath;
+       if(@dirs[$i]=~m/__PRINT_SPOOL_/)
        {
-           $p=~s/\/ramdrive\/mnt\///;
+            @dirs[$i]=~s/__PRINT_SPOOL_//;
+            $printspool=1;
+            $mntpath=$spooldir;
        }
-       $p=~s/\//_/g;
-       mkdir("$mdir/$p");
-       my $mntpath="$mdir/$p";
+       else
+       {
+            my $p=@dirs[$i];
+            if($type ne "dir")
+            {
+                $p=~s/\/ramdrive\/mnt\///;
+            }
+            $p=~s/\//_/g;
+            $p=~s/ /_/g;
+            $p=~s/_cygdrive_//g;
+            $p=~s/~//g;
+            mkdir("$mdir/$p");
+            $mntpath="$mdir/$p";
+       }
+
+       print "starting:sudo x2gopgwrapper insertmount $session \"$mntpath\" $host\n";
        my $outp=`sudo x2gopgwrapper insertmount $session \"$mntpath\" $host`;
+       print "result: $outp";
        if($outp =~ m/INSERT/)
        {
-            print "inserted, sshfs  -o IdentityFile=$key,UserKnownHostsFile=$key.ident $user\@$host:@dirs[$i] $mdir/$p\n";
-            if(system("sshfs  -o IdentityFile=$key,UserKnownHostsFile=$key.ident $user\@$host:@dirs[$i] $mdir/$p")==0)
+            print "inserted,\nsshfs  -o IdentityFile=$key,UserKnownHostsFile=$key.ident $user\@$host:\"@dirs[$i]\" \"$mntpath\" -p $port\n";
+            if(system("sshfs  -o Cipher=blowfish,IdentityFile=$key,UserKnownHostsFile=$key.ident $user\@$host:\"@dirs[$i]\" \"$mntpath\" -p $port 2>>~/mounts.log")==0)
             {   
         	print "mount @dirs[$i] ok\n";
-        	my $fname="$ENV{'HOME'}/Desktop";
-		$p=@dirs[$i];
-        	$p=~s/\//%2f/g;
-		$fname="$fname/$p";
-		if($type eq "dir")
-		{
-	    	    $fname="$fname(sshfs-disk)";
-		}
-		else
+		if(! $printspool)
 		{
-	    	    $fname="$fname(sshfs-removable)";
-		    $fname=~s/%2framdrive%2fmnt%2f//;
+        	    my $fname="$ENV{'HOME'}/Desktop";
+		    my $p=@dirs[$i];
+        	    $p=~s/\/cygdrive\///g;
+            	    $p=~s/\//_/g;
+		    $fname="$fname/$p";
+		    if($type eq "dir")
+		    {
+	    		$fname="$fname(sshfs-disk)";
+		    }
+		    else
+		    {
+			if($fname =~ m/CDROM/)
+			{
+	    	    	    $fname="$fname(sshfs-cdrom)";
+			}
+			else
+			{
+	    	    	    $fname="$fname(sshfs-removable)";
+			}
+			$fname=~s/_ramdrive_mnt_//;
+		    }
+		    print "fname: $fname\n";
+		    open(F,">$fname");
+		    print F "$mntpath\n$session\n\n\0";
+		    close(F);
 		}
-		print "fname: $fname\n";
-		open(F,">$fname");
-		print F "$mntpath\n$session";
-		close(F);
     	    }
     	    else
     	    {
diff --git a/x2gopgwrapper_local b/x2gopgwrapper_local
index 7b44887..721cb7e 100755
--- a/x2gopgwrapper_local
+++ b/x2gopgwrapper_local
@@ -7,11 +7,11 @@ UNAME=$SUDO_USER
 case "$1" in
 
 getdisplays)
-  echo "select '|'||display||'|' from sessions  where server = '$2';"|psql -t x2go_sessions
+  echo "select '|'||display||'|' from sessions;"|psql -t x2go_sessions
   ;;
 
 getports)
-  echo "select '|'||port||'|' from used_ports  where server = '$2';"|psql -t x2go_sessions
+  echo "select '|'||port||'|' from used_ports;"|psql -t x2go_sessions
   ;;
 
 getservers)
@@ -22,10 +22,18 @@ listsessions)
   echo "select agent_pid, session_id, display, server, status,\
    to_char(init_time,'DD.MM.YY*HH24:MI:SS'),cookie,client,gr_port,\
    sound_port,to_char(last_time,'DD.MM.YY*HH24:MI:SS'),uname,\
-   to_char(now()-init_time,'SSSS') from  sessions  \
+   to_char(now()-init_time,'SSSS'),fs_port from  sessions  \
    where status !='F' and server='$2' and uname='$UNAME' order by status desc;"|psql -t x2go_sessions
   ;;
 
+listsessions_all)
+  echo "select agent_pid, session_id, display, server, status,\
+   to_char(init_time,'DD.MM.YY*HH24:MI:SS'),cookie,client,gr_port,\
+   sound_port,to_char(last_time,'DD.MM.YY*HH24:MI:SS'),uname,\
+   to_char(now()-init_time,'SSSS'),fs_port  from  sessions  \
+   where status !='F' and uname='$UNAME' order by status desc;"|psql -t x2go_sessions
+  ;;
+
 listsessionsroot)
   if [ "$UNAME" != "root" ]
   then
@@ -35,10 +43,76 @@ listsessionsroot)
   echo "select agent_pid, session_id, display, server, status,\
    to_char(init_time,'DD.MM.YY*HH24:MI:SS'),cookie,client,gr_port,\
    sound_port,to_char(last_time,'DD.MM.YY*HH24:MI:SS'),uname,\
-   to_char(now()-init_time,'SSSS') from  sessions  \
+   to_char(now()-init_time,'SSSS'),fs_port  from  sessions  \
    where server='$2'  order by status desc;"|psql -t x2go_sessions
   ;;
 
+listsessionsroot_all)
+  if [ "$UNAME" != "root" ]
+  then
+    echo "$UNAME, You have not permission to do this job!"
+    exit  
+  fi
+  echo "select agent_pid, session_id, display, server, status,\
+   to_char(init_time,'DD.MM.YY*HH24:MI:SS'),cookie,client,gr_port,\
+   sound_port,to_char(last_time,'DD.MM.YY*HH24:MI:SS'),uname,\
+   to_char(now()-init_time,'SSSS'),fs_port  from  sessions  \
+   order by status desc;"|psql -t x2go_sessions
+  ;;
+
+listsusp)
+  if [ "$UNAME" != "root" ]
+  then
+    echo "$UNAME, You have not permission to do this job!"
+    exit  
+  fi
+  echo "select session_id, display, uname, server,extract( day from now()-last_time)*24*60+extract(hour from now()-last_time)*60+extract(minute from now()-last_time)\
+   from sessions where server='$2' and status='S';"|psql -t x2go_sessions
+  ;;
+
+listallrunning)
+  if [ "$UNAME" != "root" ]
+  then
+    echo "$UNAME, You have not permission to do this job!"
+    exit  
+  fi
+  echo "select agent_pid, session_id, display, server, status,\
+   to_char(init_time,'DD.MM.YY*HH24:MI:SS'),cookie,client,gr_port,\
+   sound_port,to_char(last_time,'DD.MM.YY*HH24:MI:SS'),uname,\
+   to_char(now()-init_time,'SSSS'),fs_port  from  sessions  \
+   where status='R';"|psql -t x2go_sessions
+  ;;
+
+listmails)
+  if [ "$UNAME" != "root" ]
+  then
+    echo "$UNAME, You have not permission to do this job!"
+    exit  
+  fi
+  echo "select user_messages.mess_id,sessions.session_id,\
+      sessions.uname,sessions.display from sessions,user_messages,\
+      messages where sessions.uname=user_messages.uname and sessions.status!='F'\
+      and messages.mess_id=user_messages.mess_id and sessions.server='$2';"|psql -t x2go_sessions
+  ;;
+
+getmail)
+  if [ "$UNAME" != "root" ]
+  then
+    echo "$UNAME, You have not permission to do this job!"
+    exit  
+  fi
+  echo "select message from messages where mess_id='$2';"|psql -t x2go_sessions
+  ;;
+
+rmmail)
+  if [ "$UNAME" != "root" ]
+  then
+    echo "$UNAME, You have not permission to do this job!"
+    exit  
+  fi
+  echo "delete from user_messages where mess_id='$2' and uname='$3';"|psql -t x2go_sessions
+  ;;
+
 rmsessionsroot)
   if [ "$UNAME" != "root" ]
   then
@@ -72,7 +146,7 @@ insertsession)
 
 createsession)
   echo "update sessions set status='R',last_time=now(),cookie='$2',agent_pid='$3',\
-   client='$4',gr_port='$5',sound_port='$6' where session_id='$7' and uname='$UNAME';"|psql x2go_sessions
+   client='$4',gr_port='$5',sound_port='$6',fs_port='$7' where session_id='$8' and uname='$UNAME';"|psql x2go_sessions
   ;;
 
 insertport)
diff --git a/x2gopgwrapper_net b/x2gopgwrapper_net
index 10c1b54..a3b9275 100755
--- a/x2gopgwrapper_net
+++ b/x2gopgwrapper_net
@@ -9,91 +9,170 @@ UNAME=$SUDO_USER
 case "$2" in
 
 getdisplays)
-  ssh -i ~postgres/.ssh/id_dsa postgres@$SERVER "echo \"select '|'||display||'|' from sessions  where server = '$3';\"|psql -t x2go_sessions"
+  ssh -i /root/.x2go/ssh/.pg/id_dsa postgres@$SERVER "echo \"select '|'||display||'|' from sessions;\"|psql -t x2go_sessions"
   ;;
 
 getports)
-  ssh -i ~postgres/.ssh/id_dsa postgres@$SERVER "echo \"select '|'||port||'|' from used_ports  where server = '$3';\"|psql -t x2go_sessions"
+  ssh -i /root/.x2go/ssh/.pg/id_dsa postgres@$SERVER "echo \"select '|'||port||'|' from used_ports;\"|psql -t x2go_sessions"
   ;;
 
 getservers)
-  ssh -i ~postgres/.ssh/id_dsa postgres@$SERVER "echo \"select server,count(*) from sessions where status != 'F' group by server;\"|psql -t x2go_sessions"
+  ssh -i /root/.x2go/ssh/.pg/id_dsa postgres@$SERVER "echo \"select server,count(*) from sessions where status != 'F' group by server;\"|psql -t x2go_sessions"
   ;;
 
 listsessions)
-  ssh -i ~postgres/.ssh/id_dsa postgres@$SERVER "echo \"select agent_pid, session_id, display, server, status,\
+  ssh -i /root/.x2go/ssh/.pg/id_dsa postgres@$SERVER "echo \"select agent_pid, session_id, display, server, status,\
    to_char(init_time,'DD.MM.YY*HH24:MI:SS'),cookie,client,gr_port,\
    sound_port,to_char(last_time,'DD.MM.YY*HH24:MI:SS'),uname,\
-   to_char(now()-init_time,'SSSS') from  sessions  \
+   to_char(now()-init_time,'SSSS'),fs_port from  sessions  \
    where status !='F' and server='$3' and uname='$UNAME' order by status desc;\"|psql -t x2go_sessions"
   ;;
 
+listsessions_all)
+  ssh -i /root/.x2go/ssh/.pg/id_dsa postgres@$SERVER "echo \"select agent_pid, session_id, display, server, status,\
+   to_char(init_time,'DD.MM.YY*HH24:MI:SS'),cookie,client,gr_port,\
+   sound_port,to_char(last_time,'DD.MM.YY*HH24:MI:SS'),uname,\
+   to_char(now()-init_time,'SSSS'),fs_port  from  sessions  \
+   where status !='F' and uname='$UNAME' order by status desc;\"|psql -t x2go_sessions"
+  ;;
+
 listsessionsroot)
   if [ "$UNAME" != "root" ]
   then
     echo "$UNAME, You have not permission to do this job!"
     exit  
   fi
-  ssh -i ~postgres/.ssh/id_dsa postgres@$SERVER "echo \"select agent_pid, session_id, display, server, status,\
+  ssh -i /root/.x2go/ssh/.pg/id_dsa postgres@$SERVER "echo \"select agent_pid, session_id, display, server, status,\
    to_char(init_time,'DD.MM.YY*HH24:MI:SS'),cookie,client,gr_port,\
    sound_port,to_char(last_time,'DD.MM.YY*HH24:MI:SS'),uname,\
-   to_char(now()-init_time,'SSSS') from  sessions  \
+   to_char(now()-init_time,'SSSS'),fs_port  from  sessions  \
    where server='$3'  order by status desc;\"|psql -t x2go_sessions"
   ;;
 
+listsessionsroot_all)
+  if [ "$UNAME" != "root" ]
+  then
+    echo "$UNAME, You have not permission to do this job!"
+    exit  
+  fi
+  ssh -i /root/.x2go/ssh/.pg/id_dsa postgres@$SERVER "echo \"select agent_pid, session_id, display, server, status,\
+   to_char(init_time,'DD.MM.YY*HH24:MI:SS'),cookie,client,gr_port,\
+   sound_port,to_char(last_time,'DD.MM.YY*HH24:MI:SS'),uname,\
+   to_char(now()-init_time,'SSSS'),fs_port  from  sessions  \
+   order by status desc;\"|psql -t x2go_sessions"
+  ;;
+
+listsusp)
+  if [ "$UNAME" != "root" ]
+  then
+    echo "$UNAME, You have not permission to do this job!"
+    exit  
+  fi
+  ssh -i /root/.x2go/ssh/.pg/id_dsa postgres@$SERVER "echo \"select session_id, display, uname, server,extract( day from now()-last_time)*24*60+extract(hour from now()-last_time)*60+extract(minute from now()-last_time)\
+  from sessions where server='$3' and status='S';\"|psql -t x2go_sessions"
+  ;;
+
+
+listallrunning)
+  if [ "$UNAME" != "root" ]
+  then
+    echo "$UNAME, You have not permission to do this job!"
+    exit  
+  fi
+  ssh -i /root/.x2go/ssh/.pg/id_dsa postgres@$SERVER "echo \"select agent_pid, session_id, display, server, status,\
+   to_char(init_time,'DD.MM.YY*HH24:MI:SS'),cookie,client,gr_port,\
+   sound_port,to_char(last_time,'DD.MM.YY*HH24:MI:SS'),uname,\
+   to_char(now()-init_time,'SSSS'),fs_port  from  sessions  \
+   where status='R';\"|psql -t x2go_sessions"
+  ;;
+
+listmails)
+  if [ "$UNAME" != "root" ]
+  then
+    echo "$UNAME, You have not permission to do this job!"
+    exit  
+  fi
+  ssh -i /root/.x2go/ssh/.pg/id_dsa postgres@$SERVER "echo \"select user_messages.mess_id,sessions.session_id,\
+      sessions.uname,sessions.display from sessions,user_messages,\
+      messages where sessions.uname=user_messages.uname and sessions.status!='F'\
+      and messages.mess_id=user_messages.mess_id and sessions.server='$3';\"|psql -t x2go_sessions"
+  ;;
+
+getmail)
+  if [ "$UNAME" != "root" ]
+  then
+    echo "$UNAME, You have not permission to do this job!"
+    exit  
+  fi
+  ssh -i /root/.x2go/ssh/.pg/id_dsa postgres@$SERVER "echo \"select message\
+      from messages where mess_id='$3';\"|psql -t x2go_sessions"
+  ;;
+
+
+rmmail)
+  if [ "$UNAME" != "root" ]
+  then
+    echo "$UNAME, You have not permission to do this job!"
+    exit  
+  fi
+  ssh -i /root/.x2go/ssh/.pg/id_dsa postgres@$SERVER "echo \"delete from \
+  user_messages where mess_id='$3' and uname='$4';\"|psql -t x2go_sessions"
+  ;;
+
+
 rmsessionsroot)
   if [ "$UNAME" != "root" ]
   then
     echo "$UNAME, You have not permission to do this job!"
     exit  
   fi
-  ssh -i ~postgres/.ssh/id_dsa postgres@$SERVER "echo \"delete from  sessions  \
+  ssh -i /root/.x2go/ssh/.pg/id_dsa postgres@$SERVER "echo \"delete from  sessions  \
    where session_id='$3' ;\"|psql -t x2go_sessions"
   ;;
 
 
 getagent)
-  ssh -i ~postgres/.ssh/id_dsa postgres@$SERVER "echo \"select agent_pid from sessions  where session_id = '$3';\"|psql -t x2go_sessions"
+  ssh -i /root/.x2go/ssh/.pg/id_dsa postgres@$SERVER "echo \"select agent_pid from sessions  where session_id = '$3';\"|psql -t x2go_sessions"
   ;;
 
 getdisplay)
-  ssh -i ~postgres/.ssh/id_dsa postgres@$SERVER "echo \"select display from sessions  where session_id = '$3';\"|psql -t x2go_sessions"
+  ssh -i /root/.x2go/ssh/.pg/id_dsa postgres@$SERVER "echo \"select display from sessions  where session_id = '$3';\"|psql -t x2go_sessions"
   ;;
 
 changestatus)
-  ssh -i ~postgres/.ssh/id_dsa postgres@$SERVER "echo \"update sessions set last_time=now(),status='$3' where session_id = '$4' and uname='$UNAME';\"|psql -t x2go_sessions"
+  ssh -i /root/.x2go/ssh/.pg/id_dsa postgres@$SERVER "echo \"update sessions set last_time=now(),status='$3' where session_id = '$4' and uname='$UNAME';\"|psql -t x2go_sessions"
   ;;
 
 resume)
-  ssh -i ~postgres/.ssh/id_dsa postgres@$SERVER "echo \"update sessions set last_time=now(),status='R',client='$3' where session_id = '$4' and uname='$UNAME';\"|psql -t x2go_sessions"
+  ssh -i /root/.x2go/ssh/.pg/id_dsa postgres@$SERVER "echo \"update sessions set last_time=now(),status='R',client='$3' where session_id = '$4' and uname='$UNAME';\"|psql -t x2go_sessions"
   ;;
 
 insertsession)
-  ssh -i ~postgres/.ssh/id_dsa postgres@$SERVER "echo \"insert into sessions (display,server,uname,session_id) values \
+  ssh -i /root/.x2go/ssh/.pg/id_dsa postgres@$SERVER "echo \"insert into sessions (display,server,uname,session_id) values \
   ('$3','$4','$UNAME','$5');\"|psql x2go_sessions"
   ;;
 
 createsession)
-  ssh -i ~postgres/.ssh/id_dsa postgres@$SERVER "echo \"update sessions set status='R',last_time=now(),cookie='$3',agent_pid='$4',\
-   client='$5',gr_port='$6',sound_port='$7' where session_id='$8' and uname='$UNAME';\"|psql x2go_sessions"
+  ssh -i /root/.x2go/ssh/.pg/id_dsa postgres@$SERVER "echo \"update sessions set status='R',last_time=now(),cookie='$3',agent_pid='$4',\
+   client='$5',gr_port='$6',sound_port='$7',fs_port='$8' where session_id='$9' and uname='$UNAME';\"|psql x2go_sessions"
   ;;
 
 insertport)
-  ssh -i ~postgres/.ssh/id_dsa postgres@$SERVER "echo \"insert into used_ports (server,session_id,port) values \
+  ssh -i /root/.x2go/ssh/.pg/id_dsa postgres@$SERVER "echo \"insert into used_ports (server,session_id,port) values \
   ('$3','$4','$5');\"|psql x2go_sessions"
   ;;
 
 insertmount)
-  ssh -i ~postgres/.ssh/id_dsa postgres@$SERVER "echo \"insert into mounts (session_id,path,client) values \
+  ssh -i /root/.x2go/ssh/.pg/id_dsa postgres@$SERVER "echo \"insert into mounts (session_id,path,client) values \
   ('$3','$4','$5');\"|psql x2go_sessions"
   ;;
 
 deletemount)
-  ssh -i ~postgres/.ssh/id_dsa postgres@$SERVER "echo \"delete from mounts where session_id='$3' and path='$4';\"|psql x2go_sessions"
+  ssh -i /root/.x2go/ssh/.pg/id_dsa postgres@$SERVER "echo \"delete from mounts where session_id='$3' and path='$4';\"|psql x2go_sessions"
   ;;
 
 getmounts)
-  ssh -i ~postgres/.ssh/id_dsa postgres@$SERVER "echo \"select client,path from mounts where session_id = '$3';\"|psql -t x2go_sessions"
+  ssh -i /root/.x2go/ssh/.pg/id_dsa postgres@$SERVER "echo \"select client,path from mounts where session_id = '$3';\"|psql -t x2go_sessions"
   ;;
 
 *)
diff --git a/x2goresume-session b/x2goresume-session
index 5fb7da0..f55a36d 100755
--- a/x2goresume-session
+++ b/x2goresume-session
@@ -1,4 +1,5 @@
-#!/bin/sh
+#!/bin/bash
+
 SESSION_NAME=$1
 X2GO_GEOMETRY=$2
 X2GO_LINK=$3
diff --git a/x2goruncommand b/x2goruncommand
index b1c3d9c..66071db 100755
--- a/x2goruncommand
+++ b/x2goruncommand
@@ -1,19 +1,106 @@
 #!/bin/bash
+
 DISPLAY=":$1"
 X2GO_AGENT_PID=$2
 X2GO_SESSION=$3
-ARTS_SERVER=localhost:$4
 cmd=$5
+sndsys=$6
+X2GO_SESS_TYPE=$7
 export DISPLAY
 export X2GO_AGENT_PID
 export X2GO_SESSION
-export ARTS_SERVER
-$cmd 
+cmd=`echo $cmd |sed 's/X2GO_SPACE_CHAR/ /g'`
 
-kill -9 $X2GO_AGENT_PID
+X2GO_ROOT=${HOME}/.x2go
+MESSAGE_FILE=$X2GO_ROOT/C-$X2GO_SESSION/cmdoutput
+echo "exec $cmd" >> $MESSAGE_FILE
 
+if [ "$sndsys" == "esd" ]
+then
+  export ESPEAKER=localhost:$4
+elif [ "$sndsys" == "arts" ]
+then 
+  export ARTS_SERVER=localhost:$4
+fi
 
-sudo x2gopgwrapper changestatus 'F' $X2GO_SESSION  > /dev/null
+if [ "$cmd" == "WWWBROWSER" ]
+then
+     if [ -e "/usr/bin/firefox" ]
+     then
+         cmd="/usr/bin/firefox"
+     elif  [ -e "/usr/bin/iceweasel" ]
+     then
+         cmd="/usr/bin/iceweasel"
+     elif  [ -e "/usr/bin/abrowser" ]
+     then
+         cmd="/usr/bin/abrowser"
+     elif  [ -e "/usr/bin/konqueror" ]
+     then
+         cmd="/usr/bin/konqueror"
+     elif  [ -e "/usr/bin/galeon" ]
+     then
+         cmd="/usr/bin/galeon"
+     fi
+fi
+
+if [ "$cmd" == "MAILCLIENT" ]
+then
+     if [ -e "/usr/bin/thunderbird" ]
+     then
+         cmd="/usr/bin/thunderbird"
+     elif  [ -e "/usr/bin/icedove" ]
+     then
+         cmd="/usr/bin/icedove"
+     elif  [ -e "/usr/bin/kmail" ]
+     then
+         cmd="/usr/bin/kmail"
+     elif  [ -e "/usr/bin/evolution" ]
+     then
+         cmd="/usr/bin/evolution"
+     fi
+fi
+
+if [ "$cmd" == "OFFICE" ]
+then
+     if [ -e "/usr/bin/ooffice" ]
+     then
+         cmd="/usr/bin/ooffice"
+     fi
+fi
 
+if [ "$cmd" == "TERMINAL" ]
+then
+     if [ -e "/usr/bin/konsole" ]
+     then
+         cmd="/usr/bin/konsole"
+     elif  [ -e "/usr/bin/gnome-terminal" ]
+     then
+         cmd="/usr/bin/gnome-terminal"
+     elif  [ -e "/usr/bin/rxvt" ]
+     then
+         cmd="/usr/bin/rxvt"
+     elif  [ -e "/usr/bin/xterm" ]
+     then
+         cmd="/usr/bin/xterm"
+     fi
+fi
+
+EXEC=`which $cmd`
+if [ "$EXEC" != "" ] && [ -x `which $cmd` ]
+then
+  $cmd
+  if [  "$X2GO_SESS_TYPE" == "R" ] #### some applications can quit immediately, we waiting until x2goagent exists
+  then
+     while [ -d /proc/$X2GO_AGENT_PID ]
+     do
+         sleep 1
+     done
+  fi
+else
+   echo "X2GORUNCOMMAND ERR NOEXEC:$cmd" > $MESSAGE_FILE
+fi 
+
+kill -TERM  $X2GO_AGENT_PID
+sudo x2gopgwrapper changestatus 'F' $X2GO_SESSION  > /dev/null
 export HOSTNAME
 x2goumount_session $X2GO_SESSION
diff --git a/x2gostartagent b/x2gostartagent
index a734bc8..cf48c4d 100755
--- a/x2gostartagent
+++ b/x2gostartagent
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 X2GO_PORT=49 #First port for X2GO=50
 SSH_PORT=30000 #First ssh port 30001
@@ -13,10 +13,26 @@ X2GO_TYPE=$4
 X2GO_KBD_LAYOUT=$5
 X2GO_KBD_TYPE=$6
 X2GO_SET_KBD=$7
-
+X2GO_STYPE=$8
+X2GO_CMD=$9
 X2GO_RESIZE=0
 X2GO_FULLSCREEN=0
 
+
+export NX_CLIENT=/usr/bin/x2gosuspend-agent
+
+COLORDEPTH=`echo "$X2GO_TYPE"|awk '{split($0,a,"-depth_"); print a[2]}'`
+
+SESSION_TYPE="D"
+
+if [ "$X2GO_STYPE" == "R" ]
+then
+  SESSION_TYPE="R"
+elif  [ "$X2GO_STYPE" == "S" ]
+then
+  SESSION_TYPE="S"
+fi
+
 if [ "$X2GO_CLIENT" == "" ]
 then
    X2GO_CLIENT=$HOSTNAME
@@ -31,16 +47,24 @@ do
  X2GO_PORT=$(($X2GO_PORT + 1))
  X2GO_PORT=`echo "for(\\$i=$X2GO_PORT;\\$br ne \"true\";\\$i++){ if(\"$USED_DISPLAYS\" =~ m/\\|\\$i\\|/){\\$br=\"false\";}else{\\$br=\"true\";print \\$i;}}"|perl`
 
- 
-SESSION_NAME=${USER}-${X2GO_PORT}-`date +"%s"`
-OUTPUT=`sudo x2gopgwrapper insertsession $X2GO_PORT $HOSTNAME $SESSION_NAME`
+ if  [ -e "/tmp/.X${X2GO_PORT}-lock" ] || [ -e "/tmp/.X11-unix/X${X2GO_PORT}" ] 
+ then
+    OUTPUT="XXX"
+ else
+   SESSION_NAME=${USER}-${X2GO_PORT}-`date +"%s"`
+   if [ "$COLORDEPTH" != "" ]
+   then
+       SESSION_NAME="$SESSION_NAME"_st${SESSION_TYPE}${X2GO_CMD}_dp${COLORDEPTH}
+   fi
+   OUTPUT=`sudo x2gopgwrapper insertsession $X2GO_PORT $HOSTNAME $SESSION_NAME`
+ fi 
 done
 
 
 USED_PORTS=`sudo x2gopgwrapper getports $HOSTNAME`
 
 
-while [ "$GR_PORT" == "" ] || [ "$SOUND_PORT" == "" ]
+while [ "$GR_PORT" == "" ] || [ "$SOUND_PORT" == "" ] || [ "$FS_PORT" == "" ]
 do
   OUTPUT=""
   while [ "`echo \"$OUTPUT\" | awk '{print $1,$3}'`" != "INSERT 1" ]
@@ -65,8 +89,11 @@ do
   if [ "$GR_PORT" == "" ]
   then
      GR_PORT=$SSH_PORT
-  else
+  elif [ "$SOUND_PORT" == "" ]
+  then
      SOUND_PORT=$SSH_PORT
+  else
+     FS_PORT=$SSH_PORT
   fi
 done
 
@@ -131,15 +158,13 @@ SAVED_DISPLAY=$DISPLAY
 DISPLAY=nx/nx,options=${SESSION_DIR}/options:${X2GO_PORT} 
 export DISPLAY
 
-DEFAULT_FONT_PATH=$(echo $(grep -v '^ *#' /etc/X11/xorg.conf | grep FontPath  | awk '{print $2}' | sed -r "s/^[\"']|[\"']$//g") | sed 's/ /,/g')
-
 
-LD_LIBRARY_PATH=$X2GO_LIB x2goagent  -geometry ${X2GO_GEOMETRY} -name "X2GO-${SESSION_NAME}" -fp $DEFAULT_FONT_PATH  ${NX_AGENT} 2>${SESSION_DIR}/session.log &
+LD_LIBRARY_PATH=$X2GO_LIB x2goagent  -$SESSION_TYPE -geometry ${X2GO_GEOMETRY} -name "X2GO-${SESSION_NAME}"  ${NX_AGENT} 2>${SESSION_DIR}/session.log &
 
 X2GO_AGENT_PID=$!
 
 X2GO_SND_PORT=1024
-sudo x2gopgwrapper createsession $X2GO_COOKIE $X2GO_AGENT_PID $X2GO_CLIENT $GR_PORT $SOUND_PORT $SESSION_NAME > /dev/null
+sudo x2gopgwrapper createsession $X2GO_COOKIE $X2GO_AGENT_PID $X2GO_CLIENT $GR_PORT $SOUND_PORT $FS_PORT $SESSION_NAME > /dev/null
 
 echo $X2GO_PORT
 echo $X2GO_COOKIE
@@ -147,3 +172,4 @@ echo $X2GO_AGENT_PID
 echo $SESSION_NAME
 echo $GR_PORT
 echo $SOUND_PORT
+echo $FS_PORT
\ No newline at end of file
diff --git a/x2gosuspend-agent b/x2gosuspend-agent
new file mode 100755
index 0000000..95219b7
--- /dev/null
+++ b/x2gosuspend-agent
@@ -0,0 +1,10 @@
+#!/usr/bin/perl
+
+shift;
+shift;
+shift;
+
+my $capt=shift;
+my @words=split(" ",$capt);
+
+system("/usr/bin/x2gosuspend-session @words[2] > /dev/null");
\ No newline at end of file
diff --git a/x2gosuspend-session b/x2gosuspend-session
index 6fdd9f1..db819f3 100755
--- a/x2gosuspend-session
+++ b/x2gosuspend-session
@@ -1,4 +1,5 @@
-#!/bin/sh
+#!/bin/bash
+
 SESSION_NAME=$1
 
 
diff --git a/x2goterminate-session b/x2goterminate-session
index 2e9b7ca..59560d4 100755
--- a/x2goterminate-session
+++ b/x2goterminate-session
@@ -1,10 +1,11 @@
-#!/bin/sh
+#!/bin/bash
+
 SESSION_NAME=$1
 X2GO_AGENT_PID=`sudo x2gopgwrapper getagent $SESSION_NAME` 
 X2GO_AGENT_PID=`echo "$X2GO_AGENT_PID"| awk {'print $1'}`
 
 sudo x2gopgwrapper changestatus 'F' $SESSION_NAME  > /dev/null
 
-kill $X2GO_AGENT_PID
+kill -TERM $X2GO_AGENT_PID
 export HOSTNAME
 x2goumount_session $SESSION_NAME
diff --git a/x2goumount b/x2goumount
index 1d0f6da..928c3c1 100755
--- a/x2goumount
+++ b/x2goumount
@@ -7,9 +7,18 @@ my $dir=<F>;
 my $session=<F>;
 close(F);
 
+$session=~s/\n//;
+
 chomp($dir);
 my $uname=$ENV{'USER'};
 
+my $use_zenity=0;
+
+if($ENV{'GNOME_DESKTOP_SESSION_ID'} ne "")
+{
+     $use_zenity=1;
+}
+
 if(system( "fusermount -u $dir" ) == 0)
 {
      unlink($fname);
@@ -18,5 +27,12 @@ if(system( "fusermount -u $dir" ) == 0)
 }
 else
 {
-    system("x2gomessage --type error --code 0 --text $dir&");
+    if($use_zenity == 0)
+    {
+         system("kdialog --error \"Can't umount:\n $dir\"&");
+    }
+    else
+    {
+         system("zenity --error --text \"Can't umount:\n $dir\"&");
+    }
 }
diff --git a/x2goumount_session b/x2goumount_session
index 2f1af56..64b212f 100755
--- a/x2goumount_session
+++ b/x2goumount_session
@@ -32,6 +32,13 @@ open (F,"</etc/mtab") or die "Can't open /etc/mtab for reading";
 my @mounts=<F>;
 close(F);
 
+my $use_zenity=0;
+
+if($ENV{'GNOME_DESKTOP_SESSION_ID'} ne "")
+{
+     $use_zenity=1;
+}
+
 
 for($i=0;$i<@outp;$i++)
 {
@@ -70,12 +77,19 @@ break:
        else
        {
                  $ENV{'DISPLAY'}=":$display";
-                 system("x2gomessage --type error --code 0 --text @line[1]&");
+                 if($use_zenity == 0)
+		 {
+        	    system("kdialog --error \"@line[1]\"&");
+		 }
+		 else
+		 {
+                    system("zenity --error --text \"@line[1]\"&");
+		 }
        }
     }
     if(! $found)
     {
-	$remote=~s/\//%2f/g;
+	$remote=~s/\//_/g;
 	$remote=(split(":","$remote"))[1];
 	$remote="$ENV{'HOME'}/Desktop/$remote";
 	if( -e "$remote(sshfs-disk)")
@@ -88,7 +102,11 @@ break:
 	{
 	   unlink("$remote(sshfs-removable)");
 	}
-        print "$session \"@line[1]\"\n"; 
+	if( -e "$remote(sshfs-cdrom)")
+	{
+	   unlink("$remote(sshfs-cdrom)");
+	}
+        #print "$session \"@line[1]\"\n"; 
 	system("sudo x2gopgwrapper deletemount $session \"@line[1]\"> /dev/null");
         rmdir (@line[1]);
     }


hooks/post-receive
-- 
x2goserver.git (X2Go Server)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "x2goserver.git" (X2Go Server).




More information about the x2go-commits mailing list