[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#816600: [PATCH] Adjust regexpes to include all ipv4 and ipv6 addresses, list all ip addresses (sans loopback) in the template instructions, and use only the first ip address in the example command. Closes: #816600 LP: #1552368



---
 debian/changelog                 | 10 ++++++++++
 debian/network-console.postinst  | 15 +++++++++------
 debian/network-console.templates |  2 +-
 3 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index a518cd1..0521276 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+network-console (1.54) UNRELEASED; urgency=medium
+
+  [ Dimitri John Ledkov ]
+  * Adjust regexpes to include all ipv4 and ipv6 addresses, list all ip
+    addresses (sans loopback) in the template instructions, and use only
+    the first ip address in the example command. Closes: #816600 LP:
+    #1552368
+
+ -- Dimitri John Ledkov <xnox@ubuntu.com>  Fri, 01 Apr 2016 00:42:39 +0100
+
 network-console (1.53) unstable; urgency=medium
 
   [ Colin Watson ]
diff --git a/debian/network-console.postinst b/debian/network-console.postinst
index f164446..090cb26 100755
--- a/debian/network-console.postinst
+++ b/debian/network-console.postinst
@@ -85,22 +85,25 @@ apt-install openssh-server || true
 
 case "$(udpkg --print-os)" in
 	linux)
-		IPADDR=$(ip addr | grep '^[[:space:]]*inet ' | grep -v "127\.0\." | \
-			 head -n 1 | sed 's/.*inet \([0-9.]*\).*/\1/')
+		IPADDRS=$(ip addr | grep '^[[:space:]]*inet6\? ' | grep -v -e "127\.0\." -e "::1" | \
+			 sed 's/.*inet6\? \([a-f0-9.:]*\).*/\1/')
 		;;
 	kfreebsd)
-		IPADDR=$(ifconfig| grep '^[[:space:]]*inet ' | grep -v "127\.0\." | \
-			 head -n 1 | sed 's/.*inet \([0-9.]*\).*/\1/')
+		IPADDRS=$(ifconfig| grep '^[[:space:]]*inet6\? ' | grep -v -e "127\.0\." -e "::1" | \
+			 sed 's/.*inet6\? \([a-f0-9.:]*\).*/\1/')
 		;;
 	hurd)
-		IPADDR=$(fsysopts /servers/socket/2 | sed 's/.*--address=\([^ ]*\).*/\1/')
+		IPADDRS=$(fsysopts /servers/socket/2 | sed 's/ /\n/g' | sed -n 's/--address6\?=\([a-f0-9.:]*\).*/\1/p')
 		;;
 	*)
-		IPADDR="TODO"
+		IPADDRS="TODO"
 		;;
 esac
 
+IPADDR=$(IFS=" " ; set -- $IPADDRS ; echo $1)
+
 db_subst $TEMPLATE_ROOT/start ip $IPADDR
+db_subst $TEMPLATE_ROOT/start ips $IPADDRS
 db_subst $TEMPLATE_ROOT/start fingerprint $KEY_FINGERPRINT
 case "$ARCHDETECT" in
     arm*/ixp4xx)
diff --git a/debian/network-console.templates b/debian/network-console.templates
index 1c542ea..e55a653 100644
--- a/debian/network-console.templates
+++ b/debian/network-console.templates
@@ -66,7 +66,7 @@ Type: note
 #flag:translate!:3
 _Description: Start SSH
  To continue the installation, please use an SSH client to connect to the
- IP address ${ip} and log in as the "installer" user. For example:
+ IP address ${ips} and log in as the "installer" user. For example:
  .
     ssh installer@${ip}
  .
-- 
2.7.4


Reply to: