Linux – CentOS/Redhat kickstart script cdrom mount point

centoskickstartlinuxredhat

Trying to copy some files from my custom CentOS 7 install ISO to the new install in the %post section.

I've tried all of these:

cp /dev/cdrom/scripts/myscript.sh /etc/myscripts/myscript.sh
cp /dev/cdrom:/scripts/myscript.sh /etc/myscripts/myscript.sh
cp /mnt/sysimage/root/scripts/myscript.sh /etc/myscripts/myscript.sh
cp /scripts/myscript.sh /etc/myscripts/myscript.sh

But none of those end up with myscript.sh being in /etc/myscripts

Where does the install mount the cdrom?

UPDATE

I've tried:

%post --nochroot

#!/bin/sh

set -x -v

cp -r /run/install/repo/scripts/myscript.sh /mnt/sysimage/etc/httpd/conf/myscript.sh

which results in the install not booting (just hangs on the splash)

UPDATE 2

Simply doing:

%post --nochroot

cp -r /run/install/repo/scripts/myscritp.sh /mnt/sysimage/etc/myscritp.sh

%end

Works and the file is copied from the install media isolinux/scripts dir to the /etc directory on the install target filesystem.

Best Answer

The %post section won't do what you need without some extra work - you need to do this copy inside a %post --nochroot section so you have access to the CD. You can probably issue a mount command inside %post, but using %post --nochroot is likely easier. I don't remember the source ISO layout offhand, but it'll be there somewhere.