[X2Go-Commits] [live-build-x2go] 99/108: moved screensaver image download to if-up.d where it belongs

git-admin at x2go.org git-admin at x2go.org
Wed Mar 20 22:13:26 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 3b2e206427eff03f07f5a2625ebe0cb21bcae242
Author: Stefan Baur (BAUR-ITCS) <kontakt at baur-itcs.de>
Date:   Fri Feb 1 14:51:20 2019 +0000

    moved screensaver image download to if-up.d where it belongs
---
 .../60x11-spawn-configure-slideshow-screensaver    |  7 ---
 .../etc/network/if-up.d/0440-getxscreensaverimgs   | 50 ++++++++++++++++++++++
 2 files changed, 50 insertions(+), 7 deletions(-)

diff --git a/config/includes.chroot/etc/X11/Xsession.d/60x11-spawn-configure-slideshow-screensaver b/config/includes.chroot/etc/X11/Xsession.d/60x11-spawn-configure-slideshow-screensaver
index 859884d..a8427a1 100644
--- a/config/includes.chroot/etc/X11/Xsession.d/60x11-spawn-configure-slideshow-screensaver
+++ b/config/includes.chroot/etc/X11/Xsession.d/60x11-spawn-configure-slideshow-screensaver
@@ -13,13 +13,6 @@ if [ -z "$XSAVERIMAGES" ] && [ -z "$XSAVERIDLETIME" ] && [ -z "$XSAVERIMGTIME" ]
 	: # "exit 0" is a bad idea here, so we "NOP" instead
 else
 
-	if echo "$XSAVERIMAGES" | grep -q "://" ; then
-			# this could be an URI
-			# TODO move this download part to an earlier script
-			mkdir -p $SLIDESDIR
-			wget -q -P $SLIDESDIR -N ${XSAVERIMAGES//|/ }
-	fi
-
 	[ -z "$XSAVERIDLETIME" ] && XSAVERIDLETIME=300 # default to 5 minutes if parameter wasn't set
 	[ -z "$XSAVERIMGTIME" ] && XSAVERIMGTIME=30 # default to 30 seconds if parameter wasn't set
 
diff --git a/config/includes.chroot/etc/network/if-up.d/0440-getxscreensaverimgs b/config/includes.chroot/etc/network/if-up.d/0440-getxscreensaverimgs
new file mode 100755
index 0000000..4f1ed2c
--- /dev/null
+++ b/config/includes.chroot/etc/network/if-up.d/0440-getxscreensaverimgs
@@ -0,0 +1,50 @@
+#!/bin/bash
+export TERM=linux;
+XSAVERIMAGES=$(sed -e 's/ \([^ ]*\)=/\n\1=/g' -e 's/\([^=]["'"'"']\) /\1\n/g' -e 's/ \([^ "'"'"']\)/\n\1/g' /proc/cmdline | awk -F '=' '$1 == "xsaverimages" { print $2 }' | tr -dc '0-9a-zA-Z,$-_.+!*'"'"'();/?:@=&|')
+
+IMAGEDIR=/var/tmp/images/
+SLIDESDIR="${IMAGEDIR}/slides/"
+
+mkdir -p $SLIDESDIR
+
+if [ -n "$XSAVERIMAGES" ] ; then
+
+	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 screensaver image/images download ..." | tee -a /dev/tty8
+		if echo "$XSAVERIMAGES" | grep -q "^tftp://" ; then
+			for SINGLEXSAVERIMAGEURL in ${XSAVERIMAGES//|/ }; do
+				XSAVERIMAGESERVER=$(echo "$SINGLEXSAVERIMAGEURL" | sed 's#^tftp://\([^/;]*\)/.*$#\1#' )
+				XSAVERIMAGEPATH=$(echo "$SINGLEXSAVERIMAGEURL" | sed 's#^tftp://[^/;]*/\([^;]*\)$#\1#' )
+				if [ -n "$XSAVERIMAGESERVER" ] && [ -n "$XSERVERIMAGEPATH" ] ; then
+					while ! (cd $SLIDESDIR && atftp "$XSAVERIMAGESERVER" -g -r "$XSAVERIMAGEPATH") ; do
+						echo -en "\n$(date +'%F | %T | ')still waiting for screensaver download (tftp) ..." | tee -a /dev/tty8
+						sleep 5
+					done
+				fi
+			done
+		elif echo "$XROOT" | grep -q "://" ; then
+			while ! wget -q -N -P $SLIDESDIR ${XSAVERIMAGES//|/ } ; do
+				echo -en "\n$(date +'%F | %T | ')still waiting for screensaver download (wget) ..." | tee -a /dev/tty8
+				sleep 5 
+			done
+		else
+			: # NOP
+		fi
+
+		echo -en "\n$(date +'%F | %T | ')'$0': Screensaver download complete." | tee -a /dev/tty8
+
+	) &
+fi

--
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