Skip to content

Instantly share code, notes, and snippets.

Created July 17, 2019 14:38
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
# based on
if [ ! -e $isopath ]; then
echo Please ensure file $isofile exists in $SOURCEDIR .
exit 1
echo Mounting $isopath in $DESTDIR ...
mkdir -p $DESTDIR
umount $DESTDIR 2> /dev/null
mount -o loop $isopath $DESTDIR
if [ ! -e $DESTDIR/LiveOS ]; then
echo "It seems ISO $isofile could not be mounted properly, or it isn't a RHV iso"
exit 1
echo "Copying ISO contents to /var/www/html/pub/$isofile ..."
if [ -e /var/www/html/pub/$isofile/LiveOS ]; then
rm -rf /var/www/html/pub/$isofile
mkdir -p /var/www/html/pub/$isofile
cp -r $DESTDIR/* /var/www/html/pub/$isofile
echo -e Extracting redhat-virtualization-host-image-update ...
cd /tmp
rpm2cpio $DESTDIR/Packages/redhat-virtualization-host-image-update*rpm | cpio -idmv || exit 1
echo OK
echo -e Copying squash.img to public directory . Available as http://$HOSTNAME/pub/$isofile/squashfs.img ...
mkdir -p /var/www/html/pub/$isofile
cp /tmp/usr/share/redhat-virtualization-host/image/*.squashfs.img /var/www/html/pub/$isofile/squashfs.img || exit 1
rm -rf /tmp/usr
# copy vmlinuz and initrd.img to tftp directory
echo -e Copying $DESTDIR/images/pxeboot/{vmlinuz,initrd.img} to /var/lib/tftpboot/$isofile ...
mkdir -p /var/lib/tftpboot/$isofile
cp $DESTDIR/images/pxeboot/{vmlinuz,initrd.img} /var/lib/tftpboot/$isofile || exit 1
echo OK
echo Unmounting $DESTDIR
umount $DESTDIR || exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment