Run scripts after centos installed

If it doesn't fit in another category, ask it here.
allamiro
Posts: 21
Joined: 2009/07/30 20:43:36

Re: Run scripts after centos installed

Post by allamiro » 2012/02/13 22:17:09

Hi sorry for that

I m not familiar yet with forum use thanks for that

I m not using yum install I m using automated kickstart scriipt install

to install the tftp server
tftp-server-*
system-config-netboot-*


So do you sugeest instead of using that should I use tftp-server* ?

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Re: Run scripts after centos installed

Post by pschaff » 2012/02/14 18:19:42

All I was suggesting is that you may want to verify that the syntax you are using is resulting in the package selection you want, and if not to adjust accordingly.

User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Run scripts after centos installed

Post by jlehtone » 2012/02/20 11:58:19

[quote]allamiro wrote:
# backup the rc local file
# Enable a call to your script
echo "BCFINSTALL=1 ; /etc/rc.d/bcfinstall.sh" >> /etc/rc.d/rc.local

# Create your script
cat > /etc/rc.d/bcfinstall.sh > /etc/rc.d/rc.local
mount -r -o loop /isos/applogic/centos57.iso /mnt/centos
rpm --import /mnt/centos/RPM-GPG-KEY-5
rpm -ivh /mnt/centos/CentOS/tftp-server-*
yum list
cp /mnt/centos/CentOS/bfc*.iso /isos/applogic/
cp /mnt/centos/interactive.txt /isos/applogic/
mount -r -o loop /isos/applogic/bfcinstall.iso /mnt/cdrom
/mnt/cdrom/fcinstall.sh -c /isos/applogic/interactive.txt -x /isos/applogic/bfcext.iso

# Disable the call to this script
sed -i "s/BCFINSTALL/#BCFINSTALL/" /etc/rc.d/rc.local
EOF
chmod +x /etc/rc.d/bcfinstall.sh[/quote]
For clarity: this is supposedly a part of the %post section of a kickstart file.
Furthermore, the version above should probably be cleaned to this:
[code]# backup the rc local file
# Enable a call to your script
echo "BCFINSTALL=1 ; /etc/rc.d/bcfinstall.sh" >> /etc/rc.d/rc.local

# Create your script
cat > /etc/rc.d/bcfinstall.sh <<EOF
#!/bin/bash
#Your install script commands here
dd if=/dev/cdrom of=/isos/applogic/centos57.iso
chmod 755 /isos/applogic/centos57.iso
mount -r -o loop /isos/applogic/centos57.iso /mnt/centos
cp /mnt/centos/CentOS/bfc*.iso /isos/applogic/
cp /mnt/centos/interactive.txt /isos/applogic/
mount -r -o loop /isos/applogic/bfcinstall.iso /mnt/cdrom
#
/mnt/cdrom/fcinstall.sh -c /isos/applogic/interactive.txt -x /isos/applogic/bfcext.iso
#
# As last action disable the call to your script from the rc.local
sed -i "s/BCFINSTALL/#BCFINSTALL/" /etc/rc.d/rc.local
EOF

# Make sure that rc.local can execute the /etc/rc.d/bcfinstall.sh
chmod +x /etc/rc.d/bcfinstall.sh[/code]

Post Reply