A page in your DokuWiki was added or changed. Here are the details: Date : 2017/11/21 10:56 Browser : Mozilla/5.0 (X11; Linux x86_64; rv:52.9) Gecko/20100101 Goanna/3.4 Firefox/52.9 PaleMoon/27.6.0 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=1511259080 New Revision: https://wiki.x2go.org/doku.php/doc:howto:tce Edit Summary: [Live-Patching the Build] various style changes as suggested by ionic, also updated detection based on what's currently checked in to git User : stefanbaur @@ -146,14 +146,16 @@ # this is a minidesktop environment, which uses # username "x2gothinclient" regardless of whether # it runs on X2Go-TCE-Live or X2Go-TCE-NFS $user='x2gothinclient'; - } elsif ( -d "/lib/live/config" ) { + } + elsif ( -d "/lib/live/config" ) { # this is X2Go-TCE-Live, but not with a minidesktop # (if it were, the first condition would have matched), # so we use Debian-Live's standard username "user" $user='user'; - } else { + } + else { # this is X2Go-TCE-NFS or something completely different, # so we'll play it safe and pick the username "x2gothinclient" # just like previous versions of this script did $user='x2gothinclient'; @@ -164,47 +166,53 @@ # Some last-ditch efforts to fulfill the prerequisites for File Sharing: # - This is stuff that should already have happened earlier in the boot process. # - Also, if a directory already exists, we silently assume that ownership and - # permissions are correct. This is so that users that deliberately set + # permissions are correct. This is so that users that deliberately set # different ownership/permission values don't have their settings silently # overwritten. - unless ( -d expand_filename("~$user/mounts")) { + unless ( -d expand_filename("~$user/mounts") ) { mkdir expand_filename("~$user/mounts"); chmod 0700, expand_filename("~$user/mounts"); chown $uid, $gid, expand_filename("~$user/mounts"); } - unless ( -d expand_filename("~$user/export")) { + unless ( -d expand_filename("~$user/export") ) { mkdir expand_filename("~$user/export"); chmod 0700, expand_filename("~$user/export"); chown $uid, $gid, expand_filename("~$user/export"); } - unless ( -d expand_filename("~$user/logins")) { + unless ( -d expand_filename("~$user/logins") ) { 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_x2gothinclientd { + my $ret = 0; - sub check_x2gothinclientmode { - # check if X2GoClient is running in thinclient mode - # old code would check if x2gothinclientd was running, - # which fails on X2Go-TCE-live - my $x=`ps u -C x2goclient`; - if ( $x=~m/\W*--thinclient\W*/ ) - { - return 1; + # Check for x2gothinclientd first... + my $x=`ps ax | grep x2gothinclient`; + if ( $x=~m/thinclientd/ ) { + $ret = 1; } - return 0; + + # 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() || ( -d "/usr/share/doc/x2gothinclient-minidesktop" ) ) + if ( check_x2gothinclientmode() || ( -x "/etc/x2go/x2gothinclient-minidesktop_start" ) ) { open (F,">>/var/log/usb"); @@ -216,15 +224,18 @@ my $ldev=@ldev[@ldev-1]; # mntdir is not the directory where the mountpoint will be rooted, # but where tracking of mount states takes place my $mntdir; - if ( -d expand_filename("~$user/mounts")) { + if ( -d expand_filename("~$user/mounts") ) { $mntdir=expand_filename("~$user/mounts"); - } elsif ( -d "/var/run" ) { + } + elsif ( -d "/var/run" ) { $mntdir="/var/run"; - } elsif ( -d "/run" ) { + } + elsif ( -d "/run" ) { $mntdir="/run"; - } else { + } + else { die "No directory found that we could use as \$mntdir..." } my $name="${vendor}_${model}"; @@ -235,10 +246,9 @@ mkdir("/media"); mkdir("/media/$name"); print F "$name\n"; - if ( $action eq "add") - { + if ( $action eq "add" ) { ### ### ACTION: mount device after it has been added to USB subsystem ### @@ -248,9 +258,8 @@ # prepare mount points mkdir("/media"); mkdir("/media/$name"); mkdir("/media/$name/$ldev"); - # mount the USB device # sync is supported by all file systems # uid is supported by vfat (via fat),ntfs,hfs,hpfs @@ -259,97 +268,85 @@ # 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 -tvfat,ntfs $dev /media/$name/$ldev -o uid=$user,sync,uni_xlate")==0 ) { syslog('notice', "USB device $name ($ldev) successfully mounted (probably vfat or ntfs)"); # 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 -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... 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 hpfs $dev /media/$name/$ldev -o uid=$user,sync")==0) - { + elsif ( system("mount -t hpfs $dev /media/$name/$ldev -o uid=$user,sync")==0 ) { syslog('notice', "USB device $name ($ldev) successfully mounted (hpfs 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("fuseext2 $dev /media/$name/$ldev -o ro")==0) - { + elsif ( system("fuseext2 $dev /media/$name/$ldev -o ro")==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")); print D "export=/media/$name/$ldev\n"; close (D); } - else - { + else { # the mount failed, let's assume that the device is encrypted... my $enc=`ls -1 $mntdir | grep .encrypted`; - if( $enc eq "" ) - { + if ( $enc eq "" ) { # use cryptsetup to decrypt the device... system("/sbin/cryptsetup --key-file /etc/keys/keystick.key luksOpen $dev keystick"); # mount the ,,decrypted'' USB device via devmapper... - if(system("mount /dev/mapper/keystick /media/$name/$ldev ")==0) - { + if ( system("mount /dev/mapper/keystick /media/$name/$ldev")==0 ) { # inform x2goclient about this... system("touch $mntdir/$ldev.encrypted"); 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); } - else - { + else { # on mount failures release the decrypted device again system("/sbin/cryptsetup luksClose keystick"); } } - else - { + else { print F "cryptodisk already present\n"; } } } - elsif ( $action eq "remove" ) - { + elsif ( $action eq "remove" ) { ### ### ACTION: unmount device after it has been removed from the USB subsystem ### syslog('notice', "device remove action called"); # we rely on our own mount logistics here... - if ( -e "$mntdir/$ldev.mounted" ) - { + if ( -e "$mntdir/$ldev.mounted" ) { # 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"; close (D); syslog('notice', "USB device $name ($ldev) successfully unmounted"); } - elsif ( -e "$mntdir/$ldev.encrypted" ) - { + elsif ( -e "$mntdir/$ldev.encrypted" ) { # inform x2goclient that the device has been removed # release the encrypted device mapping unlink ("$mntdir/$ldev.encrypted"); open ( D,">",expand_filename("~$user/logins/$name.$ldev.unexport")); -- This mail was generated by DokuWiki at https://wiki.x2go.org/