Pre-Installation Script; Example - Red Hat ENTREPRISE LINUX 5 Installation Manual

Table of Contents

Advertisement

--ignoremissing
Ignore the missing packages and groups instead of halting the installation to ask if the installation
should be aborted or continued. For example:
%packages ­­­ignoremissing

31.6. Pre-installation Script

You can add commands to run on the system immediately after the ks.cfg has been parsed. This
section must be at the end of the kickstart file (after the commands) and must start with the %pre
command. You can access the network in the %pre section; however, name service has not been
configured at this point, so only IP addresses work.
Note
Note that the pre-install script is not run in the change root environment.
--interpreter /usr/bin/python
Allows you to specify a different scripting language, such as Python. Replace /usr/bin/python
with the scripting language of your choice.

31.6.1. Example

Here is an example %pre section:
%pre
#!/bin/sh
hds=""
mymedia=""
for file in ­/proc/ide/h* do
mymedia=`cat $file/media`
if [ $mymedia == ­"disk" ­] ­; then
hds="$hds `basename $file`"
fi
done
set $hds
numhd=`echo $#`
drive1=`echo $hds ­| cut ­­d' ­' ­­f1`
drive2=`echo $hds ­| cut ­­d' ­' ­­f2`
#Write out partition scheme based on whether there are 1 or 2 hard drives
if [ $numhd == ­"2" ­] ­; then
#2 drives
echo ­"#partitioning scheme generated in %pre for 2 drives" > ­/tmp/part­include
echo ­"clearpart ­­­all" >> ­/tmp/part­include
echo ­"part ­/boot ­­­fstype ext3 ­­­size 75 ­­­ondisk hda" >> ­/tmp/part­include
echo ­"part ­/ ­­­fstype ext3 ­­­size 1 ­­­grow ­­­ondisk hda" >> ­/tmp/part­include
echo ­"part swap ­­­recommended ­­­ondisk $drive1" >> ­/tmp/part­include
echo ­"part ­/home ­­­fstype ext3 ­­­size 1 ­­­grow ­­­ondisk hdb" >> ­/tmp/part­include
else
#1 drive
echo ­"#partitioning scheme generated in %pre for 1 drive" > ­/tmp/part­include
echo ­"clearpart ­­­all" >> ­/tmp/part­include
echo ­"part ­/boot ­­­fstype ext3 ­­­size 75" >> ­/tmp/part­includ
echo ­"part swap ­­­recommended" >> ­/tmp/part­include
echo ­"part ­/ ­­­fstype ext3 ­­­size 2048" >> ­/tmp/part­include
Pre-installation Script
321

Advertisement

Table of Contents
loading

This manual is also suitable for:

Enterprise linux 5

Table of Contents