[X2Go-Commits] [live-build-x2go] 100/166: all if-up tasks are now sent into the background and told to wait until tty becomes available also, fixed indention in tcpprint

git-admin at x2go.org git-admin at x2go.org
Mon Nov 20 02:16:55 CET 2017


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

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

commit 6238288d36db18a8ca946461519ec02ccca7d689
Author: Stefan Baur (BAUR-ITCS) <kontakt at baur-itcs.de>
Date:   Sun Jul 23 22:53:03 2017 +0200

    all if-up tasks are now sent into the background and told to wait until tty becomes available
    also, fixed indention in tcpprint
---
 .../includes.chroot/lib/live/config/2000-settime   |  24 +-
 .../lib/live/config/2100-showifconfig              |  36 +-
 .../lib/live/config/2250-getsshpubkeysfromserver   |  52 +-
 .../lib/live/config/2300-xserver-xorg-getxorgconf  |  44 +-
 .../lib/live/config/2400-live-autoupdate           | 707 +++++++++++----------
 .../includes.chroot/lib/live/config/2600-tcpprint  |   5 +
 .../lib/live/config/2700-x2go-getsessions          |  44 +-
 7 files changed, 476 insertions(+), 436 deletions(-)

diff --git a/config/includes.chroot/lib/live/config/2000-settime b/config/includes.chroot/lib/live/config/2000-settime
index dc062cd..67afe90 100755
--- a/config/includes.chroot/lib/live/config/2000-settime
+++ b/config/includes.chroot/lib/live/config/2000-settime
@@ -15,15 +15,21 @@ if [ "$METHOD" = loopback ]; then
         exit 0
 fi
 
-while [ -z "\$(hostname -I)" ] ; do
-	echo -en "\n'\$0' is waiting for a client IP." | tee -a /dev/tty8
-	sleep 2
-done
-if ntpdate-debian -s && hwclock --systohc ; then
-	echo -en "\n\$(date +'%F | %T | ')'\$0' - time has been set." | tee -a /dev/tty8
-else
-	echo -en "\n\$(date +'%F | %T | ')'\$0' - error setting time. Timestamps will be based on CMOS Clock." | tee -a /dev/tty8
-fi
+(
+	while ! [ -c /dev/tty8 ] ; do
+		echo -en "\n'\$0' is waiting for tty8 to become available."
+		sleep 2
+	done
+	while [ -z "\$(hostname -I)" ] ; do
+		echo -en "\n'\$0' is waiting for a client IP." | tee -a /dev/tty8
+		sleep 2
+	done
+	if ntpdate-debian -s && hwclock --systohc ; then
+		echo -en "\n\$(date +'%F | %T | ')'\$0' - time has been set." | tee -a /dev/tty8
+	else
+		echo -en "\n\$(date +'%F | %T | ')'\$0' - error setting time. Timestamps will be based on CMOS Clock." | tee -a /dev/tty8
+	fi
+) &
 SETTIME
 
 chmod 755 /etc/network/if-up.d/0050-settime
diff --git a/config/includes.chroot/lib/live/config/2100-showifconfig b/config/includes.chroot/lib/live/config/2100-showifconfig
index afa8722..6851dde 100755
--- a/config/includes.chroot/lib/live/config/2100-showifconfig
+++ b/config/includes.chroot/lib/live/config/2100-showifconfig
@@ -18,21 +18,27 @@ if [ "$METHOD" = loopback ]; then
         exit 0
 fi
 
-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
-
-IPMSG=\$(LANG=C \
-/sbin/ip a | \
-/bin/grep -P --color=always "inet.*? [\. 0-9a-f:/]*? |$" | \
-GREP_COLOR="1;32" \
-/bin/grep -P --color=always "link/ether .*? |$" ); \
-IPMSG=\$( sed 's/^/- /' <<< "\$IPMSG" ); 
-sed -i '/^- /d' /etc/issue; 
-sed -i '/^- /d' /etc/issue.net; 
-echo "\$IPMSG" >> /etc/issue; 
-echo "\$IPMSG" >> /etc/issue.net
+(
+	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
+
+	IPMSG=\$(LANG=C \
+	/sbin/ip a | \
+	/bin/grep -P --color=always "inet.*? [\. 0-9a-f:/]*? |$" | \
+	GREP_COLOR="1;32" \
+	/bin/grep -P --color=always "link/ether .*? |$" ); \
+	IPMSG=\$( sed 's/^/- /' <<< "\$IPMSG" ); 
+	sed -i '/^- /d' /etc/issue; 
+	sed -i '/^- /d' /etc/issue.net; 
+	echo "\$IPMSG" >> /etc/issue; 
+	echo "\$IPMSG" >> /etc/issue.net
+) &
 SHOWIPS
 
 chmod 755 /etc/network/if-up.d/0100-showips
diff --git a/config/includes.chroot/lib/live/config/2250-getsshpubkeysfromserver b/config/includes.chroot/lib/live/config/2250-getsshpubkeysfromserver
index 4749db2..8cfb1f5 100755
--- a/config/includes.chroot/lib/live/config/2250-getsshpubkeysfromserver
+++ b/config/includes.chroot/lib/live/config/2250-getsshpubkeysfromserver
@@ -21,33 +21,39 @@ if [ "$METHOD" = loopback ]; then
         exit 0
 fi
 
-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
-
-# Set Keyfile
-#
-mkdir -p /root/.ssh
-chmod 600 /root/.ssh
-touch /root/.ssh/authorized_keys
-chmod 600 /root/.ssh/authorized_keys
-
-if echo "$PUBKEYURL" | grep -q "^tftp://" ; then
-	PUBKEYSERVER=$(echo "$PUBKEYURL" | sed 's#^tftp://\([^/]*\)/.*$#\1#' )
-	PUBKEYPATH=$(echo "$PUBKEYURL" | sed 's#^tftp://[^/]*/\(.*\)$#\1#' )
-	if [ -n "\$PUBKEYSERVER" ] && [ -n "\$PUBKEYPATH" ] ; then
-		while ! atftp $PUBKEYSERVER -g -r $PUBKEYPATH -l /root/.ssh/authorized_keys ; do
+(
+	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
+
+	# Set Keyfile
+	#
+	mkdir -p /root/.ssh
+	chmod 600 /root/.ssh
+	touch /root/.ssh/authorized_keys
+	chmod 600 /root/.ssh/authorized_keys
+
+	if echo "$PUBKEYURL" | grep -q "^tftp://" ; then
+		PUBKEYSERVER=$(echo "$PUBKEYURL" | sed 's#^tftp://\([^/]*\)/.*$#\1#' )
+		PUBKEYPATH=$(echo "$PUBKEYURL" | sed 's#^tftp://[^/]*/\(.*\)$#\1#' )
+		if [ -n "\$PUBKEYSERVER" ] && [ -n "\$PUBKEYPATH" ] ; then
+			while ! atftp $PUBKEYSERVER -g -r $PUBKEYPATH -l /root/.ssh/authorized_keys ; do
+				echo -en "\n\$(date +'%F | %T | ')'\$0': Waiting for SSH Public Key ..." | tee -a /dev/tty8
+				sleep 5
+			done
+		fi
+	else
+		while ! wget -q -O - $PUBKEYURL >/root/.ssh/authorized_keys ; do
 			echo -en "\n\$(date +'%F | %T | ')'\$0': Waiting for SSH Public Key ..." | tee -a /dev/tty8
 			sleep 5
 		done
 	fi
-else
-	while ! wget -q -O - $PUBKEYURL >/root/.ssh/authorized_keys ; do
-		echo -en "\n\$(date +'%F | %T | ')'\$0': Waiting for SSH Public Key ..." | tee -a /dev/tty8
-		sleep 5
-	done
-fi
+) &
 GETPUBKEY
 
 		chmod 755 /etc/network/if-up.d/0200-getsshpubkeysfromserver
diff --git a/config/includes.chroot/lib/live/config/2300-xserver-xorg-getxorgconf b/config/includes.chroot/lib/live/config/2300-xserver-xorg-getxorgconf
index eb14799..94a6c70 100755
--- a/config/includes.chroot/lib/live/config/2300-xserver-xorg-getxorgconf
+++ b/config/includes.chroot/lib/live/config/2300-xserver-xorg-getxorgconf
@@ -19,29 +19,35 @@ if [ "$METHOD" = loopback ]; then
         exit 0
 fi
 
-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
-if echo "$XORGCONFURL" | grep -q "^tftp://" ; then
-	XORGCONFSERVER=$(echo "$XORGCONFURL" | sed 's#^tftp://\([^/]*\)/.*$#\1#' )
-	XORGCONFPATH=$(echo "$XORGCONFURL" | sed 's#^tftp://[^/]*/\(.*\)$#\1#' )
-	if [ -n "\$XORGCONFSERVER" ] && [ -n "\$XORGCONFPATH" ] ; then
-		while ! atftp \$XORGCONFSERVER -g -r \$XORGCONFPATH -l $XORGCONFDESTINATION ; do
+(
+	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
+	if echo "$XORGCONFURL" | grep -q "^tftp://" ; then
+		XORGCONFSERVER=$(echo "$XORGCONFURL" | sed 's#^tftp://\([^/]*\)/.*$#\1#' )
+		XORGCONFPATH=$(echo "$XORGCONFURL" | sed 's#^tftp://[^/]*/\(.*\)$#\1#' )
+		if [ -n "\$XORGCONFSERVER" ] && [ -n "\$XORGCONFPATH" ] ; then
+			while ! atftp \$XORGCONFSERVER -g -r \$XORGCONFPATH -l $XORGCONFDESTINATION ; do
+				echo -en "\n\$(date +'%F | %T | ')'\$0': Waiting for xorg.conf download ..." | tee -a /dev/tty8
+				sleep 5
+			done
+		fi
+	else
+		while ! wget -q -O $XORGCONFDESTINATION $XORGCONFURL ; do
 			echo -en "\n\$(date +'%F | %T | ')'\$0': Waiting for xorg.conf download ..." | tee -a /dev/tty8
-			sleep 5
+			sleep 5 
 		done
 	fi
-else
-	while ! wget -q -O $XORGCONFDESTINATION $XORGCONFURL ; do
-		echo -en "\n\$(date +'%F | %T | ')'\$0': Waiting for xorg.conf download ..." | tee -a /dev/tty8
-		sleep 5 
-	done
-fi
 
-if [ -s $XORGCONFDESTINATION ] ; then
-	mv $XORGCONFDESTINATION /etc/X11/xorg.conf
-fi
+	if [ -s $XORGCONFDESTINATION ] ; then
+		mv $XORGCONFDESTINATION /etc/X11/xorg.conf
+	fi
+) &
 GETXORG
                 chmod 755 /etc/network/if-up.d/0300-getxorgconf
         fi
diff --git a/config/includes.chroot/lib/live/config/2400-live-autoupdate b/config/includes.chroot/lib/live/config/2400-live-autoupdate
index 9f3bdfa..24e7c54 100755
--- a/config/includes.chroot/lib/live/config/2400-live-autoupdate
+++ b/config/includes.chroot/lib/live/config/2400-live-autoupdate
@@ -34,402 +34,407 @@ echo -n " live-autoupdater (backgrounding update task)"
 #
 (
 
-# redirect all output to first available VT console
-#
-exec >/dev/tty8 2>&1
+	while ! [ -c /dev/tty8 ] ; do
+		echo -en "\n\$(date +'%F | %T | ')'\$0' is waiting for tty8 to become available."
+		sleep 2
+	done
 
+	# redirect all output to first available VT console
+	#
+	exec >/dev/tty8 2>&1
 
-# clear console
-#
-clear
 
+	# clear console
+	#
+	clear
 
-# This is so grep, awk and sed will match the right terms regardless of LANG
-#
-unset LANG
-unset LC_ALL
-unset LC_MESSAGES
 
+	# This is so grep, awk and sed will match the right terms regardless of LANG
+	#
+	unset LANG
+	unset LC_ALL
+	unset LC_MESSAGES
 
-# download url pointing to directory with all required files goes here
-DOWNLOADURL=$(cat /proc/cmdline | \
-               tr ' ' '\n' | \
-               awk -F'=' ' /^updateurl=/ { print $2 }')
 
-if [ -z "$DOWNLOADURL" ]; then
-	echo -en "\n$(date +'%F | %T | ')'\$0': No update URL. Exiting."
-	return 0
-fi
+	# download url pointing to directory with all required files goes here
+	DOWNLOADURL=$(cat /proc/cmdline | \
+		       tr ' ' '\n' | \
+		       awk -F'=' ' /^updateurl=/ { print $2 }')
 
-# Bandwidth limit goes here
-#
-#BWLIMITPERCENT=20 # in percent, numeric-only
-BWLIMITPERCENT=$(cat /proc/cmdline | \
-                        tr ' ' '\n' | \
-                        awk -F'=' ' /^bwlimit=/ { print $2 }')
-if [ -z "$BWLIMITPERCENT" ]; then 
-	BWLIMITPERCENT=20
-	echo -en "\n$(date +'%F | %T | ')'\$0': Bandwidth limit not set. Defaulting to 20%."
-fi
+	if [ -z "$DOWNLOADURL" ]; then
+		echo -en "\n$(date +'%F | %T | ')'\$0': No update URL. Exiting."
+		return 0
+	fi
 
+	# Bandwidth limit goes here
+	#
+	#BWLIMITPERCENT=20 # in percent, numeric-only
+	BWLIMITPERCENT=$(cat /proc/cmdline | \
+				tr ' ' '\n' | \
+				awk -F'=' ' /^bwlimit=/ { print $2 }')
+	if [ -z "$BWLIMITPERCENT" ]; then 
+		BWLIMITPERCENT=20
+		echo -en "\n$(date +'%F | %T | ')'\$0': Bandwidth limit not set. Defaulting to 20%."
+	fi
 
 
-# sleeping a random amount of time to ease load on the update server
-#
-MAXSLEEPTIME=$(cat /proc/cmdline | \
-                        tr ' ' '\n' | \
-                        awk -F'=' ' /^updatesleep=/ && $2 ~ /^[0-9]*$/ { print $2 }')
-if [ -z "$MAXSLEEPTIME" ] || [ $MAXSLEEPTIME -lt 240 ] ; then
-	MAXSLEEPTIME=900
-fi
-SLEEPTIME=0
-echo -en "\n$(date +'%F | %T | ')'\$0': Calculating random update delay (120-$MAXSLEEPTIME seconds)..."
-# During startup, script is run with /bin/sh, 
-# even when #!/bin/bash is set,
-# so we need to improvise.
-RND=$(/bin/bash -c 'echo $RANDOM')
-SLEEPTIME=$((RND%MAXSLEEPTIME))
-if [ $SLEEPTIME -lt 120 ]; then
-	SLEEPTIME=$((SLEEPTIME+120))
-fi
-echo -en "\n$(date +'%F | %T | ')'\$0': Sleeping for $SLEEPTIME seconds ..."
-sleep $SLEEPTIME
-
-
-# Define our mountpoint and check if we're capable of auto-updating
-NTFSROOT=$(cat /proc/cmdline | tr ' ' '\n' | awk -F '=' '/^ntfs-uuid/ { print $2 }')
-if [ -n "$NTFSROOT" ]; then
-	mkdir -p /lib/live/mount/ntfsroot
-	# This is in case we've been passed an incomplete UUID and/or one with dashes
-	# For example, "vol c:" on Windows will return the last 8 digits of the UUID
-        # only, and separate them with a dash.
-	if ! [ -L "/dev/disk/by-uuid/$NTFSROOT" ]; then
-		NTFSROOT=$(echo $NTFSROOT | tr -d '-')
+
+	# sleeping a random amount of time to ease load on the update server
+	#
+	MAXSLEEPTIME=$(cat /proc/cmdline | \
+				tr ' ' '\n' | \
+				awk -F'=' ' /^updatesleep=/ && $2 ~ /^[0-9]*$/ { print $2 }')
+	if [ -z "$MAXSLEEPTIME" ] || [ $MAXSLEEPTIME -lt 240 ] ; then
+		MAXSLEEPTIME=900
+	fi
+	SLEEPTIME=0
+	echo -en "\n$(date +'%F | %T | ')'\$0': Calculating random update delay (120-$MAXSLEEPTIME seconds)..."
+	# During startup, script is run with /bin/sh, 
+	# even when #!/bin/bash is set,
+	# so we need to improvise.
+	RND=$(/bin/bash -c 'echo $RANDOM')
+	SLEEPTIME=$((RND%MAXSLEEPTIME))
+	if [ $SLEEPTIME -lt 120 ]; then
+		SLEEPTIME=$((SLEEPTIME+120))
+	fi
+	echo -en "\n$(date +'%F | %T | ')'\$0': Sleeping for $SLEEPTIME seconds ..."
+	sleep $SLEEPTIME
+
+
+	# Define our mountpoint and check if we're capable of auto-updating
+	NTFSROOT=$(cat /proc/cmdline | tr ' ' '\n' | awk -F '=' '/^ntfs-uuid/ { print $2 }')
+	if [ -n "$NTFSROOT" ]; then
+		mkdir -p /lib/live/mount/ntfsroot
+		# This is in case we've been passed an incomplete UUID and/or one with dashes
+		# For example, "vol c:" on Windows will return the last 8 digits of the UUID
+		# only, and separate them with a dash.
 		if ! [ -L "/dev/disk/by-uuid/$NTFSROOT" ]; then
-			NTFSROOT=$(basename $(echo /dev/disk/by-uuid/*$NTFSROOT | tr ' ' '\n' | head -1))
+			NTFSROOT=$(echo $NTFSROOT | tr -d '-')
+			if ! [ -L "/dev/disk/by-uuid/$NTFSROOT" ]; then
+				NTFSROOT=$(basename $(echo /dev/disk/by-uuid/*$NTFSROOT | tr ' ' '\n' | head -1))
+			fi
 		fi
-	fi
 
-	if mount -t ntfs-3g -rw /dev/disk/by-uuid/$NTFSROOT /lib/live/mount/ntfsroot ; then
-		echo -en "\n$(date +'%F | %T | ')'\$0': Mounted '/dev/disk/by-uuid/$NTFSROOT'."
+		if mount -t ntfs-3g -rw /dev/disk/by-uuid/$NTFSROOT /lib/live/mount/ntfsroot ; then
+			echo -en "\n$(date +'%F | %T | ')'\$0': Mounted '/dev/disk/by-uuid/$NTFSROOT'."
+		else
+			echo -en "\n$(date +'%F | %T | ')'\$0': Unable to mount '/dev/disk/by-uuid/$NTFSROOT'."
+		fi
+		# TODO: Further error handling
+		MOUNTPOINT="/lib/live/mount/ntfsroot/"
+		# create a temporary directory
+		TEMPDIR=$(mktemp -d --tmpdir=$MOUNTPOINT)
 	else
-		echo -en "\n$(date +'%F | %T | ')'\$0': Unable to mount '/dev/disk/by-uuid/$NTFSROOT'."
+		MOUNTPOINT="/lib/live/mount/findiso/"
+		# create a temporary directory and mount a tmpfs there
+		TEMPDIR=$(mktemp -d --tmpdir=/mnt)
+		
+		if [ -d /lib/live/mount/findiso/ ] ; then
+			# if we have access to the entire filesystem, use the
+			# directory size as base size for the current image - 
+			# and if the download directory is even bigger, use that size
+			IMGSIZE=$(du -s "/lib/live/mount/findiso/$(dirname $(sed -e 's/^.*findiso/findiso/' -e 's/ .*$//' /proc/cmdline | awk -F '=' '{ print $2 }'))")
+			IMGSIZEDOWNLOAD=$(du -s "/lib/live/mount/findiso/boot/X2Go-live-download")
+			[ $IMGSIZEDOWNLOAD -gt $IMGSIZE ] && IMGSIZE=$IMGSIZEDOWNLOAD
+		else
+			IMGSIZE=$(df /lib/live/mount/medium | awk ' /medium/ { print $2}')
+		fi
+		# multiply current size by 1.5 as safety margin
+		mount -t tmpfs -osize=$((IMGSIZE*15/10))k tmpfs $TEMPDIR
+
 	fi
-	# TODO: Further error handling
-	MOUNTPOINT="/lib/live/mount/ntfsroot/"
-	# create a temporary directory
-	TEMPDIR=$(mktemp -d --tmpdir=$MOUNTPOINT)
-else
-	MOUNTPOINT="/lib/live/mount/findiso/"
-	# create a temporary directory and mount a tmpfs there
-	TEMPDIR=$(mktemp -d --tmpdir=/mnt)
-	
-	if [ -d /lib/live/mount/findiso/ ] ; then
-		# if we have access to the entire filesystem, use the
-		# directory size as base size for the current image - 
-		# and if the download directory is even bigger, use that size
-		IMGSIZE=$(du -s "/lib/live/mount/findiso/$(dirname $(sed -e 's/^.*findiso/findiso/' -e 's/ .*$//' /proc/cmdline | awk -F '=' '{ print $2 }'))")
-		IMGSIZEDOWNLOAD=$(du -s "/lib/live/mount/findiso/boot/X2Go-live-download")
-		[ $IMGSIZEDOWNLOAD -gt $IMGSIZE ] && IMGSIZE=$IMGSIZEDOWNLOAD
-	else
-		IMGSIZE=$(df /lib/live/mount/medium | awk ' /medium/ { print $2}')
+	if ! (	[ -d "$MOUNTPOINT/boot/X2Go-live-download" ] && \
+		( \
+			[ -d "$MOUNTPOINT/boot/X2Go-live1" ] || \
+			[ -d "$MOUNTPOINT/boot/X2Go-live2" ] \
+		) \
+	     ); then
+		[ -n "$NTFSROOT" ] && umount $MOUNTPOINT
+		echo -en "\n$(date +'%F | %T | ')'\$0': No directories suitable for update."
+		return 0 # directories missing, most likely not a writeable medium
 	fi
-	# multiply current size by 1.5 as safety margin
-	mount -t tmpfs -osize=$((IMGSIZE*15/10))k tmpfs $TEMPDIR
-
-fi
-if ! (	[ -d "$MOUNTPOINT/boot/X2Go-live-download" ] && \
-	( \
-		[ -d "$MOUNTPOINT/boot/X2Go-live1" ] || \
-		[ -d "$MOUNTPOINT/boot/X2Go-live2" ] \
-	) \
-     ); then
-	[ -n "$NTFSROOT" ] && umount $MOUNTPOINT
-	echo -en "\n$(date +'%F | %T | ')'\$0': No directories suitable for update."
-	return 0 # directories missing, most likely not a writeable medium
-fi
-
-
-# define and figure out some paths that we will be needing later on
-#
-if [ -f "$MOUNTPOINT/syslinux.cfg" ]; then
-	SYSLINUXPATH="$MOUNTPOINT/"
-elif [ -f "$MOUNTPOINT/syslinux/syslinux.cfg" ]; then
-	SYSLINUXPATH="$MOUNTPOINT/syslinux/"
-elif [ -f "$MOUNTPOINT/menu.lst" ]; then
-	GRUBPATH="$MOUNTPOINT/"
-elif  [ -f "$MOUNTPOINT/boot/menu.lst" ]; then
-	GRUBPATH="$MOUNTPOINT/grub/"
-elif  [ -f "$MOUNTPOINT/boot/grub/menu.lst" ]; then
-	GRUBPATH="$MOUNTPOINT/boot/grub/"
-else
-	[ -n "$NTFSROOT" ] && umount $MOUNTPOINT
-	echo -en "\n$(date +'%F | %T | ')'\$0': No suitable bootloader found."
-	return 1
-fi
-
-RUNNINGSYSTEMFULLPATH=$(dirname $(readlink -m "$MOUNTPOINT/$(cat /proc/cmdline | \
-                        tr ' ' '\n' | \
-                        awk -F'=' ' /^findiso=/ { print $2 }')"))
-
-ALLSYSTEMSROOT=$(dirname $RUNNINGSYSTEMFULLPATH)
-RUNNINGSYSTEMNAME=$(basename $RUNNINGSYSTEMFULLPATH)
-if [ "$RUNNINGSYSTEMNAME" = "X2Go-live1" ]; then
-	OTHERSYSTEMNAME="X2Go-live2"
-elif [ "$RUNNINGSYSTEMNAME" = "X2Go-live2" ]; then
-	OTHERSYSTEMNAME="X2Go-live1"
-else
-	[ -n "$NTFSROOT" ] && umount $MOUNTPOINT
-	echo -en "\n$(date +'%F | %T | ')'\$0': Unable to determine path/name of running system."
-	return 1
-fi
-OTHERSYSTEMFULLPATH=$(readlink -m "$ALLSYSTEMSROOT/$OTHERSYSTEMNAME")
-DOWNLOADPATH=$(readlink -m "$ALLSYSTEMSROOT/X2Go-live-download/")
-
-
-# Now we'll copy the content of the X2Go-live-download folder to our tempdir
-# this is so we can run wget in update mode (-N) or rsync without needing
-# write access to our boot medium (write access means increased wear and tear,
-# and we want to avoid that especially for media that has no wear-leveling
-# like CF cards)
-#
-while ! rsync -aPv --inplace --modify-window=1 $DOWNLOADPATH/ $TEMPDIR; do
-	echo -en "\n$(date +'%F | %T | ')'\$0': Sleeping 30 seconds ..."
-	sleep 30
-	echo -en "\n$(date +'%F | %T | ')'\$0': Retrying ..."
-done
 
 
-# Now let's figure out if we're supposed to use wget or rsync for downloading
-#
-if echo "$DOWNLOADURL" | grep -q "^http" || \
-   echo "$DOWNLOADURL" | grep -q "^ftp"
-   then
-	# Attempt to determine available bandwidth & to set BWLIMIT accordingly
-	wget -Nr -o /tmp/dl.log -P /tmp/ -nd \
-		--progress=bar:force $DOWNLOADURL/x2go-tce-initrd.img 
-	cp --update "/tmp/x2go-tce-initrd.img" "$TEMPDIR"
-	rm "/tmp/x2go-tce-initrd.img"
-	SIZEFACTORSTRING=$(	awk -F' |\(|\)' ' $9 == "saved" && \
-				$7 == "-" { print $5 }' /tmp/dl.log | \
-				tail -1 \
-			   )
-	case $SIZEFACTORSTRING in
-		"" | \
-		[0-9]) 	echo -en "\n$(date +'%F | %T | ')'\$0': Not enough Bandwidth for update task - "
-			echo -n "aborting."
-			cleanup
-			return 0
-			;;
-                "KB/s") SIZEFACTOR=1;;
-                "MB/s") SIZEFACTOR=1024;;
-                "GB/s") SIZEFACTOR=1048576;;
-		*)     	SIZEFACTOR=$((1024*1024*1024));;
-	esac
-	DLRATE=$(	awk -F' |\(|\)' ' $9 == "saved" && $7 == "-" \
-			{ print $4 }' /tmp/dl.log | \
-			tail -1
-                 )
-	BWLIMIT=$(	echo "$DLRATE $SIZEFACTOR $BWLIMITPERCENT" | \
-			awk ' { print $1*$2*$3/100 }' | \
-			awk -F'.' '{ print $1 }' \
-		  ) # outputs integer kilobytes, not rounded
-	echo -en "\n$(date +'%F | %T | ')'\$0': Determined bandwidth limit: '$BWLIMIT KB/s'"
-	DOWNLOADCOMMAND="wget -Nr -l 1 -nd -P "$TEMPDIR" \
-			  --progress=bar:force \
-			  --limit-rate=${BWLIMIT}k $DOWNLOADURL"
-
-elif echo "$DOWNLOADURL" | grep -q "^rsync"; then
-
-	rsync -hh -aPv -W --inplace --log-file=/tmp/dl.log $DOWNLOADURL/x2go-tce-initrd.img \
-		$TEMPDIR/x2go-tce-initrd.img.new
-	mv $TEMPDIR/x2go-tce-initrd.img.new $TEMPDIR/x2go-tce-initrd.img
-	SIZEFACTORSTRING=$(	sed -e's_\(. bytes/sec\)_ \1_' /tmp/dl.log | \
-				awk '$4 == "sent" && $12 == "bytes/sec" \
-				{ print $11 }' \
-			   )
-	case $SIZEFACTORSTRING in
-		"" | \
-		[0-9]) 	echo -en "\n$(date +'%F | %T | ')'\$0': Not enough Bandwidth for update task - "
-			echo -n "aborting."
-			cleanup
-			return 0
-			;;
-		"K")   	SIZEFACTOR=1;;
-		"M")   	SIZEFACTOR=1024;;
-		"G")   	SIZEFACTOR=$((1024*1024));;
-		*)     	SIZEFACTOR=$((1024*1024*1024));;
-	esac
-	DLRATE=$(	sed -e's_\(. bytes/sec\)_ \1_' /tmp/dl.log | \
-			awk '$4 == "sent" && $12 == "bytes/sec" \
-			{ print $10 }')
-	BWLIMIT=$(	echo "$DLRATE $SIZEFACTOR $BWLIMITPERCENT" | \
-			awk ' { print $1*$2*$3/100 }' | \
-			awk -F'.' '{ print $1 }' \
-		  ) # outputs integer kilobytes, not rounded
-	echo -en "\n$(date +'%F | %T | ')'\$0': Determined bandwidth limit: '$BWLIMIT KB/s'"
-	DOWNLOADCOMMAND="rsync -aPv --inplace --bwlimit=$BWLIMIT $DOWNLOADURL/ \
-			  $TEMPDIR"
-else 
-	[ -n "$NTFSROOT" ] && umount $MOUNTPOINT
-	echo -en "\n$(date +'%F | %T | ')'\$0': Unsupported download mechanism - aborting."
-	return 1
-fi
-rm /tmp/dl.log
-
-
-# Proceed to download from update location
-#
-while ! $DOWNLOADCOMMAND; do
-	echo -en "\n$(date +'%F | %T | ')'\$0': Sleeping 30 seconds ..."
-	sleep 30
-	echo -en "\n$(date +'%F | %T | ')'\$0': Retrying ..."
-done
-
-# Now check if these files are different from what we already have in our
-# download directory on the boot medium
-#
-echo -en "\n$(date +'%F | %T | ')'\$0': Diff'ing '$DOWNLOADPATH' '$TEMPDIR' ..."
-if diff -q $DOWNLOADPATH $TEMPDIR \
-	>/dev/null
-
-	then
-	cleanup
-	echo -en "\n$(date +'%F | %T | ')'\$0': Nothing to do. - Files on server not newer than '$DOWNLOADPATH'."
-	return 0 	# current is newest, nothing to do, we want to avoid
-			# unneccessary writes to the medium
-else
-	echo -en "\n$(date +'%F | %T | ')'\$0': Differences detected. Continuing ..."
-fi
-
-
-# If we made it past that point, it's time to update the boot medium, so let's
-# remount it rw and async for speed
-#
-if mount -oremount,rw,async $MOUNTPOINT; then
-	echo -en "\n$(date +'%F | %T | ')'\$0': Remounted '$MOUNTPOINT' as rw and async."
-else
-	echo -en "\n$(date +'%F | %T | ')'\$0': Could not remount '$MOUNTPOINT' as rw and async."
-fi
-
-
-# Now, we don't want to copy an index.htm(l) file, so let's do away with that
-#
-rm -f $TEMPDIR/index.ht*
+	# define and figure out some paths that we will be needing later on
+	#
+	if [ -f "$MOUNTPOINT/syslinux.cfg" ]; then
+		SYSLINUXPATH="$MOUNTPOINT/"
+	elif [ -f "$MOUNTPOINT/syslinux/syslinux.cfg" ]; then
+		SYSLINUXPATH="$MOUNTPOINT/syslinux/"
+	elif [ -f "$MOUNTPOINT/menu.lst" ]; then
+		GRUBPATH="$MOUNTPOINT/"
+	elif  [ -f "$MOUNTPOINT/boot/menu.lst" ]; then
+		GRUBPATH="$MOUNTPOINT/grub/"
+	elif  [ -f "$MOUNTPOINT/boot/grub/menu.lst" ]; then
+		GRUBPATH="$MOUNTPOINT/boot/grub/"
+	else
+		[ -n "$NTFSROOT" ] && umount $MOUNTPOINT
+		echo -en "\n$(date +'%F | %T | ')'\$0': No suitable bootloader found."
+		return 1
+	fi
 
+	RUNNINGSYSTEMFULLPATH=$(dirname $(readlink -m "$MOUNTPOINT/$(cat /proc/cmdline | \
+				tr ' ' '\n' | \
+				awk -F'=' ' /^findiso=/ { print $2 }')"))
 
-# move everything over to the boot medium
-#
-echo -en "\n$(date +'%F | %T | ')'\$0': Moving $TEMPDIR/* => $DOWNLOADPATH"
-mv $TEMPDIR/* $DOWNLOADPATH
-cleanup # FIXME ist dieses Cleanup gerechtfertigt oder macht es dummfoog?
-if [ -n "$NTFSROOT" ]; then
-	echo -en "\n$(date +'%F | %T | ')'\$0': NTFSROOT detected. Attempting to mount '/dev/disk/by-uuid/$NTFSROOT'."
-	if mount -t ntfs-3g -rw /dev/disk/by-uuid/$NTFSROOT /lib/live/mount/ntfsroot; then
-		echo -en "\n$(date +'%F | %T | ')'\$0': Mount successful."
+	ALLSYSTEMSROOT=$(dirname $RUNNINGSYSTEMFULLPATH)
+	RUNNINGSYSTEMNAME=$(basename $RUNNINGSYSTEMFULLPATH)
+	if [ "$RUNNINGSYSTEMNAME" = "X2Go-live1" ]; then
+		OTHERSYSTEMNAME="X2Go-live2"
+	elif [ "$RUNNINGSYSTEMNAME" = "X2Go-live2" ]; then
+		OTHERSYSTEMNAME="X2Go-live1"
 	else
-		echo -en "\n$(date +'%F | %T | ')'\$0': Failed to mount NTFSROOT."
+		[ -n "$NTFSROOT" ] && umount $MOUNTPOINT
+		echo -en "\n$(date +'%F | %T | ')'\$0': Unable to determine path/name of running system."
+		return 1
 	fi
-fi
+	OTHERSYSTEMFULLPATH=$(readlink -m "$ALLSYSTEMSROOT/$OTHERSYSTEMNAME")
+	DOWNLOADPATH=$(readlink -m "$ALLSYSTEMSROOT/X2Go-live-download/")
 
 
-# let's check if we just downloaded a copy of our running system
-#
-echo -en "\n$(date +'%F | %T | ')'\$0': Diff'ing '$DOWNLOADPATH' '$RUNNINGSYSTEMFULLPATH'"
-if diff -q $DOWNLOADPATH $RUNNINGSYSTEMFULLPATH >/dev/null && \
-	   [ -d "$OTHERSYSTEMFULLPATH" ] ; then
-	   [ -n "$NTFSROOT" ] && umount $MOUNTPOINT
-	   echo -en "\n$(date +'%F | %T | ')'\$0': Nothing to do. Content of $DOWNLOADPATH equals" \
-		"$RUNNINGSYSTEMNAME."
-		return 0 # current is newest, nothing to do, 
-			 # we want to keep the old system in OTHERSYSTEMFULLPATH
-			 # as a fallback
-fi
-
-
-# make sure our destination path really exists
-#
-mkdir -p $OTHERSYSTEMFULLPATH
+	# Now we'll copy the content of the X2Go-live-download folder to our tempdir
+	# this is so we can run wget in update mode (-N) or rsync without needing
+	# write access to our boot medium (write access means increased wear and tear,
+	# and we want to avoid that especially for media that has no wear-leveling
+	# like CF cards)
+	#
+	while ! rsync -aPv --inplace --modify-window=1 $DOWNLOADPATH/ $TEMPDIR; do
+		echo -en "\n$(date +'%F | %T | ')'\$0': Sleeping 30 seconds ..."
+		sleep 30
+		echo -en "\n$(date +'%F | %T | ')'\$0': Retrying ..."
+	done
 
 
-# let's check if our destination is already up to date or needs updating
-#
-echo -en "\n$(date +'%F | %T | ')'\$0': Diff'ing '$DOWNLOADPATH' '$OTHERSYSTEMFULLPATH'"
-if diff -q $DOWNLOADPATH $OTHERSYSTEMFULLPATH >/dev/null; then
+	# Now let's figure out if we're supposed to use wget or rsync for downloading
+	#
+	if echo "$DOWNLOADURL" | grep -q "^http" || \
+	   echo "$DOWNLOADURL" | grep -q "^ftp"
+	   then
+		# Attempt to determine available bandwidth & to set BWLIMIT accordingly
+		wget -Nr -o /tmp/dl.log -P /tmp/ -nd \
+			--progress=bar:force $DOWNLOADURL/x2go-tce-initrd.img 
+		cp --update "/tmp/x2go-tce-initrd.img" "$TEMPDIR"
+		rm "/tmp/x2go-tce-initrd.img"
+		SIZEFACTORSTRING=$(	awk -F' |\(|\)' ' $9 == "saved" && \
+					$7 == "-" { print $5 }' /tmp/dl.log | \
+					tail -1 \
+				   )
+		case $SIZEFACTORSTRING in
+			"" | \
+			[0-9]) 	echo -en "\n$(date +'%F | %T | ')'\$0': Not enough Bandwidth for update task - "
+				echo -n "aborting."
+				cleanup
+				return 0
+				;;
+			"KB/s") SIZEFACTOR=1;;
+			"MB/s") SIZEFACTOR=1024;;
+			"GB/s") SIZEFACTOR=1048576;;
+			*)     	SIZEFACTOR=$((1024*1024*1024));;
+		esac
+		DLRATE=$(	awk -F' |\(|\)' ' $9 == "saved" && $7 == "-" \
+				{ print $4 }' /tmp/dl.log | \
+				tail -1
+			 )
+		BWLIMIT=$(	echo "$DLRATE $SIZEFACTOR $BWLIMITPERCENT" | \
+				awk ' { print $1*$2*$3/100 }' | \
+				awk -F'.' '{ print $1 }' \
+			  ) # outputs integer kilobytes, not rounded
+		echo -en "\n$(date +'%F | %T | ')'\$0': Determined bandwidth limit: '$BWLIMIT KB/s'"
+		DOWNLOADCOMMAND="wget -Nr -l 1 -nd -P "$TEMPDIR" \
+				  --progress=bar:force \
+				  --limit-rate=${BWLIMIT}k $DOWNLOADURL"
+
+	elif echo "$DOWNLOADURL" | grep -q "^rsync"; then
+
+		rsync -hh -aPv -W --inplace --log-file=/tmp/dl.log $DOWNLOADURL/x2go-tce-initrd.img \
+			$TEMPDIR/x2go-tce-initrd.img.new
+		mv $TEMPDIR/x2go-tce-initrd.img.new $TEMPDIR/x2go-tce-initrd.img
+		SIZEFACTORSTRING=$(	sed -e's_\(. bytes/sec\)_ \1_' /tmp/dl.log | \
+					awk '$4 == "sent" && $12 == "bytes/sec" \
+					{ print $11 }' \
+				   )
+		case $SIZEFACTORSTRING in
+			"" | \
+			[0-9]) 	echo -en "\n$(date +'%F | %T | ')'\$0': Not enough Bandwidth for update task - "
+				echo -n "aborting."
+				cleanup
+				return 0
+				;;
+			"K")   	SIZEFACTOR=1;;
+			"M")   	SIZEFACTOR=1024;;
+			"G")   	SIZEFACTOR=$((1024*1024));;
+			*)     	SIZEFACTOR=$((1024*1024*1024));;
+		esac
+		DLRATE=$(	sed -e's_\(. bytes/sec\)_ \1_' /tmp/dl.log | \
+				awk '$4 == "sent" && $12 == "bytes/sec" \
+				{ print $10 }')
+		BWLIMIT=$(	echo "$DLRATE $SIZEFACTOR $BWLIMITPERCENT" | \
+				awk ' { print $1*$2*$3/100 }' | \
+				awk -F'.' '{ print $1 }' \
+			  ) # outputs integer kilobytes, not rounded
+		echo -en "\n$(date +'%F | %T | ')'\$0': Determined bandwidth limit: '$BWLIMIT KB/s'"
+		DOWNLOADCOMMAND="rsync -aPv --inplace --bwlimit=$BWLIMIT $DOWNLOADURL/ \
+				  $TEMPDIR"
+	else 
 		[ -n "$NTFSROOT" ] && umount $MOUNTPOINT
-		echo -en "\n$(date +'%F | %T | ')'\$0': Nothing to do - content of '$DOWNLOADPATH' equals"\
-		      "'$OTHERSYSTEMNAME'."
-		return 0 # OTHERSYSTEMFULLPATH is already up to date
-else
-	# keep rsyncing until the update is complete
-	echo -en "\n$(date +'%F | %T | ')'\$0': Copying $DOWNLOADPATH/ => $OTHERSYSTEMFULLPATH"
-	while ! rsync -aPv --inplace --modify-window=1 $DOWNLOADPATH/ $OTHERSYSTEMFULLPATH
-		do
+		echo -en "\n$(date +'%F | %T | ')'\$0': Unsupported download mechanism - aborting."
+		return 1
+	fi
+	rm /tmp/dl.log
+
+
+	# Proceed to download from update location
+	#
+	while ! $DOWNLOADCOMMAND; do
 		echo -en "\n$(date +'%F | %T | ')'\$0': Sleeping 30 seconds ..."
 		sleep 30
 		echo -en "\n$(date +'%F | %T | ')'\$0': Retrying ..."
 	done
-fi
 
+	# Now check if these files are different from what we already have in our
+	# download directory on the boot medium
+	#
+	echo -en "\n$(date +'%F | %T | ')'\$0': Diff'ing '$DOWNLOADPATH' '$TEMPDIR' ..."
+	if diff -q $DOWNLOADPATH $TEMPDIR \
+		>/dev/null
+
+		then
+		cleanup
+		echo -en "\n$(date +'%F | %T | ')'\$0': Nothing to do. - Files on server not newer than '$DOWNLOADPATH'."
+		return 0 	# current is newest, nothing to do, we want to avoid
+				# unneccessary writes to the medium
+	else
+		echo -en "\n$(date +'%F | %T | ')'\$0': Differences detected. Continuing ..."
+	fi
 
-# change default boot to the image we just downloaded and installed
-#
-if [ -n "$SYSLINUXPATH" ]; then
-	echo -en "\n$(date +'%F | %T | ')'\$0': Changing syslinux default to $OTHERSYSTEMNAME."
-	sed -i -e"/^default/cdefault $OTHERSYSTEMNAME" \
-		$SYSLINUXPATH/syslinux.cfg
-
-elif [ -n "$GRUBPATH" ]; then
-	MENULST=$GRUBPATH/menu.lst
-	CURRENTDEFAULT=$(awk '/^default/ { print $2 }' $MENULST | tr -d '\r')
-	CURRENTTITLEPOSITION=$(grep '^title' $MENULST | 
-                               grep -n "${RUNNINGSYSTEMNAME}" |
-                               awk -F':' '$2 ~ /'"${RUNNINGSYSTEMNAME}"'/ { print $1 }')
-	CURRENTTITLEPOSITION=$((CURRENTTITLEPOSITION-1))
-	OTHERTITLEPOSITION=$(grep '^title' $MENULST |
-                             grep -n "${OTHERSYSTEMNAME}" |
-                             awk -F':' '$2 ~ /'"${OTHERSYSTEMNAME}"'/ { print $1 }')
-	OTHERTITLEPOSITION=$((OTHERTITLEPOSITION-1))
-	if [ "$CURRENTTITLEPOSITION" = "$CURRENTDEFAULT" ]; then
-		echo -en "\n$(date +'%F | %T | ')'\$0': Changing GRUB-legacy default to $OTHERTITLEPOSITION ..."
-		sed -i -e"/^default/cdefault $OTHERTITLEPOSITION" \
-			$MENULST
+
+	# If we made it past that point, it's time to update the boot medium, so let's
+	# remount it rw and async for speed
+	#
+	if mount -oremount,rw,async $MOUNTPOINT; then
+		echo -en "\n$(date +'%F | %T | ')'\$0': Remounted '$MOUNTPOINT' as rw and async."
 	else
-		echo -en "\n$(date +'%F | %T | ')'\$0': Not changing GRUB-legacy default."
-		echo -en "\n$(date +'%F | %T | ')'\$0': Reason: We're at boot position '$CURRENTTITLEPOSITION',"
-		echo -en "\n$(date +'%F | %T | ')'\$0': while default is set to position '$CURRENTDEFAULT'."
+		echo -en "\n$(date +'%F | %T | ')'\$0': Could not remount '$MOUNTPOINT' as rw and async."
 	fi
-else
-	echo -en "\n$(date +'%F | %T | ')'\$0': Unsupported bootloader."
-fi
 
-# we're on an async mount point, so let's sync to be safe
-#
-sync
 
+	# Now, we don't want to copy an index.htm(l) file, so let's do away with that
+	#
+	rm -f $TEMPDIR/index.ht*
 
-# umount tempdir to free memory
-#
-if [ -d $TEMPDIR ]; then
-	cleanup
-fi
+
+	# move everything over to the boot medium
+	#
+	echo -en "\n$(date +'%F | %T | ')'\$0': Moving $TEMPDIR/* => $DOWNLOADPATH"
+	mv $TEMPDIR/* $DOWNLOADPATH
+	cleanup # FIXME ist dieses Cleanup gerechtfertigt oder macht es dummfoog?
+	if [ -n "$NTFSROOT" ]; then
+		echo -en "\n$(date +'%F | %T | ')'\$0': NTFSROOT detected. Attempting to mount '/dev/disk/by-uuid/$NTFSROOT'."
+		if mount -t ntfs-3g -rw /dev/disk/by-uuid/$NTFSROOT /lib/live/mount/ntfsroot; then
+			echo -en "\n$(date +'%F | %T | ')'\$0': Mount successful."
+		else
+			echo -en "\n$(date +'%F | %T | ')'\$0': Failed to mount NTFSROOT."
+		fi
+	fi
 
 
-# now, change mount back to ro and sync
-#
-if [ -n "$NTFSROOT" ]; then
-	if umount $MOUNTPOINT; then
-		echo -en "\n$(date +'%F | %T | ')'\$0': Unmounted '$MOUNTPOINT'."
+	# let's check if we just downloaded a copy of our running system
+	#
+	echo -en "\n$(date +'%F | %T | ')'\$0': Diff'ing '$DOWNLOADPATH' '$RUNNINGSYSTEMFULLPATH'"
+	if diff -q $DOWNLOADPATH $RUNNINGSYSTEMFULLPATH >/dev/null && \
+		   [ -d "$OTHERSYSTEMFULLPATH" ] ; then
+		   [ -n "$NTFSROOT" ] && umount $MOUNTPOINT
+		   echo -en "\n$(date +'%F | %T | ')'\$0': Nothing to do. Content of $DOWNLOADPATH equals" \
+			"$RUNNINGSYSTEMNAME."
+			return 0 # current is newest, nothing to do, 
+				 # we want to keep the old system in OTHERSYSTEMFULLPATH
+				 # as a fallback
+	fi
+
+
+	# make sure our destination path really exists
+	#
+	mkdir -p $OTHERSYSTEMFULLPATH
+
+
+	# let's check if our destination is already up to date or needs updating
+	#
+	echo -en "\n$(date +'%F | %T | ')'\$0': Diff'ing '$DOWNLOADPATH' '$OTHERSYSTEMFULLPATH'"
+	if diff -q $DOWNLOADPATH $OTHERSYSTEMFULLPATH >/dev/null; then
+			[ -n "$NTFSROOT" ] && umount $MOUNTPOINT
+			echo -en "\n$(date +'%F | %T | ')'\$0': Nothing to do - content of '$DOWNLOADPATH' equals"\
+			      "'$OTHERSYSTEMNAME'."
+			return 0 # OTHERSYSTEMFULLPATH is already up to date
 	else
-		echo -en "\n$(date +'%F | %T | ')'\$0': Unable to unmount '$MOUNTPOINT'."
+		# keep rsyncing until the update is complete
+		echo -en "\n$(date +'%F | %T | ')'\$0': Copying $DOWNLOADPATH/ => $OTHERSYSTEMFULLPATH"
+		while ! rsync -aPv --inplace --modify-window=1 $DOWNLOADPATH/ $OTHERSYSTEMFULLPATH
+			do
+			echo -en "\n$(date +'%F | %T | ')'\$0': Sleeping 30 seconds ..."
+			sleep 30
+			echo -en "\n$(date +'%F | %T | ')'\$0': Retrying ..."
+		done
 	fi
-else	
-	if mount -oremount,ro,sync $MOUNTPOINT; then
-		echo -en "\n$(date +'%F | %T | ')'\$0': Remounted '$MOUNTPOINT' ro and sync."
+
+
+	# change default boot to the image we just downloaded and installed
+	#
+	if [ -n "$SYSLINUXPATH" ]; then
+		echo -en "\n$(date +'%F | %T | ')'\$0': Changing syslinux default to $OTHERSYSTEMNAME."
+		sed -i -e"/^default/cdefault $OTHERSYSTEMNAME" \
+			$SYSLINUXPATH/syslinux.cfg
+
+	elif [ -n "$GRUBPATH" ]; then
+		MENULST=$GRUBPATH/menu.lst
+		CURRENTDEFAULT=$(awk '/^default/ { print $2 }' $MENULST | tr -d '\r')
+		CURRENTTITLEPOSITION=$(grep '^title' $MENULST | 
+				       grep -n "${RUNNINGSYSTEMNAME}" |
+				       awk -F':' '$2 ~ /'"${RUNNINGSYSTEMNAME}"'/ { print $1 }')
+		CURRENTTITLEPOSITION=$((CURRENTTITLEPOSITION-1))
+		OTHERTITLEPOSITION=$(grep '^title' $MENULST |
+				     grep -n "${OTHERSYSTEMNAME}" |
+				     awk -F':' '$2 ~ /'"${OTHERSYSTEMNAME}"'/ { print $1 }')
+		OTHERTITLEPOSITION=$((OTHERTITLEPOSITION-1))
+		if [ "$CURRENTTITLEPOSITION" = "$CURRENTDEFAULT" ]; then
+			echo -en "\n$(date +'%F | %T | ')'\$0': Changing GRUB-legacy default to $OTHERTITLEPOSITION ..."
+			sed -i -e"/^default/cdefault $OTHERTITLEPOSITION" \
+				$MENULST
+		else
+			echo -en "\n$(date +'%F | %T | ')'\$0': Not changing GRUB-legacy default."
+			echo -en "\n$(date +'%F | %T | ')'\$0': Reason: We're at boot position '$CURRENTTITLEPOSITION',"
+			echo -en "\n$(date +'%F | %T | ')'\$0': while default is set to position '$CURRENTDEFAULT'."
+		fi
 	else
-		echo -en "\n$(date +'%F | %T | ')'\$0': Unable to remount '$MOUNTPOINT' ro and sync."
+		echo -en "\n$(date +'%F | %T | ')'\$0': Unsupported bootloader."
+	fi
+
+	# we're on an async mount point, so let's sync to be safe
+	#
+	sync
+
+
+	# umount tempdir to free memory
+	#
+	if [ -d $TEMPDIR ]; then
+		cleanup
+	fi
+
+
+	# now, change mount back to ro and sync
+	#
+	if [ -n "$NTFSROOT" ]; then
+		if umount $MOUNTPOINT; then
+			echo -en "\n$(date +'%F | %T | ')'\$0': Unmounted '$MOUNTPOINT'."
+		else
+			echo -en "\n$(date +'%F | %T | ')'\$0': Unable to unmount '$MOUNTPOINT'."
+		fi
+	else	
+		if mount -oremount,ro,sync $MOUNTPOINT; then
+			echo -en "\n$(date +'%F | %T | ')'\$0': Remounted '$MOUNTPOINT' ro and sync."
+		else
+			echo -en "\n$(date +'%F | %T | ')'\$0': Unable to remount '$MOUNTPOINT' ro and sync."
+		fi
 	fi
-fi
 
 ) &
 
diff --git a/config/includes.chroot/lib/live/config/2600-tcpprint b/config/includes.chroot/lib/live/config/2600-tcpprint
index a2b1355..1da6e7b 100755
--- a/config/includes.chroot/lib/live/config/2600-tcpprint
+++ b/config/includes.chroot/lib/live/config/2600-tcpprint
@@ -25,6 +25,11 @@ if grep -q "\W*tcpprint\W*" /proc/cmdline ; then
 		sleep 30
 	done
 
+	while ! [ -c /dev/tty8 ] ; do
+		echo -en "\n\$(date +'%F | %T | ')'\$0' is waiting for tty8 to become available."
+		sleep 2
+	done
+
 	PRINTERDEVICES=""
 	[ -d /dev/usb ] && PRINTERDEVICES=$(find /dev/usb -type c -name "lp*" | sort)
 	PRINTERDEVICES="$PRINTERDEVICES $(find /dev/ -maxdepth 1 -type c -name "lp*" | sort)"
diff --git a/config/includes.chroot/lib/live/config/2700-x2go-getsessions b/config/includes.chroot/lib/live/config/2700-x2go-getsessions
index bd59a57..ebbb3c0 100755
--- a/config/includes.chroot/lib/live/config/2700-x2go-getsessions
+++ b/config/includes.chroot/lib/live/config/2700-x2go-getsessions
@@ -22,29 +22,35 @@ if [ "$METHOD" = loopback ]; then
         exit 0
 fi
 
-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
-if echo "$SESSIONSURL" | grep -q "^tftp://" ; then
-	SESSIONSSERVER=$(echo "$SESSIONSURL" | sed 's#^tftp://\([^/]*\)/.*$#\1#' )
-	SESSIONSPATH=$(echo "$SESSIONSURL" | sed 's#^tftp://[^/]*/\(.*\)$#\1#' )
-	if [ -n "\$SESSIONSSERVER" ] && [ -n "\$SESSIONSPATH" ] ; then
-		while ! atftp \$SESSIONSSERVER -g -r \$SESSIONSPATH -l $SESSIONSDESTINATION ; do
+(
+	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
+	if echo "$SESSIONSURL" | grep -q "^tftp://" ; then
+		SESSIONSSERVER=$(echo "$SESSIONSURL" | sed 's#^tftp://\([^/]*\)/.*$#\1#' )
+		SESSIONSPATH=$(echo "$SESSIONSURL" | sed 's#^tftp://[^/]*/\(.*\)$#\1#' )
+		if [ -n "\$SESSIONSSERVER" ] && [ -n "\$SESSIONSPATH" ] ; then
+			while ! atftp \$SESSIONSSERVER -g -r \$SESSIONSPATH -l $SESSIONSDESTINATION ; do
+				echo -en "\n\$(date +'%F | %T | ')Waiting for session config data ..." | tee -a /dev/tty8
+				sleep 5
+			done
+		fi
+	else
+		while ! wget -q -O $SESSIONSDESTINATION $SESSIONSURL ; do
 			echo -en "\n\$(date +'%F | %T | ')Waiting for session config data ..." | tee -a /dev/tty8
-			sleep 5
+			sleep 5 
 		done
 	fi
-else
-	while ! wget -q -O $SESSIONSDESTINATION $SESSIONSURL ; do
-		echo -en "\n\$(date +'%F | %T | ')Waiting for session config data ..." | tee -a /dev/tty8
-		sleep 5 
-	done
-fi
 
-if [ -s $SESSIONSDESTINATION ] ; then
-	mv $SESSIONSDESTINATION /etc/x2go/x2gothinclient_sessions
-fi
+	if [ -s $SESSIONSDESTINATION ] ; then
+		mv $SESSIONSDESTINATION /etc/x2go/x2gothinclient_sessions
+	fi
+) &
 GETSESS
 		chmod 755 /etc/network/if-up.d/0400-getsessions
 	fi

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