[X2Go-Commits] [x2gothinclient] 02/02: usbmount/x2gousbmount: whitespace- and comment-only changes.

git-admin at x2go.org git-admin at x2go.org
Thu Jan 17 05:50:08 CET 2019


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

x2go pushed a commit to branch master
in repository x2gothinclient.

commit c6106bd12ca0278b8706e87813ff782c0bbb6132
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Thu Jan 17 05:49:40 2019 +0100

    usbmount/x2gousbmount: whitespace- and comment-only changes.
---
 debian/changelog      |  2 ++
 usbmount/x2gousbmount | 65 ++++++++++++++++++++++++++-------------------------
 2 files changed, 35 insertions(+), 32 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 888b59a..4e5d77b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,8 @@ x2gothinclient (1.5.0.1-0x2go1) UNRELEASED; urgency=medium
   * New upstream release (1.5.0.1):
     - management/etc/x2gothinclient_settings: remove heuler from apt line.
     - management/etc/x2gothinclient_settings: add "extras" component.
+  * usbmount/x2gousbmount:
+    - Whitespace- and comment-only changes.
 
   [ Stefan Baur ]
   * New upstream release (1.5.0.1):
diff --git a/usbmount/x2gousbmount b/usbmount/x2gousbmount
index 131a513..3ecce00 100755
--- a/usbmount/x2gousbmount
+++ b/usbmount/x2gousbmount
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# Copyright (C) 2007-2018 by X2Go project, https://wiki.x2go.org
+# Copyright (C) 2007-2019 by X2Go Project, https://wiki.x2go.org
 #       Oleksandr Shneyder <o.shneyder at phoca-gmbh.de>
 
 # X2Go is free software; you can redistribute it and/or modify
@@ -36,19 +36,19 @@ if ( -f "/etc/x2go/x2gothinclient-minidesktop_start" ) {
 	# this is a minidesktop environment, which uses
 	# username "x2gothinclient" regardless of whether
 	# it runs on X2Go-TCE-Live or X2Go-TCE-NFS
-	$user='x2gothinclient';
+	$user = 'x2gothinclient';
 }
 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';
+	$user = 'user';
 }
 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';
+	$user = 'x2gothinclient';
 }
 
 # We need this as chown requires numeric uid/gid
@@ -83,20 +83,21 @@ sub check_x2gothinclientmode {
 	my $ret = 0;
 
 	# Check for x2gothinclientd first...
-	my $x=`ps ax | grep x2gothinclient`;
-	if ( $x=~m/thinclientd/ )
+	my $x = `ps ax | grep x2gothinclient`;
+	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*/ )
+		$x = `ps u -C x2goclient`;
+		if ($x =~ m/\W*--thinclient\W*/)
 		{
 			$ret = 1;
 		}
 	}
+
 	return $ret;
 }
 
@@ -105,31 +106,31 @@ if ((check_x2gothinclientmode()) || (-x "/lib/live/config/2900-x2go-thinclientco
 {
 	syslog('notice', "some kind of thinclient mode detected");
 
-	open (F,">>/var/log/usb");
+	open (F, ">> /var/log/usb");
 
-	my $dev=$ENV{'DEVNAME'};
-	my $model=$ENV{'ID_MODEL'};
-	my $vendor=$ENV{'ID_VENDOR'};
-	my $action=$ENV{'ACTION'};
-	my @ldev=split("/","$dev");
-	my $ldev=@ldev[@ldev-1];
+	my $dev = $ENV{'DEVNAME'};
+	my $model = $ENV{'ID_MODEL'};
+	my $vendor = $ENV{'ID_VENDOR'};
+	my $action = $ENV{'ACTION'};
+	my @ldev = split("/","$dev");
+	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")) {
-		$mntdir=expand_filename("~$user/mounts");
+		$mntdir = expand_filename("~$user/mounts");
 	} elsif ( -d "/var/run" ) {
-		$mntdir="/var/run";
+		$mntdir = "/var/run";
 	} elsif ( -d "/run" ) {
-		$mntdir="/run";
+		$mntdir = "/run";
 	} else {
 		die "No directory found that we could use as \$mntdir..."
 	}
 
-	my $name="${vendor}_${model}";
-	$name=~s/ //g;
-	$name=~s/\\//g;
-	$name=~s/\///g;
+	my $name = "${vendor}_${model}";
+	$name =~ s/ //g;
+	$name =~ s/\\//g;
+	$name =~ s/\///g;
 	print F "action: $action,  device: $dev, model: $model ($ldev), total: $name\n";
 	mkdir("/media");
 	mkdir("/media/$name");
@@ -168,7 +169,7 @@ if ((check_x2gothinclientmode()) || (-x "/lib/live/config/2900-x2go-thinclientco
 			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"));
+			open (D, ">", expand_filename("~$user/export/$name.$ldev"));
 			print D "export=/media/$name/$ldev\n";
 			close (D);
 		}
@@ -186,16 +187,16 @@ if ((check_x2gothinclientmode()) || (-x "/lib/live/config/2900-x2go-thinclientco
 			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"));
+			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"));
+			open (D, ">", expand_filename("~$user/export/$name.$ldev"));
 			print D "export=/media/$name/$ldev\n";
 			close (D);
 		}
@@ -204,7 +205,7 @@ if ((check_x2gothinclientmode()) || (-x "/lib/live/config/2900-x2go-thinclientco
 			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"));
+			open (D, ">", expand_filename("~$user/export/$name.$ldev"));
 			print D "export=/media/$name/$ldev\n";
 			close (D);
 		}
@@ -212,18 +213,18 @@ if ((check_x2gothinclientmode()) || (-x "/lib/live/config/2900-x2go-thinclientco
 		{
 			# 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"));
+					open (D, ">", expand_filename("~$user/logins/$name.$ldev"));
 					print D "login=/media/$name/$ldev\n";
 					close (D);
 					print F "encrypted mount successful ($ldev)\n";
@@ -256,7 +257,7 @@ if ((check_x2gothinclientmode()) || (-x "/lib/live/config/2900-x2go-thinclientco
 		}
 
 	}
-	elsif ( $action eq "remove" )
+	elsif ($action eq "remove")
 	{
 
 		###
@@ -286,7 +287,7 @@ if ((check_x2gothinclientmode()) || (-x "/lib/live/config/2900-x2go-thinclientco
 			# 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"));
+			open ( D, ">", expand_filename("~$user/logins/$name.$ldev.unexport"));
 			print D "logout=/media/$name/$ldev\n";
 			system("umount /media/$name/$ldev");
 			system("/sbin/cryptsetup luksClose keystick");

--
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