[X2Go-Commits] [live-build-x2go] 02/28: renamed 2510-x2go-getopensshportableclientkey -> 2270-getsshclientkeysfrommedia as the contents have been changed to a more generic form - it is now no longer specific to X2Go

git-admin at x2go.org git-admin at x2go.org
Sat Nov 18 02:33:03 CET 2017


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

x2go pushed a commit to branch feature/openbox-magic-pixel-workaround
in repository live-build-x2go.

commit 945cabd5d2afe9b4999779d855c6cee8970a8b09
Author: Stefan Baur <kontakt at baur-itcs.de>
Date:   Tue Nov 7 14:39:29 2017 +0100

    renamed 2510-x2go-getopensshportableclientkey -> 2270-getsshclientkeysfrommedia as the contents have been changed to a more generic form - it is now no longer specific to X2Go
---
 .../lib/live/config/2270-getsshclientkeysfrommedia | 98 ++++++++++++++++++++++
 .../config/2510-x2go-getopensshportableclientkey   | 46 ----------
 2 files changed, 98 insertions(+), 46 deletions(-)

diff --git a/config/includes.chroot/lib/live/config/2270-getsshclientkeysfrommedia b/config/includes.chroot/lib/live/config/2270-getsshclientkeysfrommedia
new file mode 100755
index 0000000..b2498fd
--- /dev/null
+++ b/config/includes.chroot/lib/live/config/2270-getsshclientkeysfrommedia
@@ -0,0 +1,98 @@
+#!/bin/sh
+
+
+GetSSHClientKeysFromMedia ()
+{
+	# Output startup message
+	#
+	echo -n " getsshclientkeysfrommedia"
+
+	# This script is for using the iso-hybrid image along with the "second partition" patch
+	# or other suitable storage media. When used with the iso-hybrid image for X2Go in portable mode,
+	# it allows you to share ssh secret keys between X2GoClient for Windows in portable
+	# mode and the X2Go-ThinClientEnvironment on the same USB media using different partitions.
+	# It also allows you to use USB media with your key on it together with a net-booted Debian Live, for example.
+
+	# Homedir of user account
+	#
+	USERHOME=$(getent passwd 1000 | awk -F':' '{ print $6 }')
+
+	# nudge automounter, in case device was already plugged in at power-up
+	#
+	udevadm trigger --action=add
+
+	# list devices (and mountpoints, if present)
+	#
+	X2GOTCELIVELABELS=$(lsblk -oLABEL,NAME,MOUNTPOINT -l | awk '$3~/^[^\/]/ && $3="" ; $1=="X2GO-TCE-LIVE" { print $2 " " $3}')
+
+	# support for legacy label value
+	#
+	PORTABLEAPPLABELS=$(lsblk -oLABEL,NAME,MOUNTPOINT -l | awk '$3~/^[^\/]/ && $3="" ; $1=="PORTABLEAPP" { print $2 " " $3}')
+
+	# block device list, removable first (we want USB media to be able to override keys on fixed disks)
+	#
+	BLOCKDEVS=$(grep -H '' /sys/block/*/removable | awk -F':' '{ print $2 ":" $1}' | sort -r | awk -F'/' '{print $4}')
+
+	check_for_config (){
+	if [ -d $1/config/ssh ] || [ -d $1/ssh ] || [ -d $1/.ssh ]; then
+		# create .ssh-Directory in case it doesn't exist
+		#
+		mkdir -p $(readlink -m "$USERHOME/.ssh/")
+
+		# any keyfile in the config dir will be copied over to live system
+		#
+		for KEYFILE in $1/config/ssh/* $1/ssh $1/.ssh ; do
+			[ -s "$KEYFILE" ] || continue
+			KEYDESTPATH="$USERHOME/.ssh/$(basename "$KEYFILE")"
+			touch "$KEYDESTPATH"
+			chown   user:user \
+				$KEYDESTPATH
+			chmod   600 $KEYDESTPATH
+			cat     $(readlink -m "$KEYFILE")>$KEYDESTPATH
+
+		done
+
+		# this is so the path name in the sessions file matches again
+		# (cannot use .ssh on FAT, for example)
+		#
+		ln -s $USERHOME/.ssh $USERHOME/ssh
+
+		return 0
+	else
+		return 1
+	fi
+	}
+
+	for BLOCKDEV in $BLOCKDEVS; do 
+		NEXTDEVICE=$(echo -e "$X2GOTCELIVELABELS\n$PORTABLEAPPLABELS" | grep "$BLOCKDEV")
+		if [ -n "$NEXTDEVICE" ] ; then
+			MNTPT=$(echo $NEXTDEVICE | awk '{print $2}')
+			NEXTDEVICE=$(echo $NEXTDEVICE | awk '{print $1}')
+
+			if [ -n "$MNTPT" ] ; then
+				# echo "$NEXTDEVICE is mounted at: $MNTPT"
+				check_for_config $MNTPT && exit 0
+			else
+				# echo "$NEXTDEVICE is not mounted"
+				if grep -q "^0$" /sys/block/*/removable ; then
+					# echo "Is fixed disk, mounting"
+					mkdir -p /media/fixeddisks/$NEXTDEVICE
+					mount /dev/$NEXTDEVICE /media/fixeddisks/$NEXTDEVICE
+					check_for_config /media/fixeddisks/$NEXTDEVICE && exit 0
+				else
+					# echo "Is removable disk, not mounted by automounter -> don't touch"
+					:
+				fi
+			fi
+		fi
+	done
+}
+
+
+
+
+	fi
+}
+
+GetSSHClientKeysFromMedia
+
diff --git a/config/includes.chroot/lib/live/config/2510-x2go-getopensshportableclientkey b/config/includes.chroot/lib/live/config/2510-x2go-getopensshportableclientkey
deleted file mode 100755
index 1f7b486..0000000
--- a/config/includes.chroot/lib/live/config/2510-x2go-getopensshportableclientkey
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/sh
-
-
-X2GoGetOpenSSHPortableClientKey ()
-{
-	# Output startup message
-	#
-	echo -n " x2go-getopensshportableclientkey"
-
-	# This script is for using the iso-hybrid image along with the "second partition" patch
-	# it allows you to share ssh secret keys between X2GoClient for Windows in portable
-	# mode and the X2Go-ThinClientEnvironment on the same USB media using different partitions
-
-	# Homedir of client side X2Go ThinClient Account
-	#
-	X2GOHOME="/home/user/"
-
-	# Homedir of Portable App Installation
-	#
-	HOME="/media/PORTABLEAPP/"
-
-	if [ -d "$HOME" ] && [ -d "$X2GOHOME" ]; then
-
-		# create .ssh-Directory in case it doesn't exist
-		#
-		mkdir -p $(readlink -m "$X2GOHOME/.ssh/")
-
-		for KEYFILE in $HOME/ssh/* ; do
-			[ -s "$KEYFILE" ] || continue
-			KEYDESTPATH="$X2GOHOME/.ssh/$(basename "$KEYFILE")"
-			touch "$KEYDESTPATH"
-			chown   user:user \
-				$KEYDESTPATH
-			chmod   600 $KEYDESTPATH
-			cat     $(readlink -m "$KEYFILE")>$KEYDESTPATH
-
-		done
-
-		# this is so the path name in the sessions file matches again
-		# (cannot use .ssh on FAT, for example)
-		ln -s $X2GOHOME/.ssh $X2GOHOME/ssh
-	fi
-}
-
-X2GoGetOpenSSHPortableClientKey
-

--
Alioth's /srv/git/code.x2go.org/live-build-x2go.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/live-build-x2go.git


More information about the x2go-commits mailing list