Hello,

find attached the following patches for bin/x2goumount-session script:

0001: the DESKTOP file for shares of /cygwin/C:/some/path got not
removed due to redundant "/cygwin/" string.

0002: the $HOME/media or $HOME/media/${USER}_media symlink got not
removed after session end.

0003: the /tmp/${USER}_media mount points tree got not removed after
session end.

I am not sure about the latter two patches - could they create some
problems in case the user has two paralel sessions active? (Can it even
happen?)

Will you please review and possibly commit to git?

Regards,
Milan
-- 
http://www.milan-knizek.net/
About linux and photography (Czech only)
O linuxu a fotografování
>From 802aec3b649105af0856cfd4cd91103dab41701d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Milan=20Kn=C3=AD=C5=BEek?= <kni...@volny.cz>
Date: Fri, 10 Feb 2012 11:04:08 +0100
Subject: [PATCH 1/3] Fix removal of DESKTOP file for MS Windows shared
 directories.

---
 x2goserver/bin/x2goumount-session |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/x2goserver/bin/x2goumount-session b/x2goserver/bin/x2goumount-session
index 46befc8..d07f88e 100755
--- a/x2goserver/bin/x2goumount-session
+++ b/x2goserver/bin/x2goumount-session
@@ -123,6 +123,7 @@ break:
 	}
 	if (! $found)
 	{
+		$remote=~s/\/cygdrive\///g;
 		$remote=~s/\//_/g;
 		$remote=(split(":","$remote"))[1];
 		$remote="$ENV{'HOME'}/Desktop/$remote";
-- 
1.7.9

>From a1c71810f20437fe74eb31cc7ae35f054f2a6943 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Milan=20Kn=C3=AD=C5=BEek?= <kni...@volny.cz>
Date: Fri, 10 Feb 2012 11:13:37 +0100
Subject: [PATCH 2/3] Fix removal of symlink in $HOME directory.

---
 x2goserver/bin/x2goumount-session |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/x2goserver/bin/x2goumount-session b/x2goserver/bin/x2goumount-session
index d07f88e..8f5258a 100755
--- a/x2goserver/bin/x2goumount-session
+++ b/x2goserver/bin/x2goumount-session
@@ -38,6 +38,7 @@ my $session=shift;
 my $only_path=shift;
 my $uname=$ENV{'USER'};
 my $serv=hostname;
+my $ldir="$ENV{'HOME'}/media";
 
 if ($only_path)
 {
@@ -159,6 +160,16 @@ break:
 	}
 cont:
 }
+if ( -l "$ldir")
+{
+	syslog('info', "removing symlink ,,$ldir''");
+	unlink("$ldir");
+}
+elsif ( -l "$ldir/$uname\_media")
+{
+	syslog('info', "removing symlink ,,$ldir/$uname\_media''");
+	unlink("$ldir/$uname\_media");
+}
 
 # closing syslog 
 closelog;
-- 
1.7.9

>From facfa66f4826ad7b2d2bf7882d1a46fceb5320aa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Milan=20Kn=C3=AD=C5=BEek?= <kni...@volny.cz>
Date: Fri, 10 Feb 2012 11:15:41 +0100
Subject: [PATCH 3/3] fix removal of /tmp/${USER}_media mount points.

---
 x2goserver/bin/x2goumount-session |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/x2goserver/bin/x2goumount-session b/x2goserver/bin/x2goumount-session
index 8f5258a..54a6d72 100755
--- a/x2goserver/bin/x2goumount-session
+++ b/x2goserver/bin/x2goumount-session
@@ -171,6 +171,15 @@ elsif ( -l "$ldir/$uname\_media")
 	unlink("$ldir/$uname\_media");
 }
 
+foreach $i ("/tmp/$uname\_media/cd", "/tmp/$uname\_media/disk", "/tmp/$uname\_media/rm", "/tmp/$uname\_media")
+{
+	if ( -d "$i")
+	{
+		syslog('info', "removing mount point ,,$i''");
+		rmdir ("$i");
+	}
+}
+
 # closing syslog 
 closelog;
 
-- 
1.7.9

_______________________________________________
X2Go-Dev mailing list
X2Go-Dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/x2go-dev

Reply via email to