[X2Go-Commits] [live-build-x2go] 72/160: inserted proper umount/remount_ro -> moved into subroutine, as req'd in two places

git-admin at x2go.org git-admin at x2go.org
Sat Nov 18 01:55:44 CET 2017


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 a910baf173e4ccba378d5ada61f51b11660feb25
Author: Stefan Baur (BAUR-ITCS) <kontakt at baur-itcs.de>
Date:   Mon Jul 24 19:21:19 2017 +0200

    inserted proper umount/remount_ro -> moved into subroutine, as req'd in two places
---
 .../lib/live/config/2400-live-autoupdate           | 41 +++++++++++++---------
 1 file changed, 25 insertions(+), 16 deletions(-)

diff --git a/config/includes.chroot/lib/live/config/2400-live-autoupdate b/config/includes.chroot/lib/live/config/2400-live-autoupdate
index b736ade..22e2778 100755
--- a/config/includes.chroot/lib/live/config/2400-live-autoupdate
+++ b/config/includes.chroot/lib/live/config/2400-live-autoupdate
@@ -2,6 +2,28 @@
 
 # this is not /bin/bash, so "echo -en" is not supported, but the default when calling "echo"
 
+umount_or_remount_ro ()
+{# change mount back to ro and sync
+	#
+	if [ -n "$NTFSROOT" ]; then
+		if umount $MOUNTPOINT; then
+			echo "\n$(date +'%F | %T | ')'$0': Unmounted '$MOUNTPOINT'."
+		else
+			echo "\n$(date +'%F | %T | ')'$0': Unable to unmount '$MOUNTPOINT'."
+		fi
+	else	
+		if mount -oremount,ro,sync $MOUNTPOINT; then
+			echo "\n$(date +'%F | %T | ')'$0': Remounted '$MOUNTPOINT' ro and sync."
+		else
+			echo "\n$(date +'%F | %T | ')'$0': Unable to remount '$MOUNTPOINT' ro and sync."
+		fi
+		if [ -n "$RAMDISKMODE" ] ; then
+			umount $MOUNTPOINT
+		fi
+	fi
+
+}
+
 cleanup () 
 { # discard contents of tmpfs, umount if necessary
 	if [ -n "$NTFSROOT" ]; then
@@ -377,6 +399,8 @@ echo -n " live-autoupdater (backgrounding update task)"
 		   [ -n "$NTFSROOT" ] && umount $MOUNTPOINT
 		   echo "\n$(date +'%F | %T | ')'$0': Nothing to do. Content of $DOWNLOADPATH equals" \
 			"$RUNNINGSYSTEMNAME."
+			# now, change mount back to ro and sync
+			umount_or_remount_ro
 			return 0 # current is newest, nothing to do, 
 				 # we want to keep the old system in OTHERSYSTEMFULLPATH
 				 # as a fallback
@@ -453,22 +477,7 @@ echo -n " live-autoupdater (backgrounding update task)"
 
 	# now, change mount back to ro and sync
 	#
-	if [ -n "$NTFSROOT" ]; then
-		if umount $MOUNTPOINT; then
-			echo "\n$(date +'%F | %T | ')'$0': Unmounted '$MOUNTPOINT'."
-		else
-			echo "\n$(date +'%F | %T | ')'$0': Unable to unmount '$MOUNTPOINT'."
-		fi
-	else	
-		if mount -oremount,ro,sync $MOUNTPOINT; then
-			echo "\n$(date +'%F | %T | ')'$0': Remounted '$MOUNTPOINT' ro and sync."
-		else
-			echo "\n$(date +'%F | %T | ')'$0': Unable to remount '$MOUNTPOINT' ro and sync."
-		fi
-		if [ -n "$RAMDISKMODE" ] ; then
-			umount $MOUNTPOINT
-		fi
-	fi
+	umount_or_remount_ro
 
 ) &
 

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