This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2gothinclient. commit 3415fafa35ec8c0215c4e61b8330d679d3cf25d1 Author: Stefan Baur <X2Go-ML-1@baur-itcs.de> Date: Thu Jan 17 05:47:11 2019 +0100 usbmount/x2gousbmount: pull (most) changes from doc:howto:tce wiki page. --- debian/changelog | 5 ++++ usbmount/x2gousbmount | 72 +++++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 63 insertions(+), 14 deletions(-) diff --git a/debian/changelog b/debian/changelog index f083c8b..888b59a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,11 @@ x2gothinclient (1.5.0.1-0x2go1) UNRELEASED; urgency=medium - management/etc/x2gothinclient_settings: remove heuler from apt line. - management/etc/x2gothinclient_settings: add "extras" component. + [ Stefan Baur ] + * New upstream release (1.5.0.1): + * usbmount/x2gousbmount: + - Pull (most) changes from doc:howto:tce wiki page. + -- X2Go Release Manager <git-admin@x2go.org> Sun, 02 Dec 2018 06:49:42 +0100 x2gothinclient (1.5.0.0-0x2go1) unstable; urgency=low diff --git a/usbmount/x2gousbmount b/usbmount/x2gousbmount index 946fe72..131a513 100755 --- a/usbmount/x2gousbmount +++ b/usbmount/x2gousbmount @@ -20,7 +20,16 @@ use strict; use File::Path::Expand; +# comment out this "use" and the following two lines, and instead +# uncomment the block below if you need to do early boot stage +# debugging of the automounter, when rsyslogd isn't running yet use Sys::Syslog qw( :standard :macros ); +openlog($0, 'cons,pid', 'user'); +setlogmask(LOG_UPTO(LOG_NOTICE)); +#open (B, ">> /var/log/usbdebug"); +#sub syslog { +# print B $_[0] . ': ' . $_[1] . "\n"; +#} my $user; if ( -f "/etc/x2go/x2gothinclient-minidesktop_start" ) { @@ -70,9 +79,6 @@ unless ( -d expand_filename("~$user/logins")) { chown $uid, $gid, expand_filename("~$user/logins"); } -openlog($0,'cons,pid','user'); -setlogmask( LOG_UPTO(LOG_NOTICE) ); - sub check_x2gothinclientmode { my $ret = 0; @@ -94,8 +100,10 @@ sub check_x2gothinclientmode { return $ret; } -if ( check_x2gothinclientmode() || ( -x "/etc/x2go/x2gothinclient-minidesktop_start" ) ) +# TCE-NFS TCE-Live MMD-Live +if ((check_x2gothinclientmode()) || (-x "/lib/live/config/2900-x2go-thinclientconfig") || (-x "/etc/x2go/x2gothinclient-minidesktop_start")) { + syslog('notice', "some kind of thinclient mode detected"); open (F,">>/var/log/usb"); @@ -127,7 +135,12 @@ if ( check_x2gothinclientmode() || ( -x "/etc/x2go/x2gothinclient-minidesktop_st mkdir("/media/$name"); print F "$name\n"; - if ( $action eq "add") + if (`lsblk -ln -oRM $dev` =~ /0$/) { + syslog('notice', "device is non-removable device, skipping"); + exit 0; + } + + if ( $action eq "add" ) { ### @@ -149,16 +162,26 @@ if ( check_x2gothinclientmode() || ( -x "/etc/x2go/x2gothinclient-minidesktop_st # would only cause a mount of the iso9660 raw device, # blocking the mount of individual partitions # real optical media ->x2gocdmanager/x2gothinclient-cdmanager package - if(system("mount -tvfat,ntfs $dev /media/$name/$ldev -o uid=$user,sync,uni_xlate")==0) + + if (system("mount -tntfs $dev /media/$name/$ldev -o uid=$user,sync,uni_xlate") == 0) { - syslog('notice', "USB device $name ($ldev) successfully mounted (probably vfat or ntfs)"); + syslog('notice', "USB device $name ($ldev) successfully mounted (ntfs detected)"); # if mounted, inform x2goclient about it... system("touch $mntdir/$ldev.mounted"); open (D,">",expand_filename("~$user/export/$name.$ldev")); print D "export=/media/$name/$ldev\n"; close (D); } - elsif(system("mount -t hfs $dev /media/$name/$ldev -o uid=$user,sync")==0) + elsif (system("mount -tvfat $dev /media/$name/$ldev -o uid=$user,sync,uni_xlate") == 0) + { + syslog('notice', "USB device $name ($ldev) successfully mounted (vfat detected)"); + # if mounted, inform x2goclient about it... + system("touch $mntdir/$ldev.mounted"); + open (D, ">", expand_filename("~$user/export/$name.$ldev")); + print D "export=/media/$name/$ldev\n"; + close (D); + } + elsif (system("mount -t hfs $dev /media/$name/$ldev -o uid=$user,sync") == 0) { syslog('notice', "USB device $name ($ldev) successfully mounted (hfs detected)"); # if mounted, inform x2goclient about it... @@ -176,10 +199,7 @@ if ( check_x2gothinclientmode() || ( -x "/etc/x2go/x2gothinclient-minidesktop_st print D "export=/media/$name/$ldev\n"; close (D); } - # We use fuseext2 for read-only EXT* mounts since this driver does not - # check the usual file permission hierarchy and allows (read-only) - # access to any file on the file system. - elsif(system("fuseext2 $dev /media/$name/$ldev -o ro")==0) + elsif (system("fuseext2 $dev /media/$name/$ldev -o ro,allow_other") == 0) { syslog('notice', "USB device $name ($ldev) successfully mounted readonly (ext*fs detected)"); # if mounted, inform x2goclient about it... @@ -206,11 +226,13 @@ if ( check_x2gothinclientmode() || ( -x "/etc/x2go/x2gothinclient-minidesktop_st open (D,">",expand_filename("~$user/logins/$name.$ldev")); print D "login=/media/$name/$ldev\n"; close (D); + print F "encrypted mount successful ($ldev)\n"; } else { # on mount failures release the decrypted device again system("/sbin/cryptsetup luksClose keystick"); + print F "mount failed ($ldev)\n"; } } else @@ -218,6 +240,21 @@ if ( check_x2gothinclientmode() || ( -x "/etc/x2go/x2gothinclient-minidesktop_st print F "cryptodisk already present\n"; } } + if (-e "/media/$name/$ldev") { + print F "detected mountpoint '/media/$name/$ldev'\n"; + print F "running '/sbin/blkid -o value -s LABEL $dev'\n"; + my $label = `/sbin/blkid -o value -s LABEL $dev`; + chomp($label); + if ($label) { + print F "symlinking '/media/$name/$ldev' and '/media/$name/$label'\n"; + unlink "/media/$name/$label" if ( -l "/media/$name/$label" ); + symlink("/media/$name/$ldev", "/media/$name/$label"); + open (D, ">>", expand_filename("~$user/export/$name.$ldev")); + print D "export=/media/$name/$label\n"; + close (D); + } + } + } elsif ( $action eq "remove" ) { @@ -234,8 +271,13 @@ if ( check_x2gothinclientmode() || ( -x "/etc/x2go/x2gothinclient-minidesktop_st # inform x2goclient that the device has been removed system ("umount -ff /media/$name/$ldev"); unlink ("$mntdir/$ldev.mounted"); - open ( D,">",expand_filename("~$user/export/$name.$ldev.unexport")); - print D "unexport=/media/$name/$ldev\n"; + open (D, ">", expand_filename("~$user/export/$name.$ldev.unexport")); + open (I, "<", expand_filename("~$user/export/$name.$ldev")); + while (<I>) { + $_ =~ s/^export=/unexport=/i; + print D $_; + } + close (I); close (D); syslog('notice', "USB device $name ($ldev) successfully unmounted"); } @@ -253,4 +295,6 @@ if ( check_x2gothinclientmode() || ( -x "/etc/x2go/x2gothinclient-minidesktop_st } close (F); +} else { + syslog('notice', "not in any thinclient mode, exiting"); } -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gothinclient.git