[X2Go-Commits] [live-build-x2go] 81/108: moved X background download to earlier script and renamed 60x11-set-background to 60x11-set-xbackground, to avoid confusion with the X2GoClient branding background image downloader

git-admin at x2go.org git-admin at x2go.org
Wed Mar 20 22:13:22 CET 2019


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

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

commit 6767c79aa2eaa897222002b5b8fff8da8b70870c
Author: Stefan Baur (BAUR-ITCS) <kontakt at baur-itcs.de>
Date:   Fri Jan 18 22:25:43 2019 +0000

    moved X background download to earlier script and renamed 60x11-set-background to 60x11-set-xbackground, to avoid confusion with the X2GoClient branding background image downloader
---
 ...{60x11-set-background => 60x11-set-xbackground} |  2 -
 .../lib/live/config/2730-x2go-getxbackground       | 61 ++++++++++++++++++++++
 2 files changed, 61 insertions(+), 2 deletions(-)

diff --git a/config/includes.chroot/etc/X11/Xsession.d/60x11-set-background b/config/includes.chroot/etc/X11/Xsession.d/60x11-set-xbackground
similarity index 94%
rename from config/includes.chroot/etc/X11/Xsession.d/60x11-set-background
rename to config/includes.chroot/etc/X11/Xsession.d/60x11-set-xbackground
index e3b6b90..829e896 100644
--- a/config/includes.chroot/etc/X11/Xsession.d/60x11-set-background
+++ b/config/includes.chroot/etc/X11/Xsession.d/60x11-set-xbackground
@@ -16,8 +16,6 @@ if [ -n "$XROOT" ] ; then
 		fi
 	elif echo "$XROOT" | grep -q "://" ; then
 		# this could be an URI
-		# TODO move this download part to an earlier script
-		wget -q -P $IMAGEDIR/background/ -N ${XROOT//|/ }
 		if [ $(ls $IMAGEDIR 2>/dev/null| wc -l) -gt 0 ] ; then
 			#input validation
 			case "${XROOTMODE,,}" in # force lowercase
diff --git a/config/includes.chroot/lib/live/config/2730-x2go-getxbackground b/config/includes.chroot/lib/live/config/2730-x2go-getxbackground
new file mode 100755
index 0000000..1a0d90e
--- /dev/null
+++ b/config/includes.chroot/lib/live/config/2730-x2go-getxbackground
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+X2GoGetXROOT ()
+{
+	# Output startup message
+	#
+	echo -n " x2go-getxroot"
+
+
+	XROOT=$(sed -e 's/ \([^ ]*\)=/\n\1=/g' -e 's/\([^=]["'"'"']\) /\1\n/g' -e 's/ \([^ "'"'"']\)/\n\1/g' /proc/cmdline | awk -F '=' '$1 == "xroot" { print $2 }' | tr -dc '0-9a-zA-Z,$-_.+!*'"'"'();/?:@=&|')
+	IMAGEDIR=/var/tmp/images/
+	mkdir $IMAGEDIR/background
+
+	if [ -n "$XROOT" ] ; then
+		cat >/etc/network/if-up.d/0430-getxroot <<GETXROOT
+#!/bin/bash
+export TERM=linux;
+
+if [ "\$METHOD" = "loopback" ] || [ "\$METHOD" = "none" ]; then
+        exit 0
+fi
+
+(
+	while ! [ -c /dev/tty8 ] ; do
+		echo -en "\n\$(date +'%F | %T | ')'\$0' is waiting for tty8 to become available."
+		sleep 2
+	done
+	while [ -z "\$(hostname -I)" ] ; do
+		echo -en "\n\$(date +'%F | %T | ')'\$0' is waiting for a client IP." | tee -a /dev/tty8
+		sleep 2
+	done
+
+	echo -en "\n\$(date +'%F | %T | ')'\$0': Attempting X background download ..." | tee -a /dev/tty8
+	if echo "$XROOT" | grep -q "^tftp://" ; then
+		for SINGLEURL in ${XROOT//|/ }; do
+			XROOTSERVER=$(echo "$SINGLEROOT" | sed 's#^tftp://\([^/;]*\)/.*$#\1#' )
+			XROOTPATH=$(echo "$SINGLEROOT" | sed 's#^tftp://[^/;]*/\([^;]*\)$#\1#' )
+			if [ -n "\$XROOTSERVER" ] && [ -n "\$XROOTPATH" ] ; then
+				while ! (cd ${IMAGEDIR}/background/ && atftp "\$XROOTSERVER" -g -r "\$XROOTPATH" ; do
+					echo -en "\n\$(date +'%F | %T | ')still waiting for X background download (tftp) ..." | tee -a /dev/tty8
+					sleep 5
+				done
+			fi
+		done
+	elif echo "$XROOT" | grep -q "^://" ; then
+		while ! wget -q -N -P $IMAGEDIR/background ${XROOT//|/ } ; do
+			echo -en "\n\$(date +'%F | %T | ')still waiting for X background download (wget) ..." | tee -a /dev/tty8
+			sleep 5 
+		done
+	else
+		: # NOP
+	fi
+
+	echo -en "\n\$(date +'%F | %T | ')'\$0': X background download complete." | tee -a /dev/tty8
+) &
+GETXROOT
+		chmod 755 /etc/network/if-up.d/0430-getxroot
+	fi
+}
+
+X2GoGetXROOT

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/live-build-x2go.git


More information about the x2go-commits mailing list