Results 1 to 2 of 2
Hi,
I need loads of help, since I dont know where to start, which technic to use etc. I dont have the know-how in programming, but I guess shell script, ...
- 07-16-2007 #1Just Joined!
- Join Date
- Jan 2007
- Posts
- 5
shell script help
Hi,
I need loads of help, since I dont know where to start, which technic to use etc. I dont have the know-how in programming, but I guess shell script, using awk is a good start... I would appreciate if someone could help me, at least with the first case below, and give me a hint how to.
Here is my dilemma. I have created a perfect working kickstart environment, but its totally static. I would like to have one flat file where I enter all preferences, and then just run one script file, which will produce all files for me.
Purpose
When a PXE boot takes place, a TFTP server will share the file: /var/lib/tftpboot/pxelinux.cfg/<MACADDRESS>. The file contain a link to preseed_<COMPUTERNAME>.cfg (on an APACHE server) that contain the kickstart script. The kickstart script is pretty generic, but towards the end, I will wget 3 files from a the kickstart server; interfaces_<COMPUTERNAME> (the unique ip addresses for the two NICs), hosts_<COMPUTERNAME> (names of the backbone servers), and finally hostname_<COMPUTERNAME> (the unique server name)
To generate all necessary files, I would like to create one script that will auto generate my files. The only file I have to edit is the kick_db
[KICK_DB]
This is the look of the kick_db (a flat file):
<COMPUTERNAME><tab><MACADDRESS><tab><IPADDRESS><ta b><IPADDRESS2><tab><HOSTS>
test07001 00-A1-B2-C3-D4-E5 192.168.000.101 172.31.001.101 mon
test07002 00-A1-B2-C3-D4-E6 192.168.000.102 172.31.001.102 tue
test07003 00-A1-B2-C3-D4-E7 192.168.000.103 172.31.001.103 wed
[MACADDRESS]
This script should create three files with the name of <MACADDRESS> - (no extension in the filename! This file should be generated by using an original file that is called "default" which contain $hostname and $preseed that has to be replaced by parcing the variables <COMPUTERNAME> from the kick_db, as well as $pressed that has to replace by: "preseed_" + "<COMPUTERNAME>"+".cfg"
Files created:
/var/lib/tftpboot/pxelinux.cfg/<MACADDRESS>
/var/lib/tftpboot/pxelinux.cfg/<MACADDRESS>
/var/lib/tftpboot/pxelinux.cfg/<MACADDRESS>
[PRESEED]
the original preseed.cfg contain the variables $hosts, $hostname and $interfaces which has to be replaced by parcing in the values "hosts_<COMPUTERNAME>, hostname_<COMPUTERNAME> and interfaces_<COMPUTERNAME>.
Files created:
/var/www/preseed_<COMPUTERNAME>.cfg
/var/www/preseed_<COMPUTERNAME>.cfg
/var/www/preseed_<COMPUTERNAME>.cfg
[HOSTNAME]
This script should create a file containing the <COMPUTERNAME>
Files created:
/usr/www/post_install/hostname_<COMPUTERNAME>
/usr/www/post_install/hostname_<COMPUTERNAME>
/usr/www/kpost_install/hostname_<COMPUTERNAME>
[HOSTS]
This file should be generated by using an original file that is called "hosts" and contains the variables $ipaddress and $hosts, that has to be replaced by parcing from the <IPADDRESS> and <HOSTS>
Files created:
/usr/www/post_install/hosts_<COMPUTERNAME>
/usr/www/post_install/hosts_<COMPUTERNAME>
/usr/www/post_install/hosts_<COMPUTERNAME>
[INTERFACES]
This file should be generated by using an original file that is called "interfaces" and contains the variables $IPADDRESS and $IPADDRESS2, that has to be replaced by parcing from the <IPADDRESS> and <IPADDRESS2> and then be saved.
Files created:
/usr/www/post_install/interfaces_<COMPUTERNAME>
/usr/www/post_install/interfaces_<COMPUTERNAME>
/usr/www/post_install/interfaces_<COMPUTERNAME>
Thanks a lot for your help
- 07-17-2007 #2Linux Enthusiast
- Join Date
- Aug 2006
- Posts
- 631
Hi,
We can help, but not to write a script for you. Here's where you can learn bash scripting:
http://www.tldp.org/LDP/Bash-Beginne...tml/index.html
http://tldp.org/LDP/abs/html/
Once you have more specific questions, please return and we'd be more than happy to answer them!
Regards


Reply With Quote