#!/bin/bash #============================================================================ # Title : make-iso # Description : Make a custom Rocky Linux installable ISO # --------------------------------------------------------------------------- # requires lorax, genisoimage: dnf install lorax genisoimage die() { echo "$(basename $0): [die] $@" >&2 ; exit 1 ; } test $(id -u) == 0 || die "Run as root (sudo $(basename $0) " # Setup temp working directory - clean it up when program ends readonly WORKDIR=$(/bin/mktemp --tmpdir -d) cleanup() { /bin/rm -rf ${WORKDIR:-/none} ; } trap "cleanup" INT TERM HUP EXIT topdir=$(git rev-parse --show-toplevel) echo $topdir # requires lorax, genisoimage: dnf install lorax genisoimage isopath=/nfs/sw/os/rocky/Rocky-9.7-x86_64-minimal.iso target=/nfs/pve/template/iso/custom.iso ks=$topdir/kickstart/rocky-9.cfg custom=$topdir/custom cp -r $custom $WORKDIR cp $ks $WORKDIR rpm -q --quiet lorax || die "lorax not installed" rpm -q --quiet genisoimage || die "genisoimage not installed" test -f $target && sudo rm -f $target $topdir/bin/mkksiso -a $WORKDIR/custom --ks=$WORKDIR/$(basename $ks) --custom_cfg $topdir/isolinux.cfg $isopath $target