Configurable Host HTTP/HTTPS Port Binding

Update pxeboot-update script to accept parameter for
installer base URL

Add a common function to parse the port number from
inst.repo

Update pxeboot and kickstart URLs to support a configurable
HTTP port

Story: 2004642
Task: 28593
Depends-On: https://review.openstack.org/#/c/634237/

Change-Id: Ibd66e89e49794ca57b938eb43d227860eda6674a
Signed-off-by: Tao Liu <tao.liu@windriver.com>
This commit is contained in:
Tao Liu 2019-01-31 08:45:01 -06:00
parent 0760eb2c4d
commit 5a44b5be49
25 changed files with 70 additions and 27 deletions

View File

@ -68,5 +68,10 @@ EOF
exit 1
}
function get_http_port()
{
echo \$(cat /proc/cmdline |xargs -n1 echo |grep '^inst.repo=' | sed -r 's#^[^/]*://[^/]*:([0-9]*)/.*#\1#')
}
END_FUNCTIONS

View File

@ -30,16 +30,16 @@ else
systemctl disable auditd
fi
. /etc/platform/platform.conf
# Configure smart package manager channels
rm -rf /var/lib/smart
mkdir /var/lib/smart
/usr/bin/smart channel -y \
--add rpmdb type=rpm-sys name="RPM Database"
/usr/bin/smart channel -y \
--add base type=rpm-md name="Base" baseurl=http://controller/feed/rel-xxxPLATFORM_RELEASExxx
--add base type=rpm-md name="Base" baseurl=http://controller:${http_port:-8080}/feed/rel-xxxPLATFORM_RELEASExxx
/usr/bin/smart channel -y \
--add updates type=rpm-md name="Patches" baseurl=http://controller/updates/rel-xxxPLATFORM_RELEASExxx
--add updates type=rpm-md name="Patches" baseurl=http://controller:${http_port:-8080}/updates/rel-xxxPLATFORM_RELEASExxx
# Configure smart to use rpm --nolinktos option
/usr/bin/smart config --set rpm-nolinktos=true

View File

@ -1,11 +1,26 @@
repo --name=base --baseurl=http://pxecontroller/feed/rel-xxxPLATFORM_RELEASExxx/
repo --name=updates --baseurl=http://pxecontroller/updates/rel-xxxPLATFORM_RELEASExxx/
%pre --erroronfail
# Source common functions
. /tmp/ks-functions.sh
http_port=$(get_http_port)
echo "repo --name=base --baseurl=http://pxecontroller:${http_port:-8080}/feed/rel-xxxPLATFORM_RELEASExxx/" > /tmp/repo-include
echo "repo --name=updates --baseurl=http://pxecontroller:${http_port:-8080}/updates/rel-xxxPLATFORM_RELEASExxx/" > /tmp/repo-include
%end
# Repository arguments from %pre
%include /tmp/repo-include
%post --erroronfail
# Source common functions
. /tmp/ks-functions.sh
# Persist the http port to the platform configuration
echo http_port=$(get_http_port) >> /etc/platform/platform.conf
# Obtain the boot interface from the PXE boot
BOOTIF=`cat /proc/cmdline |xargs -n1 echo |grep BOOTIF=`
if [ -d /sys/firmware/efi ] ; then

View File

@ -3,8 +3,9 @@
# Source common functions
. /tmp/ks-functions.sh
http_port=$(get_http_port)
# Retrieve the installation uuid from the controller we booted from
INSTALL_UUID=`curl -sf http://pxecontroller/feed/rel-xxxPLATFORM_RELEASExxx/install_uuid`
INSTALL_UUID=`curl -sf http://pxecontroller:${http_port:-8080}/feed/rel-xxxPLATFORM_RELEASExxx/install_uuid`
if [ $? -ne 0 ]
then
INSTALL_UUID=unknown
@ -17,7 +18,7 @@ fi
cd /www/pages
# Sync software repository
feed_url=http://pxecontroller/feed/
feed_url=http://pxecontroller:${http_port:-8080}/feed/
anaconda_logdir=/var/log/anaconda
mkdir -p $anaconda_logdir
@ -26,7 +27,7 @@ wget --recursive --no-parent --no-host-directories --no-clobber --reject 'index.
|| report_post_failure_with_logfile $anaconda_logdir/wget-feed-mirror.log
# Sync patching repository
updates_url=http://pxecontroller/updates/
updates_url=http://pxecontroller:${http_port:-8080}/updates/
wget --mirror --no-parent --no-host-directories --reject 'index.html*' --reject '*.log' $updates_url/ -o $anaconda_logdir/wget-updates-mirror.log \
|| report_post_failure_with_logfile $anaconda_logdir/wget-updates-mirror.log
echo "Done" >/dev/console

View File

@ -4,7 +4,8 @@
. /tmp/ks-functions.sh
# Retrieve the installation uuid from the controller we booted from
INSTALL_UUID=`curl -sf http://pxecontroller/feed/rel-xxxPLATFORM_RELEASExxx/install_uuid`
http_port=$(get_http_port)
INSTALL_UUID=`curl -sf http://pxecontroller:${http_port:-8080}/feed/rel-xxxPLATFORM_RELEASExxx/install_uuid`
if [ $? -ne 0 ]
then
INSTALL_UUID=unknown

View File

@ -4,7 +4,8 @@
. /tmp/ks-functions.sh
# Retrieve the installation uuid from the controller we booted from
INSTALL_UUID=`curl -sf http://pxecontroller/feed/rel-xxxPLATFORM_RELEASExxx/install_uuid`
http_port=$(get_http_port)
INSTALL_UUID=`curl -sf http://pxecontroller:${http_port:-8080}/feed/rel-xxxPLATFORM_RELEASExxx/install_uuid`
if [ $? -ne 0 ]
then
INSTALL_UUID=unknown

View File

@ -4,7 +4,8 @@
. /tmp/ks-functions.sh
# Retrieve the installation uuid from the controller we booted from
INSTALL_UUID=`curl -sf http://pxecontroller/feed/rel-xxxPLATFORM_RELEASExxx/install_uuid`
http_port=$(get_http_port)
INSTALL_UUID=`curl -sf http://pxecontroller:${http_port:-8080}/feed/rel-xxxPLATFORM_RELEASExxx/install_uuid`
if [ $? -ne 0 ]
then
INSTALL_UUID=unknown

View File

@ -41,6 +41,10 @@ fi
# overwritten when config_controller is run.
echo management_interface=$mgmt_dev >> /etc/platform/platform.conf
# persist the default http port number to platform configuration. This
# will get overwritten when config_controller is run.
echo http_port=8080 >> /etc/platform/platform.conf
# Build networking scripts
cat << EOF > /etc/sysconfig/network-scripts/ifcfg-lo
DEVICE=lo

View File

@ -31,6 +31,10 @@ mgmt_dev=none
# overwritten when config_controller is run.
echo management_interface=$mgmt_dev >> /etc/platform/platform.conf
# persist the default http port number to platform configuration. This
# will get overwritten when config_controller is run.
echo http_port=8080 >> /etc/platform/platform.conf
# Build networking scripts
cat << EOF > /etc/sysconfig/network-scripts/ifcfg-lo
DEVICE=lo

View File

@ -41,6 +41,10 @@ fi
# overwritten when config_controller is run.
echo management_interface=$mgmt_dev >> /etc/platform/platform.conf
# persist the default http port number to platform configuration. This
# will get overwritten when config_controller is run.
echo http_port=8080 >> /etc/platform/platform.conf
# Build networking scripts
cat << EOF > /etc/sysconfig/network-scripts/ifcfg-lo
DEVICE=lo

View File

@ -7,6 +7,6 @@ COPY_LIST="pxe-network-installer/* \
/import/mirrors/CentOS/stx-installer/vmlinuz \
"
TIS_PATCH_VER=27
TIS_PATCH_VER=28
BUILD_IS_BIG=4
BUILD_IS_SLOW=4

View File

@ -22,6 +22,6 @@ LABEL 1
MENU LABEL ^1) Standard Controller
MENU DEFAULT
KERNEL rel-xxxSW_VERSIONxxx/installer-bzImage
APPEND initrd=rel-xxxSW_VERSIONxxx/installer-initrd bootifonly=1 devfs=nomount inst.repo=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/ inst.ks=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/net_controller_ks.cfg usbcore.autosuspend=-1 biosdevname=0 rd.net.timeout.dhcp=120 xxxAPPEND_OPTIONSxxx
APPEND initrd=rel-xxxSW_VERSIONxxx/installer-initrd bootifonly=1 devfs=nomount inst.repo=xxxBASE_URLxxx/feed/rel-xxxSW_VERSIONxxx/ inst.ks=xxxBASE_URLxxx/feed/rel-xxxSW_VERSIONxxx/net_controller_ks.cfg usbcore.autosuspend=-1 biosdevname=0 rd.net.timeout.dhcp=120 xxxAPPEND_OPTIONSxxx
IPAPPEND 2

View File

@ -22,6 +22,6 @@ LABEL 1
MENU LABEL ^1) All-in-one
MENU DEFAULT
KERNEL rel-xxxSW_VERSIONxxx/installer-bzImage
APPEND initrd=rel-xxxSW_VERSIONxxx/installer-initrd bootifonly=1 devfs=nomount inst.repo=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/ inst.ks=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/net_smallsystem_ks.cfg usbcore.autosuspend=-1 biosdevname=0 rd.net.timeout.dhcp=120 xxxAPPEND_OPTIONSxxx
APPEND initrd=rel-xxxSW_VERSIONxxx/installer-initrd bootifonly=1 devfs=nomount inst.repo=xxxBASE_URLxxx/feed/rel-xxxSW_VERSIONxxx/ inst.ks=xxxBASE_URLxxx/feed/rel-xxxSW_VERSIONxxx/net_smallsystem_ks.cfg usbcore.autosuspend=-1 biosdevname=0 rd.net.timeout.dhcp=120 xxxAPPEND_OPTIONSxxx
IPAPPEND 2

View File

@ -22,6 +22,6 @@ LABEL 1
MENU LABEL ^1) All-in-one (lowlatency)
MENU DEFAULT
KERNEL rel-xxxSW_VERSIONxxx/installer-bzImage
APPEND initrd=rel-xxxSW_VERSIONxxx/installer-initrd bootifonly=1 devfs=nomount inst.repo=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/ inst.ks=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/net_smallsystem_lowlatency_ks.cfg usbcore.autosuspend=-1 biosdevname=0 rd.net.timeout.dhcp=120 xxxAPPEND_OPTIONSxxx
APPEND initrd=rel-xxxSW_VERSIONxxx/installer-initrd bootifonly=1 devfs=nomount inst.repo=xxxBASE_URLxxx/feed/rel-xxxSW_VERSIONxxx/ inst.ks=xxxBASE_URLxxx/feed/rel-xxxSW_VERSIONxxx/net_smallsystem_lowlatency_ks.cfg usbcore.autosuspend=-1 biosdevname=0 rd.net.timeout.dhcp=120 xxxAPPEND_OPTIONSxxx
IPAPPEND 2

View File

@ -22,6 +22,6 @@ LABEL 1
MENU LABEL ^1) Storage
MENU DEFAULT
KERNEL rel-xxxSW_VERSIONxxx/installer-bzImage
APPEND initrd=rel-xxxSW_VERSIONxxx/installer-initrd bootifonly=1 devfs=nomount inst.repo=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/ inst.ks=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/net_storage_ks.cfg usbcore.autosuspend=-1 biosdevname=0 rd.net.timeout.dhcp=120 xxxAPPEND_OPTIONSxxx
APPEND initrd=rel-xxxSW_VERSIONxxx/installer-initrd bootifonly=1 devfs=nomount inst.repo=xxxBASE_URLxxx/feed/rel-xxxSW_VERSIONxxx/ inst.ks=xxxBASE_URLxxx/feed/rel-xxxSW_VERSIONxxx/net_storage_ks.cfg usbcore.autosuspend=-1 biosdevname=0 rd.net.timeout.dhcp=120 xxxAPPEND_OPTIONSxxx
IPAPPEND 2

View File

@ -22,6 +22,6 @@ LABEL 1
MENU LABEL ^1) Worker
MENU DEFAULT
KERNEL rel-xxxSW_VERSIONxxx/installer-bzImage
APPEND initrd=rel-xxxSW_VERSIONxxx/installer-initrd bootifonly=1 devfs=nomount inst.repo=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/ inst.ks=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/net_worker_ks.cfg usbcore.autosuspend=-1 biosdevname=0 rd.net.timeout.dhcp=120 xxxAPPEND_OPTIONSxxx
APPEND initrd=rel-xxxSW_VERSIONxxx/installer-initrd bootifonly=1 devfs=nomount inst.repo=xxxBASE_URLxxx/feed/rel-xxxSW_VERSIONxxx/ inst.ks=xxxBASE_URLxxx/feed/rel-xxxSW_VERSIONxxx/net_worker_ks.cfg usbcore.autosuspend=-1 biosdevname=0 rd.net.timeout.dhcp=120 xxxAPPEND_OPTIONSxxx
IPAPPEND 2

View File

@ -22,6 +22,6 @@ LABEL 1
MENU LABEL ^1) Lowlatency Worker
MENU DEFAULT
KERNEL rel-xxxSW_VERSIONxxx/installer-bzImage
APPEND initrd=rel-xxxSW_VERSIONxxx/installer-initrd bootifonly=1 devfs=nomount inst.repo=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/ inst.ks=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/net_worker_lowlatency_ks.cfg usbcore.autosuspend=-1 biosdevname=0 rd.net.timeout.dhcp=120 xxxAPPEND_OPTIONSxxx
APPEND initrd=rel-xxxSW_VERSIONxxx/installer-initrd bootifonly=1 devfs=nomount inst.repo=xxxBASE_URLxxx/feed/rel-xxxSW_VERSIONxxx/ inst.ks=xxxBASE_URLxxx/feed/rel-xxxSW_VERSIONxxx/net_worker_lowlatency_ks.cfg usbcore.autosuspend=-1 biosdevname=0 rd.net.timeout.dhcp=120 xxxAPPEND_OPTIONSxxx
IPAPPEND 2

View File

@ -4,6 +4,6 @@ GRUB_HIDDEN_TIMEOUT=0
GRUB_TIMEOUT_STYLE='countdown'
menuentry '1) UEFI Standard Controller' {
linuxefi rel-xxxSW_VERSIONxxx/installer-bzImage bootifonly=1 devfs=nomount inst.repo=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/ inst.ks=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/net_controller_ks.cfg usbcore.autosuspend=-1 biosdevname=0 rd.net.timeout.dhcp=120 ksdevice=$net_default_mac BOOTIF=$net_default_mac xxxAPPEND_OPTIONSxxx
linuxefi rel-xxxSW_VERSIONxxx/installer-bzImage bootifonly=1 devfs=nomount inst.repo=xxxBASE_URLxxx/feed/rel-xxxSW_VERSIONxxx/ inst.ks=xxxBASE_URLxxx/feed/rel-xxxSW_VERSIONxxx/net_controller_ks.cfg usbcore.autosuspend=-1 biosdevname=0 rd.net.timeout.dhcp=120 ksdevice=$net_default_mac BOOTIF=$net_default_mac xxxAPPEND_OPTIONSxxx
initrdefi rel-xxxSW_VERSIONxxx/installer-initrd
}

View File

@ -4,6 +4,6 @@ GRUB_HIDDEN_TIMEOUT=0
GRUB_TIMEOUT_STYLE='countdown'
menuentry '1) UEFI All-in-one' {
linuxefi rel-xxxSW_VERSIONxxx/installer-bzImage bootifonly=1 devfs=nomount inst.repo=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/ inst.ks=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/net_smallsystem_ks.cfg usbcore.autosuspend=-1 biosdevname=0 rd.net.timeout.dhcp=120 ksdevice=$net_default_mac BOOTIF=$net_default_mac xxxAPPEND_OPTIONSxxx
linuxefi rel-xxxSW_VERSIONxxx/installer-bzImage bootifonly=1 devfs=nomount inst.repo=xxxBASE_URLxxx/feed/rel-xxxSW_VERSIONxxx/ inst.ks=xxxBASE_URLxxx/feed/rel-xxxSW_VERSIONxxx/net_smallsystem_ks.cfg usbcore.autosuspend=-1 biosdevname=0 rd.net.timeout.dhcp=120 ksdevice=$net_default_mac BOOTIF=$net_default_mac xxxAPPEND_OPTIONSxxx
initrdefi rel-xxxSW_VERSIONxxx/installer-initrd
}

View File

@ -4,6 +4,6 @@ GRUB_HIDDEN_TIMEOUT=0
GRUB_TIMEOUT_STYLE='countdown'
menuentry '1) UEFI All-in-one (lowlatency)' {
linuxefi rel-xxxSW_VERSIONxxx/installer-bzImage bootifonly=1 devfs=nomount inst.repo=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/ inst.ks=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/net_smallsystem_lowlatency_ks.cfg usbcore.autosuspend=-1 biosdevname=0 rd.net.timeout.dhcp=120 ksdevice=$net_default_mac BOOTIF=$net_default_mac xxxAPPEND_OPTIONSxxx
linuxefi rel-xxxSW_VERSIONxxx/installer-bzImage bootifonly=1 devfs=nomount inst.repo=xxxBASE_URLxxx/feed/rel-xxxSW_VERSIONxxx/ inst.ks=xxxBASE_URLxxx/feed/rel-xxxSW_VERSIONxxx/net_smallsystem_lowlatency_ks.cfg usbcore.autosuspend=-1 biosdevname=0 rd.net.timeout.dhcp=120 ksdevice=$net_default_mac BOOTIF=$net_default_mac xxxAPPEND_OPTIONSxxx
initrdefi rel-xxxSW_VERSIONxxx/installer-initrd
}

View File

@ -4,6 +4,6 @@ GRUB_HIDDEN_TIMEOUT=0
GRUB_TIMEOUT_STYLE='countdown'
menuentry '1) UEFI Storage' {
linuxefi rel-xxxSW_VERSIONxxx/installer-bzImage bootifonly=1 devfs=nomount inst.repo=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/ inst.ks=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/net_storage_ks.cfg usbcore.autosuspend=-1 biosdevname=0 rd.net.timeout.dhcp=120 ksdevice=$net_default_mac BOOTIF=$net_default_mac xxxAPPEND_OPTIONSxxx
linuxefi rel-xxxSW_VERSIONxxx/installer-bzImage bootifonly=1 devfs=nomount inst.repo=xxxBASE_URLxxx/feed/rel-xxxSW_VERSIONxxx/ inst.ks=xxxBASE_URLxxx/feed/rel-xxxSW_VERSIONxxx/net_storage_ks.cfg usbcore.autosuspend=-1 biosdevname=0 rd.net.timeout.dhcp=120 ksdevice=$net_default_mac BOOTIF=$net_default_mac xxxAPPEND_OPTIONSxxx
initrdefi rel-xxxSW_VERSIONxxx/installer-initrd
}

View File

@ -4,6 +4,6 @@ GRUB_HIDDEN_TIMEOUT=0
GRUB_TIMEOUT_STYLE='countdown'
menuentry '1) UEFI Worker' {
linuxefi rel-xxxSW_VERSIONxxx/installer-bzImage bootifonly=1 devfs=nomount inst.repo=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/ inst.ks=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/net_worker_ks.cfg usbcore.autosuspend=-1 biosdevname=0 rd.net.timeout.dhcp=120 ksdevice=$net_default_mac BOOTIF=$net_default_mac xxxAPPEND_OPTIONSxxx
linuxefi rel-xxxSW_VERSIONxxx/installer-bzImage bootifonly=1 devfs=nomount inst.repo=xxxBASE_URLxxx/feed/rel-xxxSW_VERSIONxxx/ inst.ks=xxxBASE_URLxxx/feed/rel-xxxSW_VERSIONxxx/net_worker_ks.cfg usbcore.autosuspend=-1 biosdevname=0 rd.net.timeout.dhcp=120 ksdevice=$net_default_mac BOOTIF=$net_default_mac xxxAPPEND_OPTIONSxxx
initrdefi rel-xxxSW_VERSIONxxx/installer-initrd
}

View File

@ -4,6 +4,6 @@ GRUB_HIDDEN_TIMEOUT=0
GRUB_TIMEOUT_STYLE='countdown'
menuentry '1) UEFI Lowlatency Worker' {
linuxefi rel-xxxSW_VERSIONxxx/installer-bzImage bootifonly=1 devfs=nomount inst.repo=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/ inst.ks=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/net_worker_lowlatency_ks.cfg usbcore.autosuspend=-1 biosdevname=0 rd.net.timeout.dhcp=120 ksdevice=$net_default_mac BOOTIF=$net_default_mac xxxAPPEND_OPTIONSxxx
linuxefi rel-xxxSW_VERSIONxxx/installer-bzImage bootifonly=1 devfs=nomount inst.repo=xxxBASE_URLxxx/feed/rel-xxxSW_VERSIONxxx/ inst.ks=xxxBASE_URLxxx/feed/rel-xxxSW_VERSIONxxx/net_worker_lowlatency_ks.cfg usbcore.autosuspend=-1 biosdevname=0 rd.net.timeout.dhcp=120 ksdevice=$net_default_mac BOOTIF=$net_default_mac xxxAPPEND_OPTIONSxxx
initrdefi rel-xxxSW_VERSIONxxx/installer-initrd
}

View File

@ -30,11 +30,13 @@ Arguments:
-s <mode> : Specify Security Profile mode (optional)
-T <tboot value> : Specify whether or not to use tboot (optional)
-k <kernel args> : Specify any extra kernel boot arguments (optional)
-l <base url> : Specify installer base URL
EOF
}
declare text_install="inst.text"
declare base_url="http://pxecontroller:8080"
function generate_config {
input=$1
@ -55,7 +57,7 @@ function generate_config {
exit 1
fi
sed -e "s#xxxAPPEND_OPTIONSxxx#$APPEND_OPTIONS#" $input > $output
sed -e "s#xxxAPPEND_OPTIONSxxx#$APPEND_OPTIONS#;s#xxxBASE_URLxxx#$BASE_URL#g" $input > $output
if [ $? -ne 0 -o ! -f $output ]; then
logger --stderr -t $0 "Error: Failed to generate pxeboot file $output"
@ -66,7 +68,7 @@ function generate_config {
parms=$@
logger -t $0 " $parms"
while getopts "i:o:tgc:b:r:u:s:T:k:h" opt
while getopts "i:o:tgc:b:r:u:s:T:k:l:h" opt
do
case $opt in
i)
@ -107,6 +109,9 @@ do
k)
kernal_extra_args=$OPTARG
;;
l)
base_url=$OPTARG
;;
h)
usage
exit 1
@ -158,6 +163,8 @@ if [ -n "$kernal_extra_args" ]; then
APPEND_OPTIONS="$APPEND_OPTIONS $kernal_extra_args"
fi
BASE_URL=$base_url
generate_config $input_file $output_file
# for extended security profile UEFI boot only,

View File

@ -1,3 +1,3 @@
SRC_DIR="${GIT_BASE}/bsp-files"
COPY_LIST="$PKG_BASE/LICENSE"
TIS_PATCH_VER=2
TIS_PATCH_VER=3