
When booting via PXE one can set the ksdevice=bootif and add 'IPAPPEND 2' to the PXE boot config, this will set the MAC address in the BOOTIF kernel cmdline which can then be used to determine the NIC name to be used for the installation. Tested with both valid and invalid input to BOOTIF= Story: 2007486 Task: 39205 Change-Id: Iec1e8215571a6bb8fb79a461ce9210dddf2c764f Signed-off-by: Saul Wold <sgw@linux.intel.com>
136 lines
4.8 KiB
INI
136 lines
4.8 KiB
INI
%pre --erroronfail
|
|
|
|
# Source common functions
|
|
. /tmp/ks-functions.sh
|
|
|
|
echo "repo --name=base --baseurl=xxxHTTP_URLxxx/" > /tmp/repo-include
|
|
echo "repo --name=updates --baseurl=xxxHTTP_URLxxx/patches/" > /tmp/repo-include
|
|
%end
|
|
|
|
# Repository arguments from %pre
|
|
%include /tmp/repo-include
|
|
|
|
|
|
%post --erroronfail
|
|
|
|
# Source common functions
|
|
. /tmp/ks-functions.sh
|
|
|
|
# Obtain the boot interface from the PXE boot
|
|
BOOTIF=$(cat /proc/cmdline |xargs -n1 echo |grep BOOTIF=)
|
|
BOOTIF=${BOOTIF#BOOTIF=}
|
|
|
|
mgmt_dev=none
|
|
if [ -n "$BOOTIF" ] ; then
|
|
BOOTIF=$(echo $BOOTIF | sed -r -e 's/.*(..-..-..-..-..-..)$/\1/' -e 's/-/:/g')
|
|
ndev=$(ip -br link | awk -v mac="$BOOTIF" '$0 ~ mac {print $1}')
|
|
if [ -n "$ndev" ] ; then
|
|
mgmt_dev=$ndev
|
|
|
|
# Persist the boot device to the platform configuration. This will get
|
|
# overwritten when config_controller is run.
|
|
echo management_interface=$mgmt_dev >> /etc/platform/platform.conf
|
|
|
|
cat << EOF > /etc/sysconfig/network-scripts/ifcfg-$mgmt_dev
|
|
DEVICE=$mgmt_dev
|
|
BOOTPROTO=dhcp
|
|
ONBOOT=yes
|
|
IPV6_AUTOCONF=no
|
|
EOF
|
|
else
|
|
report_post_failure_with_msg "ERROR: Unable to determine mgmt interface from BOOTIF=$BOOTIF."
|
|
fi
|
|
else
|
|
# This is a hybrid ISO/network install. Mount the media to ensure Anaconda
|
|
# ejects it on reboot.
|
|
if [ -e /dev/disk/by-label/oe_iso_boot ]; then
|
|
mkdir /mnt/iso
|
|
mount /dev/disk/by-label/oe_iso_boot /mnt/iso
|
|
fi
|
|
fi
|
|
|
|
# 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
|
|
IPADDR=127.0.0.1
|
|
NETMASK=255.0.0.0
|
|
NETWORK=127.0.0.0
|
|
BROADCAST=127.255.255.255
|
|
ONBOOT=yes
|
|
IPV6_AUTOCONF=no
|
|
NAME=loopback
|
|
EOF
|
|
|
|
%end
|
|
|
|
%post --erroronfail
|
|
|
|
# Source common functions
|
|
. /tmp/ks-functions.sh
|
|
|
|
anaconda_logdir=/var/log/anaconda
|
|
mkdir -p $anaconda_logdir
|
|
|
|
# Check for inst.noverifyssl
|
|
if grep -q inst.noverifyssl /proc/cmdline; then
|
|
NOVERIFYSSL_WGET_OPT="--no-check-certificate"
|
|
else
|
|
NOVERIFYSSL_WGET_OPT=""
|
|
fi
|
|
|
|
cd /www/pages
|
|
mkdir -p feed/rel-xxxPLATFORM_RELEASExxx/Packages
|
|
mkdir -p feed/rel-xxxPLATFORM_RELEASExxx/repodata
|
|
cd feed/rel-xxxPLATFORM_RELEASExxx
|
|
feed_url=xxxHTTP_URLxxx
|
|
declare -i cut_dirs=NUM_DIRS
|
|
echo "Mirroring software repository (may take several minutes)..." >/dev/console
|
|
wget ${NOVERIFYSSL_WGET_OPT} --mirror --no-parent --no-host-directories --reject 'index.html*' \
|
|
--cut-dirs=$cut_dirs $feed_url/Packages/ -o $anaconda_logdir/rpmget.log \
|
|
|| report_post_failure_with_logfile $anaconda_logdir/rpmget.log
|
|
wget ${NOVERIFYSSL_WGET_OPT} --mirror --no-parent --no-host-directories --reject 'index.html*' \
|
|
--cut-dirs=$cut_dirs $feed_url/repodata/ -o $anaconda_logdir/rpmget_repo.log \
|
|
|| report_post_failure_with_logfile $anaconda_logdir/rpmget_repo.log
|
|
wget ${NOVERIFYSSL_WGET_OPT} $feed_url/isolinux.cfg --append $anaconda_logdir/wget_kickstarts.log \
|
|
|| report_post_failure_with_logfile $anaconda_logdir/wget_kickstarts.log
|
|
echo "Done" >/dev/console
|
|
|
|
patches_url=xxxHTTP_URLxxx/patches
|
|
wget ${NOVERIFYSSL_WGET_OPT} -q --spider ${patches_url}/
|
|
if [ $? -eq 0 ]; then
|
|
echo "Downloading patches..." >/dev/console
|
|
cd /www/pages
|
|
mkdir -p updates/rel-xxxPLATFORM_RELEASExxx/Packages
|
|
mkdir -p updates/rel-xxxPLATFORM_RELEASExxx/repodata
|
|
cd updates/rel-xxxPLATFORM_RELEASExxx
|
|
declare -i patches_cut_dirs=$((cut_dirs+1))
|
|
|
|
wget ${NOVERIFYSSL_WGET_OPT} --mirror --no-parent --no-host-directories --reject 'index.html*' \
|
|
--cut-dirs=$patches_cut_dirs $patches_url/Packages/ -o $anaconda_logdir/patches_rpmget.log \
|
|
|| report_post_failure_with_logfile $anaconda_logdir/patches_rpmget.log
|
|
wget ${NOVERIFYSSL_WGET_OPT} --mirror --no-parent --no-host-directories --reject 'index.html*' \
|
|
--cut-dirs=$patches_cut_dirs $patches_url/repodata/ -o $anaconda_logdir/patches_rpmget_repo.log \
|
|
|| report_post_failure_with_logfile $anaconda_logdir/patches_rpmget_repo.log
|
|
|
|
mkdir -p /opt/patching/metadata
|
|
mkdir -p /opt/patching/packages/xxxPLATFORM_RELEASExxx
|
|
cd /opt/patching
|
|
wget ${NOVERIFYSSL_WGET_OPT} --mirror --no-parent --no-host-directories --reject 'index.html*' \
|
|
--cut-dirs=$patches_cut_dirs $patches_url/metadata/ -o $anaconda_logdir/patches_rpmget_metadata.log \
|
|
|| report_post_failure_with_logfile $anaconda_logdir/patches_rpmget_metadata.log
|
|
find /www/pages/updates/rel-xxxPLATFORM_RELEASExxx/Packages -name '*.rpm' \
|
|
| xargs --no-run-if-empty -I files cp --preserve=all files /opt/patching/packages/xxxPLATFORM_RELEASExxx/
|
|
|
|
echo "Done" >/dev/console
|
|
fi
|
|
|
|
# Create a uuid specific to this installation
|
|
INSTALL_UUID=`uuidgen`
|
|
echo $INSTALL_UUID > /www/pages/feed/rel-xxxPLATFORM_RELEASExxx/install_uuid
|
|
echo "INSTALL_UUID=$INSTALL_UUID" >> /etc/platform/platform.conf
|
|
%end
|