Add support for IPv6 and https to anaconda-preexec
The anaconda-preexec script runs ahead of Anaconda to cache the IP address of the network boot server in the /etc/hosts file, to avoid further DNS queries during installation. This update extends the checks to add support for IPv6 and to allow for https network access. Change-Id: Iadc86cbf971d6ecb0c478a2a16d5040d18a82ef0 Story: 2006980 Task: 38728 Signed-off-by: Don Penney <don.penney@windriver.com>
This commit is contained in:
parent
4ee637ce25
commit
2821c9c6d4
@ -1 +1 @@
|
|||||||
TIS_PATCH_VER=6
|
TIS_PATCH_VER=7
|
||||||
|
@ -0,0 +1,47 @@
|
|||||||
|
From 9a2fa4a719df870296f8559bbf775696b49847c5 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Don Penney <don.penney@windriver.com>
|
||||||
|
Date: Fri, 7 Feb 2020 14:09:28 -0500
|
||||||
|
Subject: [PATCH] Add support for https and IPv6 to anaconda-preexec
|
||||||
|
|
||||||
|
Include the source patch that adds support for https and IPv6.
|
||||||
|
|
||||||
|
Signed-off-by: Don Penney <don.penney@windriver.com>
|
||||||
|
---
|
||||||
|
SPECS/anaconda.spec | 6 ++++--
|
||||||
|
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/SPECS/anaconda.spec b/SPECS/anaconda.spec
|
||||||
|
index c482f38..8fea2fa 100644
|
||||||
|
--- a/SPECS/anaconda.spec
|
||||||
|
+++ b/SPECS/anaconda.spec
|
||||||
|
@@ -24,11 +24,12 @@ Patch8: 9800-rpmostreepayload-Rework-remote-add-handling.patch
|
||||||
|
Patch9: yumpayload-dont-verify-disabled-repos.patch
|
||||||
|
Patch10: anaconda-centos-armhfp-extloader.patch
|
||||||
|
|
||||||
|
-# WRS
|
||||||
|
+# StarlingX
|
||||||
|
Patch10001: 0001-TIS-Progress-and-error-handling.patch
|
||||||
|
Patch10002: 0002-revert-7.4-grub2-efi-handling.patch
|
||||||
|
Patch10003: 0003-Set-default-hostname-to-localhost.patch
|
||||||
|
Patch10004: 0004-Cache-server-ip-in-etc-hosts.patch
|
||||||
|
+Patch10005: 0005-Add-support-for-IPv6-and-https-to-anaconda-preexec.patch
|
||||||
|
|
||||||
|
# Versions of required components (done so we make sure the buildrequires
|
||||||
|
# match the requires versions of things).
|
||||||
|
@@ -256,11 +257,12 @@ runtime on NFS/HTTP/FTP servers or local disks.
|
||||||
|
%patch10 -p1
|
||||||
|
%endif
|
||||||
|
|
||||||
|
-# WRS
|
||||||
|
+# StarlingX
|
||||||
|
%patch10001 -p1
|
||||||
|
%patch10002 -p1
|
||||||
|
%patch10003 -p1
|
||||||
|
%patch10004 -p1
|
||||||
|
+%patch10005 -p1
|
||||||
|
|
||||||
|
%build
|
||||||
|
%configure --disable-static \
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
@ -3,3 +3,4 @@
|
|||||||
0003-revert-7.4-grub2-efi-handling.patch
|
0003-revert-7.4-grub2-efi-handling.patch
|
||||||
0004-Upversion-rpm-devel-dependency.patch
|
0004-Upversion-rpm-devel-dependency.patch
|
||||||
0005-Add-TIS-patches-for-host-lookup.patch
|
0005-Add-TIS-patches-for-host-lookup.patch
|
||||||
|
0006-Add-support-for-https-and-IPv6-to-anaconda-preexec.patch
|
||||||
|
@ -0,0 +1,113 @@
|
|||||||
|
From fbf22f153f415b1dfed1f01879c22b15ac030652 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Don Penney <don.penney@windriver.com>
|
||||||
|
Date: Mon, 10 Feb 2020 20:00:19 -0500
|
||||||
|
Subject: [PATCH] Add support for IPv6 and https to anaconda-preexec
|
||||||
|
|
||||||
|
The anaconda-preexec script runs ahead of Anaconda to cache the IP
|
||||||
|
address of the network boot server in the /etc/hosts file, to avoid
|
||||||
|
further DNS queries during installation.
|
||||||
|
|
||||||
|
This update extends the checks to add support for IPv6 and to allow
|
||||||
|
for https network access.
|
||||||
|
|
||||||
|
Signed-off-by: Don Penney <don.penney@windriver.com>
|
||||||
|
---
|
||||||
|
scripts/anaconda-preexec | 69 +++++++++++++++++++++++++++++++-----------------
|
||||||
|
1 file changed, 45 insertions(+), 24 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/scripts/anaconda-preexec b/scripts/anaconda-preexec
|
||||||
|
index d491173..22e6833 100644
|
||||||
|
--- a/scripts/anaconda-preexec
|
||||||
|
+++ b/scripts/anaconda-preexec
|
||||||
|
@@ -1,6 +1,6 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
-# Copyright (c) 2017 Wind River Systems, Inc.
|
||||||
|
+# Copyright (c) 2017-2019 Wind River Systems, Inc.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
#
|
||||||
|
@@ -14,36 +14,57 @@ set -x
|
||||||
|
function get_ip()
|
||||||
|
{
|
||||||
|
local host=$1
|
||||||
|
+ local host_ip=
|
||||||
|
|
||||||
|
# Try the DNS query
|
||||||
|
- host -t A $host | awk '{print $4}' | grep '^[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$' | head -1
|
||||||
|
+ host_ip=$(host -t A $host | awk '{print $4}' | grep '^[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$' | head -1)
|
||||||
|
+
|
||||||
|
+ if [ -z "${host_ip}" ]; then
|
||||||
|
+ # Check for IPv6
|
||||||
|
+ host_ip=$(host -t AAAA $host | grep 'has IPv6 address' | awk '{print $5}')
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ echo -n ${host_ip}
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+function get_server()
|
||||||
|
+{
|
||||||
|
+ # Check for http/https first
|
||||||
|
+ cat /proc/cmdline | grep -q 'inst\.ks=http'
|
||||||
|
+ if [ $? -ne 0 ]; then
|
||||||
|
+ return
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ local server_and_port=
|
||||||
|
+ server_and_port=$(cat /proc/cmdline | sed -r 's#.*inst\.ks=https*://([^/]*)/.*#\1#')
|
||||||
|
+
|
||||||
|
+ echo "${server_and_port}" | grep -q '^\['
|
||||||
|
+ if [ $? -eq 0 ]; then
|
||||||
|
+ echo "${server_and_port}" | sed -r 's#.*\[(.*)\].*#\1#'
|
||||||
|
+ else
|
||||||
|
+ echo "${server_and_port}" | sed -r 's#([^/:]*)(:[^/]*)?#\1#'
|
||||||
|
+ fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# If the kickstart is net-based, wait for connectivity to server
|
||||||
|
-cat /proc/cmdline | grep -q 'inst\.ks=http://'
|
||||||
|
-if [ $? -eq 0 ]
|
||||||
|
+server=$(get_server)
|
||||||
|
+if [ -n "$server" ]
|
||||||
|
then
|
||||||
|
- server=$(cat /proc/cmdline | sed -r 's#.*inst\.ks=http://([^/:]*)(:[^/]*)?/.*#\1#')
|
||||||
|
- if [ -n "$server" ]
|
||||||
|
- then
|
||||||
|
- echo "Testing connectivity to server: $server"
|
||||||
|
- let -i ping_count=0
|
||||||
|
- ping -c 1 -w 60 $server
|
||||||
|
- while [ $? -ne 0 -a $ping_count -lt 600 ]
|
||||||
|
- do
|
||||||
|
- echo "Waiting for connectivity to server: $server"
|
||||||
|
- sleep 1
|
||||||
|
- let -i ping_count++
|
||||||
|
- ping -c 1 -w 60 $server
|
||||||
|
- done
|
||||||
|
-
|
||||||
|
- # Cache the host IP
|
||||||
|
- ipaddr=$(get_ip $server)
|
||||||
|
- if [ -n "$ipaddr" -a "$ipaddr" != "$server" ]
|
||||||
|
- then
|
||||||
|
- echo "$ipaddr $server" >> /etc/hosts
|
||||||
|
- fi
|
||||||
|
+ echo "Testing connectivity to server: $server"
|
||||||
|
+ let -i TIMEOUT=${SECONDS}+600
|
||||||
|
+ ping -c 1 -w 60 $server || ping6 -c 1 -w 60 $server
|
||||||
|
+ while [ $? -ne 0 -a ${SECONDS} -lt ${TIMEOUT} ]
|
||||||
|
+ do
|
||||||
|
+ echo "Waiting for connectivity to server: $server"
|
||||||
|
+ sleep 1
|
||||||
|
+ ping -c 1 -w 60 $server || ping6 -c 1 -w 60 $server
|
||||||
|
+ done
|
||||||
|
|
||||||
|
+ # Cache the host IP
|
||||||
|
+ ipaddr=$(get_ip $server)
|
||||||
|
+ if [ -n "$ipaddr" -a "$ipaddr" != "$server" ]
|
||||||
|
+ then
|
||||||
|
+ echo "$ipaddr $server" >> /etc/hosts
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
Loading…
Reference in New Issue
Block a user