[X2Go-Commits] [live-build-x2go] 11/18: 2260-getsshhostkeysfrommedia now writes list of detected disk labels into its "I'm done" file; 2270-getsshclientkeysfrommedia picks up this list instead of querying anew, also, 2270-getsshclientkeysfrommedia no longer nudges automounter

git-admin at x2go.org git-admin at x2go.org
Wed Jan 24 18:08:46 CET 2018


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

x2go pushed a commit to branch feature/mate-minidesktop
in repository live-build-x2go.

commit cd682d935c2022cdaa92ad29901e1674b7a118c8
Author: Stefan Baur <kontakt at baur-itcs.de>
Date:   Thu Dec 7 11:04:11 2017 +0100

    2260-getsshhostkeysfrommedia now writes list of detected disk labels into its "I'm done" file; 2270-getsshclientkeysfrommedia picks up this list instead of querying anew, also, 2270-getsshclientkeysfrommedia no longer nudges automounter
---
 .../lib/live/config/2260-getsshhostkeysfrommedia            | 11 +++++++----
 .../lib/live/config/2270-getsshclientkeysfrommedia          | 13 +++----------
 2 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/config/includes.chroot/lib/live/config/2260-getsshhostkeysfrommedia b/config/includes.chroot/lib/live/config/2260-getsshhostkeysfrommedia
index 96d56de..ae1e5fb 100755
--- a/config/includes.chroot/lib/live/config/2260-getsshhostkeysfrommedia
+++ b/config/includes.chroot/lib/live/config/2260-getsshhostkeysfrommedia
@@ -20,7 +20,10 @@ GetSSHHostKeysFromMedia ()
 		fi
 
 		# list devices (and mountpoints, if present)
-		X2GOTCELIVELABELS=$(lsblk -oLABEL,NAME,MOUNTPOINT -l | awk '$3~/^[^\/]/ && $3="" ; $1=="X2GO-TCE-LIVE" { print $2 " " $3}')
+		LABELMPLIST=$(lsblk -oLABEL,NAME,MOUNTPOINT -l)
+
+		# search for our magic label
+		X2GOTCELIVELABELS=$(echo -e "$LABELMPLIST" | awk '$3~/^[^\/]/ && $3="" ; $1=="X2GO-TCE-LIVE" { print $2 " " $3}')
 
 		# block device list, non-removable first (for security - we don't want USB media to be able to override keys on fixed disks)
 		BLOCKDEVS=$(grep -H '' /sys/block/*/removable | awk -F':' '{ print $2 ":" $1}' | sort | awk -F'/' '{print $4}')
@@ -90,7 +93,7 @@ GetSSHHostKeysFromMedia ()
 				if [ -n "$MNTPT" ] ; then
 					echo -n "\n$(date +'%F | %T | ')'$0' Device '$NEXTDEVICE' is mounted at: '$MNTPT'" | tee -a /dev/tty8
 					if check_for_config $MNTPT ; then
-						touch /var/lib/live/config/opensshkeys
+						echo -e "$LABELMPLIST" >/var/lib/live/config/opensshkeys
 						exit 0
 					fi
 				else
@@ -101,7 +104,7 @@ GetSSHHostKeysFromMedia ()
 						mount -o ro /dev/$NEXTDEVICE /media/fixeddisks/$NEXTDEVICE
 						if check_for_config /media/fixeddisks/$NEXTDEVICE ; then
 							umount /media/fixeddisks/$NEXTDEVICE
-							touch /var/lib/live/config/opensshkeys
+							echo -e "$LABELMPLIST" >/var/lib/live/config/opensshkeys
 							exit 0
 						fi
 						umount /media/fixeddisks/$NEXTDEVICE
@@ -112,7 +115,7 @@ GetSSHHostKeysFromMedia ()
 				fi
 			fi
 		done
-		touch /var/lib/live/config/opensshkeys
+		echo -e "$LABELMPLIST" >/var/lib/live/config/opensshkeys
 	) &
 }
 
diff --git a/config/includes.chroot/lib/live/config/2270-getsshclientkeysfrommedia b/config/includes.chroot/lib/live/config/2270-getsshclientkeysfrommedia
index 4218aeb..ce978ba 100755
--- a/config/includes.chroot/lib/live/config/2270-getsshclientkeysfrommedia
+++ b/config/includes.chroot/lib/live/config/2270-getsshclientkeysfrommedia
@@ -37,18 +37,11 @@ GetSSHClientKeysFromMedia ()
 				TARGETUSERNAME="x2gothinclient"
 			fi
 
-			# nudge automounter, in case device was already plugged in at power-up
-			if udevadm trigger --action=add ; then
-				echo -n "\n$(date +'%F | %T | ')'$0' Successfully nudged udev-automounter." | tee -a /dev/tty8
-			else
-				echo -n "\n$(date +'%F | %T | ')'$0' Error while nudging udev-automounter." | tee -a /dev/tty8
-			fi
-
-			# list devices (and mountpoints, if present)
-			X2GOTCELIVELABELS=$(lsblk -oLABEL,NAME,MOUNTPOINT -l | awk '$3~/^[^\/]/ && $3="" ; $1=="X2GO-TCE-LIVE" { print $2 " " $3}')
+	                # search for our magic label
+			X2GOTCELIVELABELS=$(awk '$3~/^[^\/]/ && $3="" ; $1=="X2GO-TCE-LIVE" { print $2 " " $3}' /var/lib/live/config/opensshkeys)
 
 			# support for legacy label value
-			PORTABLEAPPLABELS=$(lsblk -oLABEL,NAME,MOUNTPOINT -l | awk '$3~/^[^\/]/ && $3="" ; $1=="PORTABLEAPP" { print $2 " " $3}')
+			PORTABLEAPPLABELS=$(awk '$3~/^[^\/]/ && $3="" ; $1=="PORTABLEAPP" { print $2 " " $3}' /var/lib/live/config/opensshkeys)
 
 			# block device list, removable first (we want USB media to be able to override keys on fixed disks)
 			BLOCKDEVLOOPCOUNT=0 # this is for debugging/logging; it seems the blockdevs list is empty on Debian stretch

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/live-build-x2go.git


More information about the x2go-commits mailing list