%pre --erroronfail # Source common functions . /tmp/ks-functions.sh echo "repo --name=base --baseurl=http://xxxBOOT_SERVERxxx/umalab/`hostname`_feed/" > /tmp/repo-include echo "repo --name=updates --baseurl=http://xxxBOOT_SERVERxxx/umalab/`hostname`_feed/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=` if [ -d /sys/firmware/efi ] ; then BOOTIF=${BOOTIF#BOOTIF=} else BOOTIF=${BOOTIF#BOOTIF=01-} BOOTIF=${BOOTIF//-/:} fi mgmt_dev=none if [ -n "$BOOTIF" ] ; then ndev=`ip link show |grep -B 1 $BOOTIF |head -1 |awk '{print $2}' |sed -e 's/://'` if [ -n "$ndev" ] ; then mgmt_dev=$ndev else report_post_failure_with_msg "ERROR: Unable to determine mgmt interface from BOOTIF=$BOOTIF." fi else report_post_failure_with_msg "ERROR: BOOTIF is not set. Unable to determine mgmt interface." fi # 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 # 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 cat << EOF > /etc/sysconfig/network-scripts/ifcfg-$mgmt_dev DEVICE=$mgmt_dev BOOTPROTO=dhcp ONBOOT=yes LINKDELAY=20 EOF %end %post --erroronfail # Source common functions . /tmp/ks-functions.sh anaconda_logdir=/var/log/anaconda mkdir -p $anaconda_logdir cd /www/pages mkdir -p feed/rel-xxxPLATFORM_RELEASExxx/Packages mkdir -p feed/rel-xxxPLATFORM_RELEASExxx/repodata cd feed/rel-xxxPLATFORM_RELEASExxx feed_url=http://xxxBOOT_SERVERxxx/umalab/`hostname`_feed declare -i cut_dirs=2 echo "Mirroring software repository (may take several minutes)..." >/dev/console wget --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 --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 $feed_url/isolinux.cfg --append $anaconda_logdir/wget_kickstarts.log \ || report_post_failure_with_logfile $anaconda_logdir/wget_kickstarts.log # Check for patches patches_url=http://xxxBOOT_SERVERxxx/umalab/`hostname`_feed/patches wget -q --spider ${patches_url}/ if [ $? -eq 0 ]; then 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 --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 --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 --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