[X2Go-Commits] x2gothinclient.git - build-main (branch) updated: 1.0.1.8-70-gbe15f7f

X2Go dev team git-admin at x2go.org
Fri Jul 19 23:38:12 CEST 2013


The branch, build-main has been updated
       via  be15f7fafb8204df30ef4afc81e6556d094410ba (commit)
      from  940adc9b5c6c51b920070bc007166789453da752 (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:
 debian/changelog                |    3 ++
 debian/x2gothinclient.config    |   50 ++++++++++++++++++++++++
 debian/x2gothinclient.init      |   55 +++++++++++++-------------
 debian/x2gothinclient.postinst  |   30 +++++++++++++++
 debian/x2gothinclient.prerm     |   81 +++++++++++++++++++++++++++++++++++++++
 debian/x2gothinclient.templates |   20 ++++++++++
 6 files changed, 210 insertions(+), 29 deletions(-)
 create mode 100644 debian/x2gothinclient.config
 create mode 100755 debian/x2gothinclient.prerm
 create mode 100644 debian/x2gothinclient.templates

The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index 8f0c2c6..f5bb270 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -71,6 +71,9 @@ x2gothinclient (1.0.99.1-0~x2go1) UNRELEASED; urgency=low
       installed into package.
   * /debian/x2gothinclient.init:
     + Update pointer to X2Go TCE documentation on http://wiki.x2go.org.
+  * Launch X2Go TCE via /etc/X11/default-display-manager. Add debconf template
+    to handle default display manager selection. Inspired by Debian's gdm
+    package.
 
   [ Oleksandr Shneyder ]
   * New upstream version (1.0.99.1):
diff --git a/debian/x2gothinclient.config b/debian/x2gothinclient.config
new file mode 100644
index 0000000..ac2bcc9
--- /dev/null
+++ b/debian/x2gothinclient.config
@@ -0,0 +1,50 @@
+#!/bin/sh
+# x2gothinclient package configuration script
+
+set -e
+
+# source debconf library
+. /usr/share/debconf/confmodule
+
+DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager
+
+OLD_DEFAULT=
+db_metaget shared/default-x-display-manager owners
+OWNERS="$RET"
+db_metaget shared/default-x-display-manager choices
+CHOICES="$RET"
+
+if [ "$OWNERS" != "$CHOICES" ]; then
+  db_subst shared/default-x-display-manager choices $OWNERS
+  db_fset shared/default-x-display-manager seen false
+fi
+
+if [ -e "$DEFAULT_DISPLAY_MANAGER_FILE" ]; then
+  OLD_DAEMON="$(grep -v '^[[:space:]]*#' \
+                            "$DEFAULT_DISPLAY_MANAGER_FILE" |
+                            head -n 1)"
+  OLD_DEFAULT="$(basename $OLD_DAEMON 2>/dev/null || true)"
+  if [ -n "$OLD_DEFAULT" ]; then
+    db_set shared/default-x-display-manager "$OLD_DEFAULT"
+  fi
+else
+  if db_get shared/default-x-display-manager; then
+    OLD_DEFAULT="$RET"
+  fi
+fi
+
+db_input high shared/default-x-display-manager || true
+db_go
+
+# using this display manager?
+db_get shared/default-x-display-manager
+CURRENT_DEFAULT="$RET"
+
+# remove the default display manager file if we're going to change it
+if [ -e "$DEFAULT_DISPLAY_MANAGER_FILE" ]; then
+  if [ "$OLD_DEFAULT" != "$CURRENT_DEFAULT" ]; then
+    mv $DEFAULT_DISPLAY_MANAGER_FILE $DEFAULT_DISPLAY_MANAGER_FILE.dpkg-tmp
+  fi
+fi
+
+exit 0
diff --git a/debian/x2gothinclient.init b/debian/x2gothinclient.init
index d08d131..56b817b 100644
--- a/debian/x2gothinclient.init
+++ b/debian/x2gothinclient.init
@@ -29,12 +29,16 @@
 # Short-Description: Start and stop the x2go thinclient daemon
 ### END INIT INFO
 
+set -e
+
 # use system's locale settings for the X2Go Client in TCE mode
 if [ -r /etc/default/locale ]; then
 	. /etc/default/locale
 	export LANG LANGUAGE
 fi
 
+. /lib/lsb/init-functions
+
 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
 export HOSTNAME
 DAEMON=/usr/sbin/x2gothinclientd
@@ -51,42 +55,36 @@ fi
 # pre-init X2Go Thin Client through init script...
 test -x /etc/x2go/x2gothinclient_init && . /etc/x2go/x2gothinclient_init
 
-set -e
+# To start x2gothinclient even if it is not the default display manager, change
+# HEED_DEFAULT_DISPLAY_MANAGER to "false."
+HEED_DEFAULT_DISPLAY_MANAGER=${HEED_DEFAULT_DISPLAY_MANAGER:-true}
+DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager
 
 case "$1" in
   start)
-	echo -n "Starting $DESC: "
-	start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
-		--exec $DAEMON -- $DAEMON_OPTS
-	echo "$NAME."
+	CONFIGURED_DAEMON="$(basename \"$(cat $DEFAULT_DISPLAY_MANAGER_FILE 2> /dev/null)\")"
+	if grep -wqs text /proc/cmdline; then
+		log_warning_msg "Not starting GNOME Display Manager (gdm); found 'text' in kernel commandline."
+	elif [ -e "$DEFAULT_DISPLAY_MANAGER_FILE" ] && \
+	    [ "$HEED_DEFAULT_DISPLAY_MANAGER" = "true" ] && \
+	    [ "$CONFIGURED_DAEMON" != x2gothinclientd ] ; then
+		log_action_msg "Not starting X2Go Client in TCE mode; it is not configured as default display manager"
+	else
+		log_daemon_msg "Starting $DESC" "x2gothinclientd"
+		start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
+		log_end_msg $?
+	fi
 	;;
   stop)
-	echo -n "Stopping $DESC: "
-	start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid && echo "$NAME." || echo "not running"
+	if [ -e /var/run/$NAME.pid ]; then
+		log_daemon_msg "Stopping $DESC" "x2gothinclientd"
+		start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid && echo "$NAME." || echo "not running"
+		log_end_msg $?
+	fi
 	;;
-  #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
+	start-stop-daemon --stop --test --quiet --pidfile /var/run/$NAME.pid && $0 restart || exit 0
 	;;
   restart)
 	$0 stop
@@ -95,7 +93,6 @@ case "$1" in
 	;;
   *)
 	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
 	;;
diff --git a/debian/x2gothinclient.postinst b/debian/x2gothinclient.postinst
index bc7f005..be096ce 100755
--- a/debian/x2gothinclient.postinst
+++ b/debian/x2gothinclient.postinst
@@ -5,6 +5,9 @@
 
 set -e
 
+# source debconf's configuration module
+. /usr/share/debconf/confmodule
+
 # summary of how this script can be called:
 #        * <postinst> `configure' <most-recently-configured-version>
 #        * <old-postinst> `abort-upgrade' <new version>
@@ -17,6 +20,33 @@ set -e
 # for details, see http://www.debian.org/doc/debian-policy/ or
 # the debian-policy package
 
+THIS_PACKAGE=x2gothinclient
+DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager
+
+# debconf is not a registry, so we only fiddle with the default file if it
+# does not exist
+if [ ! -e $DEFAULT_DISPLAY_MANAGER_FILE ]; then
+	if db_get shared/default-x-display-manager; then
+		# workaround debconf passthru bug (#379198)
+		if [ -z "$RET" ]; then
+			$RET="$THIS_PACKAGE"
+		fi
+		if [ "$THIS_PACKAGE" != "$RET" ]; then
+			echo "Please be sure to run \"dpkg --configure $RET\"."
+		fi
+		echo "/usr/sbin/x2gothinclientd" > $DEFAULT_DISPLAY_MANAGER_FILE
+	fi
+fi
+
+# remove the displaced old default display manager file if it exists
+if [ -e "$DEFAULT_DISPLAY_MANAGER_FILE.dpkg-tmp" ]; then
+	rm "$DEFAULT_DISPLAY_MANAGER_FILE.dpkg-tmp"
+fi
+
+# debconf hangs if gdm gets started below without this
+db_stop || true
+
+
 case "$1" in
 	configure)
 
diff --git a/debian/x2gothinclient.prerm b/debian/x2gothinclient.prerm
new file mode 100755
index 0000000..92edd7a
--- /dev/null
+++ b/debian/x2gothinclient.prerm
@@ -0,0 +1,81 @@
+#! /bin/sh
+
+# prerm script for x2gothinclient
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# source debconf's configuration module
+. /usr/share/debconf/confmodule
+
+# 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
+
+THIS_PACKAGE=x2gothinclient
+DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager
+
+if [ "$1" = "remove" -o "$1" = "deconfigure" ]; then
+
+	# disown this question
+	db_unregister shared/default-x-display-manager || true
+
+	# does the question still exist?
+	if db_get shared/default-x-display-manager; then
+		db_metaget shared/default-x-display-manager owners
+		db_subst shared/default-x-display-manager choices "$RET"
+		db_get shared/default-x-display-manager
+		# are we removing the currently selected display manager?
+		if [ "$THIS_PACKAGE" = "$RET" ]; then
+			if [ -e "$DEFAULT_DISPLAY_MANAGER_FILE" ]; then
+				if [ "$(cat $DEFAULT_DISPLAY_MANAGER_FILE)" = "/usr/sbin/x2gothinclientd" ]; then
+					rm "$DEFAULT_DISPLAY_MANAGER_FILE"
+				fi
+			fi
+
+			# ask the user to choose a new default
+			db_fset shared/default-x-display-manager seen false
+			db_input critical shared/default-x-display-manager || true
+			db_go
+
+			# if the display manager file doesn't exist, write it with the path
+			# to the new default display manager
+			if [ ! -e $DEFAULT_DISPLAY_MANAGER_FILE ]; then
+				db_get shared/default-x-display-manager
+				echo "Please be sure to run \"dpkg-reconfigure $RET\"."
+				db_get "$RET"/daemon_name
+				echo "$RET" > "$DEFAULT_DISPLAY_MANAGER_FILE"
+			fi
+		fi
+	fi
+fi
+
+
+case "$1" in
+	remove)
+		if [ -x /etc/init.d/x2gothinclient ]; then
+			invoke-rc.d x2gothinclient stop
+		fi
+		;;
+	deconfigure|upgrade|failed-upgrade)
+		:
+		;;
+	*) echo "$0: didn't understand being called with \`$1'" 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/x2gothinclient.templates b/debian/x2gothinclient.templates
new file mode 100644
index 0000000..7a99ad9
--- /dev/null
+++ b/debian/x2gothinclient.templates
@@ -0,0 +1,20 @@
+Template: shared/default-x-display-manager
+Type: select
+Choices: ${choices}
+Description: Default display manager:
+ On X2Go thin clients X2Go Client is sort of used as a display manager. For
+ this, X2Go Client gets started in TCE mode. The TCE acronym stands for thin
+ client environment. In TCE mode, X2Go Client manages the default display of the
+ X Window System.
+ .
+ Generally, a display manager is a program that provides graphical login
+ capabilities for the X Window System. Other display managers for example
+ are GDM, KDM, etc. Login is--in most cases--granted to the local system.
+ .
+ However, X2Go Client in TCE mode does appear like a display manager,
+ but it will log you onto pre-defined X2Go sessions on remote servers.
+ .
+ As you are about to install X2Go Client in TCE mode on this machine
+ and as you already have other display managers installed on this machine,
+ please explicitly select which display manager is supposed to be the default
+ for your system.


hooks/post-receive
-- 
x2gothinclient.git (X2Go Thin Client Environment)

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 "x2gothinclient.git" (X2Go Thin Client Environment).




More information about the x2go-commits mailing list