[X2Go-Commits] [live-build-x2go] 04/35: fixed whitespace detection around cmdline parameters

git-admin at x2go.org git-admin at x2go.org
Fri Apr 28 11:34:20 CEST 2017


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch feature/fvwm
in repository live-build-x2go.

commit 21a918fe4a59212e6dcc7c7b7e191a19911883ed
Author: Stefan Baur (BAUR-ITCS) <kontakt at baur-itcs.de>
Date:   Sat Dec 31 20:21:23 2016 +0100

    fixed whitespace detection around cmdline parameters
---
 .../includes.chroot/lib/live/config/2100-lockuser  |   2 +-
 .../lib/live/config/2800-x2go-thinclientconfig     | 136 +++++++++++++++++++++
 2 files changed, 137 insertions(+), 1 deletion(-)

diff --git a/config/includes.chroot/lib/live/config/2100-lockuser b/config/includes.chroot/lib/live/config/2100-lockuser
index 7f89531..1cbcc15 100755
--- a/config/includes.chroot/lib/live/config/2100-lockuser
+++ b/config/includes.chroot/lib/live/config/2100-lockuser
@@ -10,7 +10,7 @@ echo -n " lockuser"
 
 # Set password
 #
-if grep -q " *nouser *" /proc/cmdline ; then
+if grep -q "\W*nouser\W*" /proc/cmdline ; then
 	passwd -l user >/dev/null
 fi
 
diff --git a/config/includes.chroot/lib/live/config/2800-x2go-thinclientconfig b/config/includes.chroot/lib/live/config/2800-x2go-thinclientconfig
new file mode 100755
index 0000000..76e254f
--- /dev/null
+++ b/config/includes.chroot/lib/live/config/2800-x2go-thinclientconfig
@@ -0,0 +1,136 @@
+#!/bin/bash
+
+X2GoThinClientConfig ()
+{
+
+# Output startup message
+#
+echo -n " x2go-thinclientconfig"
+
+# using xmlstarlet would mean wasting yet another Megabyte of space ...
+# disable virtual desktops
+sed -i -e 's#<number>4</number>#<number>1</number>#' /etc/xdg/openbox/rc.xml
+# disable OpenBox context menu (would be accessible in xinerama)
+sed -i -e '\#<action name="ShowMenu"><menu>[a-z-]*-menu</menu></action>#d' /etc/xdg/openbox/rc.xml
+# make sure OpenBox maximizes X2GoClient on launch and hides window decorations
+sed -i -e '\#<applications>#a<application title="X2Go Client" type="normal">' -e '\#<applications>#a<decor>no</decor>' -e '\#<applications>#a</application>' /etc/xdg/openbox/rc.xml
+
+cat >/home/user/.xsession <<XSESSION
+# inspired by 
+# http://code.x2go.org/gitweb?p=x2gothinclient.git;a=blob_plain;f=displaymanager/sbin/x2gothinclientd;h=6897d42d17bd6778e7de5e62ec3f51727d4e8800;hb=HEAD
+# check the above file for ideas before reinventing the wheel
+
+# Spawn PulseAudio
+pulseaudio -D -n -L 'module-native-protocol-tcp port=4713' -L 'module-udev-detect' --exit-idle-time=65535 &
+
+# additional variable instead of "case \$(...) in", as we need the value again later on
+XRANDRCMDTAINTED=\$(cat /proc/cmdline | tr ' ' '\n' | awk -F '=' '\$1 == "xinerama" { print \$2 }')
+
+# sanitize input
+case \$XRANDRCMDTAINTED in
+"above")
+	XRANDRCMD="above"
+	;;
+"below")
+	XRANDRCMD="below"
+	;;
+"same-as")
+	XRANDRCMD="same-as"
+	;;
+"right-of")
+	XRANDRCMD="right-of"
+	;;
+*)
+	XRANDRCMD="left-of" # default
+	;;
+esac
+
+# find out how many touch devices we have
+TOUCHDEVICESCOUNT=\$(LANG=C xsetwacom --list devices | wc -l)
+
+# find out how many mouse devices we have
+MICECOUNT=\$(find /dev/input -maxdepth 1 -name "mouse*" | wc -l)
+
+# loop through the following code block for all connected display devices
+for NEXT_DISPLAY in \$(LANG=C xrandr 2>/dev/null | grep ' connected ' | cut -d ' ' -f1); do
+
+	#remove trailing newline from NEXT_DISPLAY
+	NEXT_DISPLAY=\${NEXT_DISPLAY%\$'\n'}
+
+	# THIS_DISPLAY won't be defined until the second time the loop is executed, which is a
+	# neat way of running xrandr only if there are at least two connected display devices
+	if [ -n \${THIS_DISPLAY+x} ] ; then
+
+		if [ \$TOUCHDEVICESCOUNT -gt 0 ] &&  [ \$MICECOUNT -lt 1 ] && [ -z \$XRANDRCMDTAINTED ]; then
+			# we have a touch device and no mice, and no xinerama parameter was set,
+			# so switch to clone view to make the touch device usable
+			/usr/bin/xrandr --output \$NEXT_DISPLAY --same-as \$THIS_DISPLAY
+
+		else
+			# else use whatever is in XRANDRCMD (which is either our default of "left-of",
+			# or a valid xinerama kernel parameter value)
+			/usr/bin/xrandr --output \$NEXT_DISPLAY --\$XRANDRCMD \$THIS_DISPLAY
+		fi
+
+		# now set THIS_DISPLAY -> every subsequent iteration of the loop will now enter the code block
+		# above where [ -n \${THIS_DISPLAY+x} ] is the conditional
+		THIS_DISPLAY=\$NEXT_DISPLAY
+	fi
+done
+
+# Spawn openbox
+openbox &
+
+# set screen background to X2Go default blue on all detected screens
+xsetroot -solid "#246ed8"
+
+# Get X2GoConfig
+BROKERURL=\$(cat /proc/cmdline | \
+	    tr ' ' '\n' | \
+	    awk -F'=' ' /^broker-url=/ { print \$2 }')
+LDAP=\$(cat /proc/cmdline | \
+	    tr ' ' '\n' | \
+	    sed 's/^ldap=/ldap#/' | \
+	    awk -F'#' ' /^ldap#/ { print \$2 }')
+LDAP1=\$(cat /proc/cmdline | \
+	    tr ' ' '\n' | \
+	    sed 's/^ldap1=/ldap1#/' | \
+	    awk -F'#' ' /^ldap1#/ { print \$2 }')
+LDAP2=\$(cat /proc/cmdline | \
+	    tr ' ' '\n' | \
+	    sed 's/^ldap2=/ldap2#/' | \
+	    awk -F'#' ' /^ldap2#/ { print \$2 }')
+
+# Spawn X2GoClient
+if [ -n "\$BROKERURL" ]; then
+	SESSIONFROM="--broker-url=\$BROKERURL"
+else 
+	SESSIONFROM="--session-conf=/etc/x2go/x2gothinclient_sessions"
+fi
+if [ -n "\$LDAP" ] ; then
+	if [ -n "\$LDAP1" ] ; then
+		BACKUPLDAP="--ldap1=\$LDAP1"
+		if [ -n "\$LDAP2" ] ; then
+			BACKUPLDAP="\$BACKUPLDAP --ldap2=\$LDAP2"
+		fi
+	fi
+	LDAPPARAMS="--ldap=\$LDAP \$BACKUPLDAP"
+else
+	LDAPPARAMS=""
+fi
+
+if grep -q '\W*noblank\W*' /proc/cmdline; then
+	# Disable screensaver and DPMS Power Saving if requested
+	xset s off
+	xset -dpms
+fi
+
+x2goclient --thinclient --no-session-edit --no-menu --maximize --add-to-known-hosts --haltbt \$LDAPPARAMS \$SESSIONFROM
+XSESSION
+
+chown user:user /home/user/.xsession
+chmod 644 /home/user/.xsession
+
+}
+
+X2GoThinClientConfig

--
Alioth's /srv/git/code.x2go.org/live-build-x2go.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/live-build-x2go.git


More information about the x2go-commits mailing list