LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-16-2013, 08:02 AM   #1
tripialos
Member
 
Registered: Apr 2012
Posts: 169

Rep: Reputation: Disabled
kickstart %post script help


I made a kickstart script and at the %post installation i would like to perform a few tasks.

1) Get a script from an ftp
2) chmod the sctipt
3) copy the script to /etc/init.d
4) chkconfig the script so when system reboots the script will be executed

I made the following kickstart script (post section)

Code:
%post --nochroot  --log=/mnt/sysimage/root/ks-post.log

/mnt/sysimage/usr/bin/wget -q  ftp://192.168.0.101:/myInit_script -P /mnt/sysimage/root/ 
chmod -R 755 /mnt/sysimage/root/*  
cp /mnt/sysimage/root/myInit_script -P  /etc/init.d/
/mnt/sysimage/sbin/chkconfig --level 3 myInit_script on
The above system wont work and when i view the ks-post.log i can see the scrambled message below:

Quote:
rmation on service cmxinit: No such file or directory
1) Why cant it find the file since it is there? When i reboot and login on the system i can see that the file was copied.

2) I would be very happy if someone could explain me the chroot // nochroot thing. As far as i understood , the chroot environment is the file-system anaconda creates in order to perform the installation. And the nochrooted file-system is the one that it is just installed, our actual OS. Is that correct? I cant find much explanation articles on the net for the specific topic.


thanks

Last edited by tripialos; 08-16-2013 at 08:04 AM.
 
Old 08-16-2013, 10:42 AM   #2
blueh2o
Member
 
Registered: Jul 2011
Distribution: CentOS, Ubuntu, Fedora, Solaris, RHEL, Debian
Posts: 100

Rep: Reputation: 3
I do my %post without "--nochroot" and all operations are performed on the just-installed system.
For example:
Code:
%post --log /root/post-install.log
...
wget -q -O /root/VMwareTools.tar.gz http://ksserv/vmtools/latest
...
You should be able to wget your script directly into /etc/init.d.. Also, after you put your script in /etc/init.d, I believe you'll want to "chkconfig --add" it before you can set runlevels.

You'll also find that very often if something goes wrong in your kickstart, the log output will be garbled like that. I think that is a special feature in Anaconda.
 
Old 08-20-2013, 07:34 AM   #3
tripialos
Member
 
Registered: Apr 2012
Posts: 169

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by blueh2o View Post
I do my %post without "--nochroot" and all operations are performed on the just-installed system.
For example:
Code:
%post --log /root/post-install.log
...
wget -q -O /root/VMwareTools.tar.gz http://ksserv/vmtools/latest
...
You should be able to wget your script directly into /etc/init.d.. Also, after you put your script in /etc/init.d, I believe you'll want to "chkconfig --add" it before you can set runlevels.

You'll also find that very often if something goes wrong in your kickstart, the log output will be garbled like that. I think that is a special feature in Anaconda.
You are right. I got mixed up with the --nochroot thing and thought that with --nochroot i was outside installers directory which is the oposite.

CentOS Forum made clear to me the distiction of --nochroon and in combination with your post i managed to get it work. What i did is, as you suggested, run the commands as per below:

Code:
%post --log=/root/ks-post.log
/usr/bin/wget -r -nH  ftp://192.168.0.101:/myscript/* -P /root/l
chmod -R 755 /root/*
cp /root/myscript /etc/init.d/
chmod 755 /etc/init.d/myscript
/sbin/chkconfig myscript on
And it worked perfectly.

Thanks
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Trouble with kickstart file's post script section FatKang Red Hat 2 11-30-2012 09:41 AM
kickstart post-installation abhi2778 Linux - Software 8 07-10-2012 09:30 AM
Handling Kickstart post-install script GUI adrianmarsh Red Hat 4 08-10-2009 09:37 PM
Post script in kickstart qiuzhihong Linux - Software 1 04-19-2008 03:52 AM
running %post script for Mailserver through kickstart abhi2778 Fedora 0 09-06-2006 03:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration