metal/bsp-files/kickstarts/post_usb_controller.cfg
Don Penney 84c720f456 Drop copy of .cfg files from controller kickstarts
In a boot from an ISO modified by update-iso.sh with a ks-addon, the
ks-addon.cfg was being unnecessarily copied in a kickstart postinstall
scriptlet. This behaviour, copying the .cfg files, was originally
required for copying the net-boot kickstarts for installation of other
nodes, however the kickstarts are now packaged and installed, and no
other .cfg files are required from the installation.

As such, this update drops the copying of these files.

Change-Id: Id088ff00711b0703299f822ab1f25901e94a6d4d
Closes-Bug: 1875464
Signed-off-by: Don Penney <don.penney@windriver.com>
2020-04-27 22:50:10 -04:00

106 lines
3.0 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
IPV6_AUTOCONF=no
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
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
if grep -q '^IPV6_AUTOCONF=' ${f}; then
sed -i 's/^IPV6_AUTOCONF=.*/IPV6_AUTOCONF=no/' ${f}
else
echo "IPV6_AUTOCONF=no" >> ${f}
fi
done
%end