A page in your DokuWiki was added or changed. Here are the details: Date : 2018/02/12 12:40 Browser : Mozilla/5.0 (X11; Linux x86_64; rv:52.9) Gecko/20100101 Goanna/3.4 Firefox/52.9 PaleMoon/27.7.2 IP-Address : 134.3.37.90 Hostname : HSI-KBW-134-3-37-90.hsi14.kabel-badenwuerttemberg.de Old Revision: https://wiki.x2go.org/doku.php/doc:howto:tce?rev=1516988459 New Revision: https://wiki.x2go.org/doku.php/doc:howto:tce Edit Summary: [Live-Patching the Build] updated USB media mount patch User : stefanbaur @@ -145,10 +145,10 @@ <code> mkdir -p ./patch/includes.chroot/usr/lib/x2go/tce/ cat >./patch/includes.chroot/usr/lib/x2go/tce/x2gousbmount <<'USBMOUNTPATCH' - #!/usr/bin/perl + #!/usr/bin/perl # Copyright (C) 2007-2017 by X2Go project, http://wiki.x2go.org # Oleksandr Shneyder <oleksandr.shneyder@obviously-nice.de> # X2Go is free software; you can redistribute it and/or modify @@ -167,9 +167,18 @@ # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 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" ) { # this is a minidesktop environment, which uses @@ -216,11 +225,8 @@ mkdir expand_filename("~$user/logins"); chmod 0700, 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; @@ -229,20 +235,15 @@ if ( $x=~m/thinclientd/ ) { $ret = 1; } - # And for x2goclient --thinclient if nothing was found. - if ( !$ret ) { - $x=`ps u -C x2goclient`; - if ( $x=~m/\W*--thinclient\W*/ ) { - $ret = 1; - } - } 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"); my $dev=$ENV{'DEVNAME'}; @@ -274,8 +275,13 @@ print F "action: $action, device: $dev, model: $model ($ldev), total: $name\n"; mkdir("/media"); mkdir("/media/$name"); print F "$name\n"; + + if (`lsblk -ln -oRM $dev`=~/0$/) { + syslog('notice', "device is non-removable device, skipping"); + exit 0; + } if ( $action eq "add" ) { ### @@ -329,9 +335,9 @@ open (D,">",expand_filename("~$user/export/$name.$ldev")); print D "export=/media/$name/$ldev\n"; close (D); } - 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... system("touch $mntdir/$ldev.mounted"); open (D,">",expand_filename("~$user/export/$name.$ldev")); @@ -352,18 +358,35 @@ system("chown -R $user /media/$name/$ldev/dsa.key"); 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 { 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" ) { ### @@ -377,9 +400,14 @@ # 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 (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"); } elsif ( -e "$mntdir/$ldev.encrypted" ) { @@ -394,10 +422,12 @@ } } close (F); - } + } else { + syslog('notice', "not in any thinclient mode, exiting"); + } USBMOUNTPATCH chmod 755 ./patch/includes.chroot/usr/lib/x2go/tce/x2gousbmount </code> -- This mail was generated by DokuWiki at https://wiki.x2go.org/