Skip to content

Instantly share code, notes, and snippets.

@jonathanelbailey
Last active April 17, 2017 02:22
Show Gist options
  • Save jonathanelbailey/cc5f118c6750c6976305c98aec43a2f7 to your computer and use it in GitHub Desktop.
Save jonathanelbailey/cc5f118c6750c6976305c98aec43a2f7 to your computer and use it in GitHub Desktop.
a script to create a custom ovirt node next iso image that uses an online kickstart file.
#! /bin/bash set -e
# to run this script:
# curl -s https://gist.githubusercontent.com/jonathanelbailey/cc5f118c6750c6976305c98aec43a2f7/raw/ \
# | sudo bash /dev/stdin
# Create the working and mount directories
mkdir -p /tmp/work/bootiso
# Download the ISO artifact from the ovirt jenkins link.
curl \
http://jenkins.ovirt.org/job/ovirt-node-ng_ovirt-4.1_build-artifacts-el7-x86_64/lastSuccessfulBuild/artifact/exported-artifacts/ovirt-node-ng-installer-ovirt-4.1-2017041604.iso \
-o /tmp/work/ovirt-node-ng-installer-ovirt-4.1-2017041604.iso
# Mount the iso
mount -o loop /tmp/work/ovirt-node-ng-installer-ovirt-4.1-2017041604.iso /tmp/work/bootiso
# Create the iso working folder and copy the contents of the ISO there.
mkdir /tmp/work/bootisoks
cp -r /tmp/work/bootiso/* /tmp/work/bootisoks/
#unmount the ISO and rm the mount point.
umount /tmp/work/bootiso && rmdir /tmp/work/bootiso
# Mod permissions
chmod -R u+w /tmp/work/bootisoks
# Copy the isolinux.cfg file to a seperate workspace.
cp /tmp/work/bootisoks/isolinux/isolinux.cfg /tmp/work/isolinux.cfg
# Add stage2 and ks cfg
sed -i \
's/inst.stage2=hd:LABEL=CentOS\\x207\\x20x86_64//' \
/tmp/work/isolinux.cfg
sed -i \
's/inst.ks=hd:LABEL=CentOS\\x207\\x20x86_64:\/interactive-defaults.ks/inst.ks=https:\/\/gist.githubusercontent.com\/jonathanelbailey\/b2ba868d39491f4e6a7497010b0f6b18\/raw\/ inst.stage2="http:\/\/mirror.centos.org\/centos\/7\/os\/x86_64\/"/' \
/tmp/work/isolinux.cfg
# Clean up extra params
sed -i \
's/quiet//' /tmp/work/isolinux.cfg
sed -i \
's/rd.live.check//' /tmp/work/isolinux.cfg
sed -i \
's/nomodeset//' /tmp/work/isolinux.cfg
# Copy config to iso filesystem.
yes | cp /tmp/work/isolinux.cfg /tmp/work/bootisoks/isolinux/isolinux.cfg -f
# Create ISO
cd /tmp/work/bootisoks && mkisofs -o /tmp/ovirt-node-ng-installer-ovirt-4.1-2017041604.iso -b isolinux.bin -c boot.cat \
-no-emul-boot -boot-load-size 4 -boot-info-table -R -J -v -T isolinux/. .
# cleanup
rm /tmp/work -rf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment