How to copy files from CD in kickstart to installed system?
How to copy files from CD in kickstart to installed system?
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.
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.
-
- 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?
Use %post instead of %post --nochroot.
Then you will already be chrooted to the new installation.
Then you will already be chrooted to the new installation.
Re: How to copy files from CD in kickstart to installed system?
[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!
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!
Re: How to copy files from CD in kickstart to installed system?
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.
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.
-
- 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?
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?
mount /dev/hda /mnt/source
mount /tmp/cdrom /mnt/source
Why would you try to mount two devices on the same directory?
Re: How to copy files from CD in kickstart to installed system?
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.
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.
-
- 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?
Are you sure the CD is hda?
It may be hda during the install but change to hdc or something else during %post.
It may be hda during the install but change to hdc or something else during %post.
Re: How to copy files from CD in kickstart to installed system?
[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!
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!
Re: How to copy files from CD in kickstart to installed system?
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.
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.
Re: How to copy files from CD in kickstart to installed system?
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!
Thanks for all the suggestions!