[X2Go-Commits] [x2gothinclient] 01/02: management/share/etc/x2gothinclient_init.d/010_x2gothinclient-fresh-home - Make this file check for the presence of a sessions file before continuing (a NO-OP on X2Go-TCE-NFS, but required on X2Go-TCE-Live, where it would create a race condition). Also, do not create a Desktop or Autostart link for X2GoClient if there is no sessions file (the lack of which makes a locked-down, read-only X2GoClient like the one that is the default in Minidesktop unusable)

git-admin at x2go.org git-admin at x2go.org
Wed Jan 31 17:30:40 CET 2024


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

x2go pushed a commit to branch master
in repository x2gothinclient.

commit b0263244b371ceaa0c4a899f0d4c966d8d178f43
Author: Stefan Baur <x2go-ml-1 at baur-itcs.de>
Date:   Mon Jan 29 19:39:52 2024 +0000

    management/share/etc/x2gothinclient_init.d/010_x2gothinclient-fresh-home - Make this file check for the presence of a sessions file before continuing (a NO-OP on X2Go-TCE-NFS, but required on X2Go-TCE-Live, where it would create a race condition). Also, do not create a Desktop or Autostart link for X2GoClient if there is no sessions file (the lack of which makes a locked-down, read-only X2GoClient like the one that is the default in Minidesktop unusable)
---
 .../010_x2gothinclient-fresh-home                  | 35 +++++++++++++++++-----
 1 file changed, 28 insertions(+), 7 deletions(-)

diff --git a/management/share/etc/x2gothinclient_init.d/010_x2gothinclient-fresh-home b/management/share/etc/x2gothinclient_init.d/010_x2gothinclient-fresh-home
index fd12e7b..349e38e 100755
--- a/management/share/etc/x2gothinclient_init.d/010_x2gothinclient-fresh-home
+++ b/management/share/etc/x2gothinclient_init.d/010_x2gothinclient-fresh-home
@@ -1,9 +1,10 @@
 #!/bin/bash
 
-# Copyright (C) 2010-2019 by X2Go project, https://wiki.x2go.org
+# Copyright (C) 2010-2024 by X2Go project, https://wiki.x2go.org
 #       Oleksandr Shneyder <o.shneyder at phoca-gmbh.de>
 #       Moritz 'Morty' Struebe <Moritz.Struebe at informatik.uni-erlangen.de>
 #       Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
+#       Stefan Baur <X2Go-ML-1 at baur-itcs.de>
 
 # X2Go is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -23,9 +24,33 @@
 if [ -z "$X2GO_HANDLE_DAEMONS" ]; then
 	mkdir -p ~x2gothinclient
 	mkdir -p ~x2gothinclient/.x2goclient
+
+	# if the /etc/x2go/x2gothinclient_sessions download is still in progress
+	# (/etc/x2go/x2gothinclient_sessions_old exists, but no /etc/x2go/x2gothinclient_sessions exists yet),
+	# print a timestamped "in progress" notification to the debug log console window on /dev/tty8
+	# and wait one second, then check again (else we would trigger a race condition as to who gets to write the config file first)
+	# note that this will not in any way affect TCE-NFS or any TCE where /etc/x2go/x2gothinclient_sessions is a static file (i.e.
+	# where it has been included in the squashfs filesystem), because no file /etc/x2go/x2gothinclient_sessions_old SHOULD exist there.
+	# if this is a problem, we could consider moving *_old to /var/tmp/x2go/ instead, but that would make it harder to find.
+	while [ -e /etc/x2go/x2gothinclient_sessions_old ] && ! [ -e /etc/x2go/x2gothinclient_sessions ] ; do
+		echo -en "\n\$(date +'%F | %T | ') waiting for session config data download to finish ..." | tee -a /dev/tty8
+		sleep 1
+	done
+
+	# if/once /etc/x2go/x2gothinclient_sessions exists, copy it over
 	if [ -e /etc/x2go/x2gothinclient_sessions ]; then
-		 cp /etc/x2go/x2gothinclient_sessions ~x2gothinclient/.x2goclient/sessions
+		cp /etc/x2go/x2gothinclient_sessions ~x2gothinclient/.x2goclient/sessions
+
+		# if there's no sessions file, it does not make sense to add this link to the Desktop, so check that first,
+		# and only then check if the desktop file exists in autostart
+		if [ -e /etc/xdg/autostart/x2gothinclient-minidesktop.desktop ]; then
+			mkdir -p ~x2gothinclient/Desktop
+			cp /etc/xdg/autostart/x2gothinclient-minidesktop.desktop ~x2gothinclient/Desktop/
+			# newer MATE versions require *.desktop files to be executable, else there will be a warning/confirmation popup
+			chmod 700 ~x2gothinclient/Desktop/x2gothinclient-minidesktop.desktop
+		fi
 	fi
+
 	if [ -e /etc/x2go/freerdp/known_hosts ]; then
 		mkdir -p ~x2gothinclient/.freerdp
 		cp /etc/x2go/freerdp/known_hosts ~x2gothinclient/.freerdp/known_hosts
@@ -34,11 +59,7 @@ if [ -z "$X2GO_HANDLE_DAEMONS" ]; then
 		mkdir -p ~x2gothinclient/.config/freerdp
 		cp /etc/x2go/freerdp/known_hosts2 ~x2gothinclient/.config/freerdp/known_hosts2
 	fi
-	if [ -e /etc/xdg/autostart/x2gothinclient-minidesktop.desktop ]; then
-		mkdir -p ~x2gothinclient/Desktop
-		cp /etc/xdg/autostart/x2gothinclient-minidesktop.desktop ~x2gothinclient/Desktop/
-		chmod 0700 ~x2gothinclient/Desktop/x2gothinclient-minidesktop.desktop
-	fi
+
 	mkdir -p ~x2gothinclient/.kde
 	mkdir -p ~x2gothinclient/.kde/socket-`hostname`
 	mkdir -p ~x2gothinclient/mounts

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


More information about the x2go-commits mailing list