[X2go-Commits] x2goserver.git - master (branch) updated: 3.1.1.0-20-gb022803

X2Go dev team git-admin at x2go.org
Sun May 27 15:42:10 CEST 2012


The branch, master has been updated
       via  b022803cb5b4dc10c740c52bd5845f9a52b7d9b9 (commit)
      from  ccdd4364d44b187c1f5cd24b4f1c2aa487110cac (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 -----------------------------------------------------------------
commit b022803cb5b4dc10c740c52bd5845f9a52b7d9b9
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Sun May 27 15:41:59 2012 +0200

    Make x2gosetkeyboard set the client-side keyboard on sessino start and resume.

-----------------------------------------------------------------------

Summary of changes:
 debian/changelog                  |    2 ++
 x2goserver/bin/x2goresume-session |   15 +++++++++------
 x2goserver/bin/x2goruncommand     |    2 ++
 x2goserver/bin/x2gosetkeyboard    |   28 ++++++++++++++++++++++++----
 x2goserver/bin/x2gostartagent     |   10 +++++-----
 5 files changed, 42 insertions(+), 15 deletions(-)

The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index 107a2a2..9522e79 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -20,6 +20,8 @@ x2goserver (3.1.1.1-0~x2go1) UNRELEASED; urgency=low
       in X2Go session cache directory.
     - Add support for client-side keyboard detection. Moved script
       x2gosetkeyboard from x2goserver-pyhoca into x2goserver package.
+    - Make x2gosetkeyboard set the client-side keyboard on sessino start and
+      resume.
 
  -- Mike Gabriel <mike.gabriel at das-netzwerkteam.de>  Wed, 04 Apr 2012 11:44:14 +0200
 
diff --git a/x2goserver/bin/x2goresume-session b/x2goserver/bin/x2goresume-session
index a0b299a..cdb5af2 100755
--- a/x2goserver/bin/x2goresume-session
+++ b/x2goserver/bin/x2goresume-session
@@ -152,6 +152,9 @@ echo "$NEWOPTIONS" >"${SESSION_DIR}/options"
 # run x2goserver-extensions for pre-resume
 x2gofeature X2GO_RUN_EXTENSIONS &>/dev/null && x2goserver-run-extensions "$SESSION_NAME" pre-resume || true
 
+# clear old keyboard file
+rm -Rf $SESSION_DIR/keyboard
+
 kill -HUP $X2GO_AGENT_PID &>/dev/null && {
 	$X2GO_LIB_PATH/x2gosyslog "$0" "notice" "client $X2GO_CLIENT has successfully resumed session with ID $SESSION_NAME"
 
@@ -171,12 +174,6 @@ kill -HUP $X2GO_AGENT_PID &>/dev/null && {
 	#done
 	(sleep 1; $X2GO_LIB_PATH/x2goresume  "$X2GO_CLIENT" "$SESSION_NAME"  "$GR_PORT" "$SOUND_PORT" "$FS_PORT" > /dev/null;)
 
-	# set client-side keyboard model, type, variant, etc.
-	if [ "$X2GO_SET_KBD" != "0" ]; then
-		X2GO_DISPLAY=$(echo $X2GO_SESSION | cut -d"-" -f2)
-		(sleep 1; DISPLAY=:$X2GO_DISPLAY.0 x2gosetkeyboard;)
-	fi
-
 	# resume x2godesktopsharing, if it has been in use before the session got suspended
 	x2gofeature X2GO_DESKTOPSHARING &>/dev/null && x2goresume-desktopsharing "$SESSION_NAME" || true
 
@@ -201,3 +198,9 @@ echo "gr_port=$GR_PORT"
 echo "sound_port=$SOUND_PORT"
 echo "fs_port=$FS_PORT"
 
+# set client-side keyboard model, type, variant, etc.
+if [ "$X2GO_SET_KBD" == "0" ]; then
+	X2GO_DISPLAY=$(echo $SESSION_NAME | cut -d"-" -f2)
+	export DISPLAY=:$X2GO_DISPLAY.0
+	x2gosetkeyboard "$SESSION_NAME" >/dev/null 2>/dev/null &
+fi
diff --git a/x2goserver/bin/x2goruncommand b/x2goserver/bin/x2goruncommand
index 541326d..012f713 100755
--- a/x2goserver/bin/x2goruncommand
+++ b/x2goserver/bin/x2goruncommand
@@ -200,6 +200,8 @@ sucessful_run=false
 if [ "$EXEC" != "" ] && [ -x $EXEC ]; then
 	$X2GO_LIB_PATH/x2gosyslog "$0" "debug" "running command $EXEC"
 
+	x2gosetkeyboard >/dev/null 2>/dev/null &
+
 	x2gofeature X2GO_XSESSION &>/dev/null && [ "x$X2GO_SESS_TYPE" = "xD" ] && {
 		STARTUP="$cmd$args"
 		$X2GO_LIB_PATH/x2gosyslog "$0" "notice" "launching session with Xsession-x2go mechanism, using STARTUP=\"$STARTUP\""
diff --git a/x2goserver/bin/x2gosetkeyboard b/x2goserver/bin/x2gosetkeyboard
index 6ca357e..710daa9 100755
--- a/x2goserver/bin/x2gosetkeyboard
+++ b/x2goserver/bin/x2gosetkeyboard
@@ -17,23 +17,41 @@
 # Free Software Foundation, Inc.,
 # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 #
+# Copyright (C) 2011-2012  Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
 # Copyright (C) 2011-2012  Oleksandr Shneyder <oleksandr.shneyder at obviously-nice.de>
 # Copyright (C) 2011-2012  Heinz-Markus Graesing <heinz-m.graesing at obviously-nice.de>
 
-set -e
-
 X2GO_LIB_PATH=`echo -n \$(x2gobasepath)/lib/x2go`
 
 $X2GO_LIB_PATH/x2gosyslog "$0" "info" "$(basename $0) called with options: $@"
 
+SESSION_NAME=${1:-$X2GO_SESSION}
+
 # set up paths
 X2GO_SESSION_ROOT=${HOME}/.x2go
-X2GO_SESSION_DIR=${X2GO_SESSION_ROOT}/C-${X2GO_SESSION}
+X2GO_SESSION_DIR=${X2GO_SESSION_ROOT}/C-${SESSION_NAME}
 
 # client keyboard configuration
 X2GO_CLIENT_KBD_FILE=${X2GO_SESSION_DIR}/keyboard
 
-test -f ${X2GO_CLIENT_KBD_FILE} || exit 0
+# if there is a directory at the location of the keyboard file, we consider this as blocking this script
+if [ -d ${X2GO_CLIENT_KBD_FILE} ]; then
+	$X2GO_LIB_PATH/x2gosyslog "$0" "info" "${X2GO_CLIENT_KBD_FILE} is blocked, not setting keyboard parameters from client-side settings"
+	rm -Rf ${X2GO_CLIENT_KBD_FILE}
+	exit 0
+fi
+
+# wait for the keyboard file to appear
+i=0
+while ! [ -f ${X2GO_CLIENT_KBD_FILE} ] && [ $i -lt 30 ]; do
+	$X2GO_LIB_PATH/x2gosyslog "$0" "info" "Waiting for ${X2GO_CLIENT_KBD_FILE} to appear"
+	sleep 1
+	i=$((i+1))
+done
+if  ! [ -f ${X2GO_CLIENT_KBD_FILE} ]; then
+	$X2GO_LIB_PATH/x2gosyslog "$0" "warning" "${X2GO_CLIENT_KBD_FILE} did not appear within 30s after agent startup"
+	exit 0
+fi
 
 read_keyboard_file() {
 
@@ -63,5 +81,7 @@ update_keymap() {
 }
 
 ### main ###
+$X2GO_LIB_PATH/x2gosyslog "$0" "notice" "Setting X keyboard according to ${X2GO_CLIENT_KBD_FILE}"
 read_keyboard_file
 update_keymap
+
diff --git a/x2goserver/bin/x2gostartagent b/x2goserver/bin/x2gostartagent
index dfbf017..90b82b1 100755
--- a/x2goserver/bin/x2gostartagent
+++ b/x2goserver/bin/x2gostartagent
@@ -251,11 +251,6 @@ if  [ "$X2GO_STYPE" == "S" ]; then
 	x2goagent -nolisten tcp $X2GODPIOPTION_ -$SESSION_TYPE -auth "$XAUTHORITY" -shadow $SHADOW_DESKTOP -shadowmode $SHADOW_MODE -geometry ${X2GO_GEOMETRY} -name "${SESSION_WINDOW_TITLE}"  "${NX_AGENT}" 2>"${SESSION_DIR}/session.log" &
 else
 	x2goagent -nolisten tcp $X2GODPIOPTION_ $XDMCPOPT -$SESSION_TYPE $NOEXITPARAM -auth "$XAUTHORITY" -geometry ${X2GO_GEOMETRY} -name "${SESSION_WINDOW_TITLE}"  "${NX_AGENT}" 2>"${SESSION_DIR}/session.log" &
-
-	# if we do not enforce a special keybaord type/layout/variant, use the one detected on the client-side
-	if [ "$X2GO_SET_KBD" != "0" ]; then
-		(sleep 1; x2gosetkeyboard;)
-	fi
 fi
 
 X2GO_AGENT_PID=$!
@@ -278,6 +273,11 @@ X2GO_SND_PORT=1024
 
 $X2GO_LIB_PATH/x2gocreatesession "$X2GO_COOKIE" "$X2GO_AGENT_PID" "$X2GO_CLIENT" "$GR_PORT" "$SOUND_PORT" "$FS_PORT" "$SESSION_NAME" > /dev/null
 
+if [ "$X2GO_SET_KBD" != "0" ]; then
+	$X2GO_LIB_PATH/x2gosyslog "$0" "info" "blocking creation of agent's keyboard file ${SESSION_DIR}/keyboard as requested by session startup command"
+	mkdir -p ${SESSION_DIR}/keyboard
+fi
+
 echo $X2GO_PORT
 echo $X2GO_COOKIE
 echo $X2GO_AGENT_PID


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