fa505bfb78
Update the ifcfg file for all network devices in a %post in the USB kickstart to set ONBOOT=yes. This allows network interfaces to attempt DHCP after initial installation, in order to automatically be enabled and accessible (depending on network configuration). Change-Id: Icaabcd2111e44a5bf2326aee0267b775af95933e Closes-Bug: 1830035 Signed-off-by: Don Penney <don.penney@windriver.com>
101 lines
2.9 KiB
INI
101 lines
2.9 KiB
INI
%pre --erroronfail
|
|
|
|
# Source common functions
|
|
. /tmp/ks-functions.sh
|
|
|
|
if [ -d /mnt/install/source ]; then
|
|
srcdir=/mnt/install/source
|
|
else
|
|
srcdir=/run/install/repo
|
|
fi
|
|
|
|
touch /tmp/repo-include
|
|
|
|
if [ -d ${srcdir}/patches ]; then
|
|
echo "repo --name=updates --baseurl=file://${srcdir}/patches/" > /tmp/repo-include
|
|
fi
|
|
|
|
%end
|
|
|
|
# Repository arguments from %pre
|
|
%include /tmp/repo-include
|
|
|
|
%post --erroronfail
|
|
|
|
# Source common functions
|
|
. /tmp/ks-functions.sh
|
|
|
|
mgmt_dev=none
|
|
|
|
# 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
|
|
|
|
# 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
|
|
NAME=loopback
|
|
EOF
|
|
|
|
%end
|
|
|
|
|
|
# Note, this section is different and replaced with a wget
|
|
# if doing the initial install off the network
|
|
%post --nochroot
|
|
if [ -d /mnt/install/source ]; then
|
|
srcdir=/mnt/install/source
|
|
else
|
|
srcdir=/run/install/repo
|
|
fi
|
|
|
|
if [ -d $srcdir/Packages ] ; then
|
|
mkdir -p /mnt/sysimage/www/pages/feed/rel-xxxPLATFORM_RELEASExxx
|
|
cp -r $srcdir/Packages /mnt/sysimage/www/pages/feed/rel-xxxPLATFORM_RELEASExxx/Packages
|
|
cp -r $srcdir/repodata /mnt/sysimage/www/pages/feed/rel-xxxPLATFORM_RELEASExxx/repodata
|
|
cp $srcdir/*.cfg /mnt/sysimage/www/pages/feed/rel-xxxPLATFORM_RELEASExxx
|
|
fi
|
|
|
|
if [ -d $srcdir/patches ]; then
|
|
mkdir -p /mnt/sysimage/www/pages/updates/rel-xxxPLATFORM_RELEASExxx
|
|
cp -r $srcdir/patches/Packages /mnt/sysimage/www/pages/updates/rel-xxxPLATFORM_RELEASExxx/Packages
|
|
cp -r $srcdir/patches/repodata /mnt/sysimage/www/pages/updates/rel-xxxPLATFORM_RELEASExxx/repodata
|
|
mkdir -p /mnt/sysimage/opt/patching
|
|
cp -r $srcdir/patches/metadata /mnt/sysimage/opt/patching/metadata
|
|
mkdir -p /mnt/sysimage/opt/patching/packages/xxxPLATFORM_RELEASExxx
|
|
|
|
find /mnt/sysimage/www/pages/updates/rel-xxxPLATFORM_RELEASExxx/Packages -name '*.rpm' \
|
|
| xargs --no-run-if-empty -I files cp --preserve=all files /mnt/sysimage/opt/patching/packages/xxxPLATFORM_RELEASExxx/
|
|
fi
|
|
|
|
# Create a uuid specific to this installation
|
|
INSTALL_UUID=`uuidgen`
|
|
echo $INSTALL_UUID > /mnt/sysimage/www/pages/feed/rel-xxxPLATFORM_RELEASExxx/install_uuid
|
|
echo "INSTALL_UUID=$INSTALL_UUID" >> /mnt/sysimage/etc/platform/platform.conf
|
|
%end
|
|
|
|
%post
|
|
|
|
# This is a USB install, so set ONBOOT=yes for network devices.
|
|
# Doing this in the %post so we don't unintentionally setup a
|
|
# network device during the installation.
|
|
for f in /etc/sysconfig/network-scripts/ifcfg-*; do
|
|
if grep -q '^ONBOOT=' ${f}; then
|
|
sed -i 's/^ONBOOT=.*/ONBOOT=yes/' ${f}
|
|
else
|
|
echo "ONBOOT=yes" >> ${f}
|
|
fi
|
|
done
|
|
|
|
%end
|
|
|