Custom Kickstart Post Section On Usb Thumbdrive

Home » CentOS » Custom Kickstart Post Section On Usb Thumbdrive
CentOS 1 Comment

Hi All,

I am attempting to create a custom USB drive for kickstart install.

I found this:
1. get the ISO file of CentOS 7

2. mount -o loop CentOS-7.0*.iso /mnt/

3. mkdir -p
/CentOS-7-ISO-respin/{CentOS-7-unpacked,CentOS-7-iso}

4. rsync -avz /mnt/ /CentOS-7-ISO-respin/RHEL-7-unpacked

5. put your kickstart file into
/CentOS-7-ISO-respin/RHEL-7-unpacked

6. add a new line to
/CentOS-7-ISO-respin/RHEL-7-unpacked/isolinux/isolinux.cfg (this way you can use the ISO also from a DVD)
label linux_ks
menu label ^Install CentOS 7 with Kickstart
kernel vmlinuz
append initrd=initrd.img inst.stage2=hd:sdb2:/
ks=hd:sdb1:/ks.cfg

7. create the ISO with:
/usr/bin/genisoimage -untranslated-filenames -volid
‘CentOS-7.0-KS-x86_64’ -J -joliet-long -rational-rock -translation-table
-input-charset utf-8 -x ./lost+found -b isolinux/isolinux.bin -c isolinux/
boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table

8. dd if=/CentOS-7-ISO-respin/CentOS-7-CSB-iso/CentOS-7.0-KS-x86_64-DVD.iso of=/dev/XXX (where XXX is the Device Name of your USB drive without the partition number e.g. /dev/sdb) (Careful, that command destroys all data on the Stick)

But I would also like to create a custom directory on the ISO and put some files in there for a custom POST section.

I was not able to find an example with a custom POST section on the ISO. Anyone have any examples?

Thanks,

Jerry

One thought on - Custom Kickstart Post Section On Usb Thumbdrive

  • The trouble I think you’ll encounter is that the %post section of the kickstart operation is chroot-ed into the new system. You won’t be able to see the original ISO, as far as I know.

    The %pre section is *not* run in the chroot environment, but it’s run prior to partitioning the system disk, so I don’t know how you’d copy files unless you did all your partitioning in %pre, reserving one partition for your %post data.

    I think what I’d do is create and install a custom rpm with the data files you want available during %post. Of course, that means you’ll have to hack the repo on your USB drive, so it’s not really a lightweight solution.