How to copy files from CD in kickstart to installed system?

General support questions including new installations
jakev383
Posts: 25
Joined: 2006/03/27 00:59:55

How to copy files from CD in kickstart to installed system?

Post by jakev383 » 2008/03/28 13:04:27

I'm creating a kickstart file that installs the packages I want. I also need to copy some files from the installation CD to the installed system during the kickstart process.
I've tried copying the file (it's only 1) like this:

%post --nochroot

mkdir /mnt/source
mount /dev/hda /mnt/source
mount /tmp/cdrom /mnt/source

mkdir /mnt/sysimage/var/mystuff
cp /mnt/source/me.tar.gz /mnt/sysimage/var/mystuff/

-------------------------------------------------------
Which does not produce the me.tar.gz file anywhere on the installed system after booting for the first time. I looked at some threads in the forum and next tried this:

%post --nochroot

mkdir -p $INSTALL_ROOT/var/mystuff
touch $INSTALL_ROOT/var/mystuff/test
cp -R /root/me* $INSTALL_ROOT/var/mystuff/

--------------------------------------------------------

Which also did not work. Didn't even produce the "test" file.
Hindsight being what it is, I'm now getting ready to run the kickstart with the "cmdline" option instead of "text", but if anyone chimes in on what may be wrong I'd be appreciative.
Thanks.

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

Re: How to copy files from CD in kickstart to installed system?

Post by gerald_clark » 2008/03/28 13:16:25

Use %post instead of %post --nochroot.
Then you will already be chrooted to the new installation.

jakev383
Posts: 25
Joined: 2006/03/27 00:59:55

Re: How to copy files from CD in kickstart to installed system?

Post by jakev383 » 2008/03/28 13:54:45

[quote]
gerald_clark wrote:
Use %post instead of %post --nochroot.
Then you will already be chrooted to the new installation.[/quote]

Thanks - that got me the "test" file from the touch command. Can you tell me what the path would be to copy the me.tar.gz from from the root of the CD?
I'm trying:

cp -R /root/me* $INSTALL_ROOT/var/mystuff/me2.tar.gz
cp cdrom:/me.tar.gz $INSTALL_ROOT/var/mystuff/

In VMWare right now to see if either of those work. Guess I should have tired cp -R /me.tar.gz $INSTALL_ROOT..... as well.
Thanks again for the help!

jakev383
Posts: 25
Joined: 2006/03/27 00:59:55

Re: How to copy files from CD in kickstart to installed system?

Post by jakev383 » 2008/03/28 14:56:44

Hmm. None of them worked:

cp -R /root/me* $INSTALL_ROOT/var/mystuff/me2.tar.gz
cp cdrom:/me.tar.gz $INSTALL_ROOT/var/mystuff/
cp -R /me* $INSTALL_ROOT/var/mystuff/

I even tried:

mkdir /mnt/source
mount /dev/hda /mnt/source
mount /tmp/cdrom /mnt/source

cp /mnt/source/me.tar.gz $INSTALL_ROOT/var/mystuff/


Maybe I need to take a break for an hour or so and come back - I feel like I'm dancing around the issue right now.

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

Re: How to copy files from CD in kickstart to installed system?

Post by gerald_clark » 2008/03/28 17:17:28

mkdir /mnt/source
mount /dev/hda /mnt/source
mount /tmp/cdrom /mnt/source

Why would you try to mount two devices on the same directory?

jakev383
Posts: 25
Joined: 2006/03/27 00:59:55

Re: How to copy files from CD in kickstart to installed system?

Post by jakev383 » 2008/03/28 17:57:16

Sorry, was ahead of myself. I tried both of those mount commands with no success (not together).
I'm still stumped. I'm going to try and watch the background info when installing and see if there's anything useful in there.

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

Re: How to copy files from CD in kickstart to installed system?

Post by gerald_clark » 2008/03/28 18:39:28

Are you sure the CD is hda?
It may be hda during the install but change to hdc or something else during %post.

jakev383
Posts: 25
Joined: 2006/03/27 00:59:55

Re: How to copy files from CD in kickstart to installed system?

Post by jakev383 » 2008/03/28 18:51:00

[quote]
gerald_clark wrote:
Are you sure the CD is hda?
It may be hda during the install but change to hdc or something else during %post.[/quote]

I'm not positive, no. Using hda worked for Cent4 kickstarts though, so I assumed (I know, U, Me, and all that) that it was the same in Cent5.
I did come across a post on the kickstart mailing list about a bug in anaconda where the CD is unmounted before the %post section:
http://archives.devshed.com/forums/linux-97/location-of-installation-media-no-longer-tmp-cdrom-2305391.html
Was this fixed in 5.1 does anyone know? If not I may need to look at changing my stage2.img file (never done that before....)

Anyway, I'll try and see if the dev name of the CD changed during the %post before I jump into that.
Thanks for the suggestions!

jakev383
Posts: 25
Joined: 2006/03/27 00:59:55

Re: How to copy files from CD in kickstart to installed system?

Post by jakev383 » 2008/03/29 03:01:05

Well, I ended up changing anaconda and rebuilding stage2.img.
Now during my kickstart I can see the file, but still can't complete the task.
If I use %post and these commands:

mkdir -p $INSTALL_ROOT/var/mystuff
touch $INSTALL_ROOT/var/mystuff/test
cd $INSTALL_ROOT/var/mystuff
tar xzvf /mnt/source/me.tar.gz

It complains in TTY3 that it cannot find /mnt/source/me.tar.gz so I only end up with /var/mystuff and /var/mystuff/test in the final system.
If I use %post --nochroot and the same commands, on TTY3 during the kickstart I see it untar/gzip the files, but nothing ends up in the final system.
I also tried (under both --nochroot and regular %post):

cp -R /mnt/source/me.tar.gz /mnt/sysimage/var/mystuff/

And still end up with nothing in the final system. I'm gonna call it a night and go to bed now - I'll try some more stuff in the morning.
Thanks for all the suggestions.

jakev383
Posts: 25
Joined: 2006/03/27 00:59:55

Re: How to copy files from CD in kickstart to installed system?

Post by jakev383 » 2008/03/29 14:25:55

For those that are interested, I solved the problem and will post the solution in a little bit. I'm waiting on the stage2.img file to upload to my webserver before I post the instructions and a link to the fixed file. I'll do that later today.
Thanks for all the suggestions!

Post Reply