harddrive in %pre
Lance Gropper
streamscalelance at gmail.com
Fri Aug 27 15:43:05 UTC 2010
Hello Ya'all:
Thank you all for the kind responses so far. Below is my kickstart (so far)
- it is intended to be an automated install. Basically, the %pre finds the
USB key, and sets it as the "install from" drive, and based on this sets the
"install to" drive. The "install to" drive and network configuration
currently works, however the "install from" harddrive statement does not,
even though the USB key is properly detected. It would be great if the USB
device was the same Linux short device name on every system, but it's not.
Today, I am going to modify the script so it attempts other devices, other
than hda, sda, and sdb. One of our customers' systems going to IBC the week
after next has 73 drives, and the USB key shows up last. I'd like to keep
the kickstart as light and fluffy as possible...
Lance
# Kickstart file
%include /tmp/inst-include
install
key --skip
lang en_US.UTF-8
keyboard us
skipx
rootpw --iscrypted $1$kt/7H6d3$g96NCQCYIJL.bIF7/FEJh/
firewall --disabled
authconfig --useshadow --enablemd5
selinux --disabled
timezone America/Tijuana
%packages
@core
%pre
#!/bin/bash
INSTALLFROM='sda5'
INSTALLTO='hda'
touch /tmp/inst-include
if test -e '/sys/block/hda' ; then
ls -l /sys/block/hda/device | grep /usb
if [ $? -neq 0 ] ; then
INSTALLFROM='hda5'
INSTALLTO='sda'
fi
fi
if test -e '/sys/block/sda' ; then
ls -l /sys/block/sda/device | grep /usb
if [ $? -neq 0 ] ; then
INSTALLFROM='sda5'
if test -e '/sys/block/hda' ; then
INSTALLTO='hda'
else
INSTALLTO='sdb'
fi
fi
fi
if test -e '/sys/block/sdb' ; then
ls -l /sys/block/sdb/device | grep /usb
if [ $? -neq 0 ] ; then
INSTALLFROM='sdb5'
if test -e '/sys/block/hda' ; then
INSTALLTO='hda'
else
INSTALLTO='sda'
fi
fi
fi
NICPORTS=0
if test -e '/sys/class/net/eth0' ; then
NICPORTS=1
fi
if test -e '/sys/class/net/eth1' ; then
NICPORTS=2
fi
echo 'harddrive --partition='$INSTALLFROM' --dir=/' >>/tmp/inst-include
if [ $NICPORTS -gt 0 ] ; then
if [ $NICPORTS -eq 1 ] ; then
echo 'network --device eth0 --bootproto static --ip 192.168.1.129
--netmask 255.255.255.0 --gateway 192.168.1.1 --nameserver None --hostname
mybox' >>/tmp/inst-include
else
echo 'network --device eth0 --bootproto dhcp --hostname mybox'
>>/tmp/inst-include
echo 'network --device eth1 --bootproto static --ip 192.168.1.129
--netmask 255.255.255.0 --gateway 192.168.1.1 --nameserver None --hostname
mybox' >>/tmp/inst-include
fi
fi
echo 'bootloader --location=mbr --driveorder='$INSTALLTO' --append="rhgb
quiet crashkernel=128M at 16M"' >>/tmp/inst-include
echo 'clearpart --all --drives='$INSTALLTO >>/tmp/inst-include
echo 'part /boot --fstype ext3 --size=100 --ondisk='$INSTALLTO
>>/tmp/inst-include
echo 'part pv.100000 --size=0 --grow --ondisk='$INSTALLTO
>>/tmp/inst-include
echo 'volgroup VolGroup00 --pesize=32768 pv.100000' >>/tmp/inst-include
echo 'logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00
--size=384 --grow --maxsize=768' >>/tmp/inst-include
echo 'logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=1024
--grow' >>/tmp/inst-include
%end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/kickstart-list/attachments/20100827/35b11665/attachment.htm>
More information about the Kickstart-list
mailing list