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 41904a044f248eac2a6d53ea761df9762b9959b2 Author: Stefan Baur (BAUR-ITCS) <kontakt@baur-itcs.de> Date: Sat Sep 16 16:09:51 2017 +0200 added code to support background and branding parameters --- .../lib/live/config/2710-x2go-getbranding | 61 ++++++++++++++++++++++ .../lib/live/config/2720-x2go-getbg | 61 ++++++++++++++++++++++ .../lib/live/config/2900-x2go-thinclientconfig | 29 +++++++++- 3 files changed, 149 insertions(+), 2 deletions(-) diff --git a/config/includes.chroot/lib/live/config/2710-x2go-getbranding b/config/includes.chroot/lib/live/config/2710-x2go-getbranding new file mode 100755 index 0000000..992371e --- /dev/null +++ b/config/includes.chroot/lib/live/config/2710-x2go-getbranding @@ -0,0 +1,61 @@ +#!/bin/sh + +X2GoGetBranding () +{ + # Output startup message + # + echo -n " x2go-getbranding" + + + BRANDINGURL=$(cat /proc/cmdline | \ + tr ' ' '\n' | \ + awk -F'=' ' /^branding=/ { print $2 }') + BRANDINGDESTINATION=/etc/x2go/branding.svg + + if [ -n "$BRANDINGURL"] ; then + cat >/etc/network/if-up.d/0410-getbranding <<GETBRAND +#!/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 branding SVG download ..." | tee -a /dev/tty8 + if echo "$BRANDINGURL" | grep -q "^tftp://" ; then + BRANDINGSERVER=$(echo "$BRANDINGURL" | sed 's#^tftp://\([^/]*\)/.*$#\1#' ) + BRANDINGPATH=$(echo "$BRANDINGURL" | sed 's#^tftp://[^/]*/\(.*\)$#\1#' ) + if [ -n "\$BRANDINGSERVER" ] && [ -n "\$BRANDINGPATH" ] ; then + while ! atftp \$BRANDINGSERVER -g -r \$BRANDINGPATH -l ${BRANDINGDESTINATION}.tmp ; do + echo -en "\n\$(date +'%F | %T | ')still waiting for branding SVG download (tftp) ..." | tee -a /dev/tty8 + sleep 5 + done + fi + else + while ! wget -q -O ${BRANDINGDESTINATION}.tmp $BRANDINGURL ; do + echo -en "\n\$(date +'%F | %T | ')still waiting for branding SVG download (wget) ..." | tee -a /dev/tty8 + sleep 5 + done + fi + + echo -en "\n\$(date +'%F | %T | ')'\$0': branding SVG download complete." | tee -a /dev/tty8 + if ! [ -s ${BRANDINGDESTINATION}.tmp ] ; then + mv ${BRANDINGDESTINATION}.tmp $BRANDINGDESTINATION + fi +) & +GETBRAND + chmod 755 /etc/network/if-up.d/0410-getbranding + fi +} + +X2GoGetBranding diff --git a/config/includes.chroot/lib/live/config/2720-x2go-getbg b/config/includes.chroot/lib/live/config/2720-x2go-getbg new file mode 100755 index 0000000..f15cad2 --- /dev/null +++ b/config/includes.chroot/lib/live/config/2720-x2go-getbg @@ -0,0 +1,61 @@ +#!/bin/sh + +X2GoGetBG () +{ + # Output startup message + # + echo -n " x2go-getbg" + + + BGURL=$(cat /proc/cmdline | \ + tr ' ' '\n' | \ + awk -F'=' ' /^bg=/ { print $2 }') + BGDESTINATION=/etc/x2go/bg.svg + + if [ -n "$BGURL"] ; then + cat >/etc/network/if-up.d/0420-getbg <<GETBG +#!/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 background SVG download ..." | tee -a /dev/tty8 + if echo "$BGURL" | grep -q "^tftp://" ; then + BGSERVER=$(echo "$BGURL" | sed 's#^tftp://\([^/]*\)/.*$#\1#' ) + BGPATH=$(echo "$BGURL" | sed 's#^tftp://[^/]*/\(.*\)$#\1#' ) + if [ -n "\$BGSERVER" ] && [ -n "\$BGPATH" ] ; then + while ! atftp \$BGSERVER -g -r \$BGPATH -l ${BGDESTINATION}.tmp ; do + echo -en "\n\$(date +'%F | %T | ')still waiting for background SVG download (tftp) ..." | tee -a /dev/tty8 + sleep 5 + done + fi + else + while ! wget -q -O ${BGDESTINATION}.tmp $BGURL ; do + echo -en "\n\$(date +'%F | %T | ')still waiting for background SVG download (wget) ..." | tee -a /dev/tty8 + sleep 5 + done + fi + + echo -en "\n\$(date +'%F | %T | ')'\$0': background SVG download complete." | tee -a /dev/tty8 + if ! [ -s ${BGDESTINATION}.tmp ] ; then + mv ${BGDESTINATION}.tmp $BGDESTINATION + fi +) & +GETBG + chmod 755 /etc/network/if-up.d/0420-getbg + fi +} + +X2GoGetBranding diff --git a/config/includes.chroot/lib/live/config/2900-x2go-thinclientconfig b/config/includes.chroot/lib/live/config/2900-x2go-thinclientconfig index 87fbae9..01e20d1 100755 --- a/config/includes.chroot/lib/live/config/2900-x2go-thinclientconfig +++ b/config/includes.chroot/lib/live/config/2900-x2go-thinclientconfig @@ -102,13 +102,38 @@ LDAP2=\$(cat /proc/cmdline | \ sed 's/^ldap2=/ldap2#/' | \ awk -F'#' ' /^ldap2#/ { print \$2 }') + +# Check for background and branding SVGs +BRANDING='' +if grep -q ' branding=' /proc/cmdline; then + while ! [ -s /etc/x2go/branding.svg ]; do + OLDCON=\$(fgconsole) + chvt 1 + echo "'$0' is waiting for a valid '/etc/x2go/branding.svg' file." + sleep 2 + done + [ -n "$OLDCON" ] && chvt $OLDCON + \$BRANDING='--branding=/etc/x2go/branding.svg' +fi +BACKGROUND='' +if grep -q ' bg=' /proc/cmdline; then + while ! [ -s /etc/x2go/bg.svg ]; do + OLDCON=\$(fgconsole) + chvt 1 + echo "'$0' is waiting for a valid '/etc/x2go/bg.svg' file." + sleep 2 + done + [ -n "$OLDCON" ] && chvt $OLDCON + \$BACKGROUND='--background=/etc/x2go/bg.svg' +fi + # Spawn X2GoClient if [ -n "\$BROKERURL" ]; then SESSIONFROM="--broker-url=\$BROKERURL" else SESSIONFROM="--session-conf=/etc/x2go/x2gothinclient_sessions" while ! [ -s /etc/x2go/x2gothinclient_sessions ]; do - OLDCON=$(fgconsole) + OLDCON=\$(fgconsole) chvt 1 echo "'$0' is waiting for a valid '/etc/x2go/x2gothinclient_sessions' file." sleep 2 @@ -146,7 +171,7 @@ if [ -n "\$BLANKINGTIME" ]; then fi fi -x2goclient --thinclient --no-session-edit --no-menu --maximize --add-to-known-hosts --haltbt --read-exports-from=/home/user/export \$LDAPPARAMS \$SESSIONFROM +x2goclient --thinclient --no-session-edit --no-menu --maximize --add-to-known-hosts --haltbt --read-exports-from=/home/user/export \$LDAPPARAMS \$SESSIONFROM \$BACKGROUND \$BRANDING XSESSION chown user:user /home/user/.xsession -- 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