Subject: proposed patch for 2800-x2go-thinclientconfig in live-build-x2go overlay to handle custom image urls passed in as kernel boot options
From: Seth Galitzer <[email-masked]>
To: <[email-masked]>
Date: Tue, 21 Mar 2017 13:54:50 -0500

Package: live-build-x2go, feature/openbox branch
Version: git commit e4cfc12441e587d89d0b2b90021ee5fb5799a46f
Tag: patch

The attached patch updates the 2800-x2go-thinclientconfig hook file in 
the overlay tree from the feature/openbox branch of live-build-x2go used 
to build live boot images for the Thin Client Environment for 
X2Goclient. Full path in the tree is 
[live-build-x2go.git]/config/includes.chroot/lib/live/config/2800-x2go-thinclientconfig.

It provides two things:
1) handle backgroundurl option as passed in as a kernel boot option and 
used by --background flag when invoking x2goclient on the commandline
2) handle brandingurl option as passed in as a kernel boot option and 
used by --branding flag when invoking x2goclient on the commandline per 
patch provided in bug #1162

This patch was built and tested against the most recent commit to the 
branch with id e4cfc12441e587d89d0b2b90021ee5fb5799a46f and timestamped 
Sun, 29 Jan 2017 13:53:42 +0000 (14:53 +0100).

Thank you for your consideration.

Seth

-- 
Seth Galitzer
Systems Coordinator
Computing and Information Sciences
Kansas State University
http://www.cis.ksu.edu/~sgsax
[email-masked]
785-532-7790
--- 2800-x2go-thinclientconfig.orig	2017-03-10 14:08:48.368645370 -0600
+++ 2800-x2go-thinclientconfig.new	2017-03-20 14:38:55.812016035 -0500
@@ -139,7 +139,20 @@
 	fi
 fi
 
-x2goclient --thinclient --no-session-edit --no-menu --maximize --add-to-known-hosts --haltbt --read-exports-from=/home/user/export \$LDAPPARAMS \$SESSIONFROM
+# handle additional options for x2goclient passed in as boot parameters
+ADDOPTS=""
+
+# append custom background image if one was retrieved to additional options
+if [ -e /home/user/custom/background.svg ]; then
+    ADDOPTS="\$ADDOPTS --background=/home/user/custom/background.svg"
+fi
+
+# append custom branding image if one was retrieved to additional options
+if [ -e /home/user/custom/background.svg ]; then
+    ADDOPTS="\$ADDOPTS --branding=/home/user/custom/branding.svg"
+fi
+
+x2goclient --thinclient --no-session-edit --no-menu --maximize --add-to-known-hosts --haltbt --read-exports-from=/home/user/export \$LDAPPARAMS \$SESSIONFROM \$ADDOPTS
 XSESSION
 
 chown user:user /home/user/.xsession
@@ -150,6 +163,30 @@
 chown user:user /home/user/{export,logins,mounts}
 chmod 700 /home/user/{export,logins,mounts}
 
+# handle custom images passed in on boot parameters
+mkdir /home/user/custom
+chown user:user /home/user/custom
+chmod 755 /home/user/custom
+BGURL=$(cat /proc/cmdline | \
+    tr ' ' '\n' | \
+    awk -F'=' ' /^backgroundurl=/ { print $2 }')
+if [ -n $BGURL ]; then
+    /usr/bin/wget $BGURL -q -O /home/user/custom/background.svg
+fi
+BRNDURL=$(cat /proc/cmdline | \
+    tr ' ' '\n' | \
+    awk -F'=' ' /^brandingurl=/ { print $2 }')
+if [ -n $BRNDURL ]; then
+    /usr/bin/wget $BRNDURL -q -O /home/user/custom/branding.svg
+fi
+
+#only try to set permissions if files exist
+CUSTFILES=(/home/user/custom/*)
+if [ -e ${CUSTFILES[0]} ]; then
+    chown user:user /home/user/custom/*
+    chmod 644 /home/user/custom/*
+fi
+
 }
 
 X2GoThinClientConfig