[X2Go-Commits] [live-build-x2go] 22/28: changed config/includes.chroot/lib/live/config/2150-setsshkey so it won't fire until the network is up - like config/includes.chroot/lib/live/config/2600-x2go-getsessions

git-admin at x2go.org git-admin at x2go.org
Fri Dec 30 20:06:22 CET 2016


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

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

commit b957172b32c2961316a90847fa250630752ac5e0
Author: Stefan Baur (BAUR-ITCS) <kontakt at baur-itcs.de>
Date:   Sat Dec 17 01:30:36 2016 +0100

    changed config/includes.chroot/lib/live/config/2150-setsshkey so it won't fire until the network is up - like config/includes.chroot/lib/live/config/2600-x2go-getsessions
---
 .../includes.chroot/lib/live/config/2150-setsshkey |   59 +++++++++++---------
 1 file changed, 34 insertions(+), 25 deletions(-)

diff --git a/config/includes.chroot/lib/live/config/2150-setsshkey b/config/includes.chroot/lib/live/config/2150-setsshkey
index 45572f7..e5756ef 100755
--- a/config/includes.chroot/lib/live/config/2150-setsshkey
+++ b/config/includes.chroot/lib/live/config/2150-setsshkey
@@ -3,40 +3,49 @@
 SetSSHKey ()
 {
 
-# Output startup message
-#
-echo -n " setsshkey"
+	# Output startup message
+	#
+	echo -n " setsshkey"
 
 
-PUBKEYURL=$(cat /proc/cmdline | \
-	    tr ' ' '\n' | \
-	    awk -F'=' ' /^pubkey=/ { print $2 }')
+	PUBKEYURL=$(cat /proc/cmdline | \
+		    tr ' ' '\n' | \
+		    awk -F'=' ' /^pubkey=/ { print $2 }')
 
-if [ -n "$PUBKEYURL" ] ; then
+	if [ -n "$PUBKEYURL" ] ; then
+		cat >/etc/network/if-up.d/getpubkey <<GETPUBKEY
+#!/bin/bash
+export TERM=linux;
 
-	# Set Keyfile
-	#
-	mkdir -p /root/.ssh
-	chmod 600 /root/.ssh
-	touch /root/.ssh/authorized_keys
-	chmod 600 /root/.ssh/authorized_keys
-
-	if echo "$PUBKEY" | grep -q "^tftp://" ; then
-		PUBKEYSERVER=$(echo "$PUBKEYURL" | sed 's#^tftp://\([^/]*\)/.*$#\1#' )
-		PUBKEYPATH=$(echo "$PUBKEYURL" | sed 's#^tftp://[^/]*/\(.*\)$#\1#' )
-		if [ -n "$PUBKEYSERVER" ] && [ -n "$PUBKEYPATH" ] ; then
-			while ! atftp $PUBKEYSERVER -g -r $PUBKEYPATH -l /root/.ssh/authorized_keys ; do
-				echo "Waiting for SSH Public Key ..."
-				sleep 5
-			done
-		fi
-	else
-		while ! wget -q -O - $PUBKEYURL >/root/.ssh/authorized_keys ; do
+while ! ip a | grep -v "inet 127.0.0.1" | grep -v "inet6 ::1/128" | grep -q inet ; do
+        sleep 2
+done
+
+# Set Keyfile
+#
+mkdir -p /root/.ssh
+chmod 600 /root/.ssh
+touch /root/.ssh/authorized_keys
+chmod 600 /root/.ssh/authorized_keys
+
+if echo "$PUBKEY" | grep -q "^tftp://" ; then
+	PUBKEYSERVER=$(echo "$PUBKEYURL" | sed 's#^tftp://\([^/]*\)/.*$#\1#' )
+	PUBKEYPATH=$(echo "$PUBKEYURL" | sed 's#^tftp://[^/]*/\(.*\)$#\1#' )
+	if [ -n "$PUBKEYSERVER" ] && [ -n "$PUBKEYPATH" ] ; then
+		while ! atftp $PUBKEYSERVER -g -r $PUBKEYPATH -l /root/.ssh/authorized_keys ; do
 			echo "Waiting for SSH Public Key ..."
 			sleep 5
 		done
 	fi
+else
+	while ! wget -q -O - $PUBKEYURL >/root/.ssh/authorized_keys ; do
+		echo "Waiting for SSH Public Key ..."
+		sleep 5
+	done
 fi
+GETPUBKEY
+
+	fi
 
 }
 

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