[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

RE: %include statement



I haven't used %include yet, but I can offer an alternative that works
for me (7.3) for altering the "url" and "network" lines (don't know
about "cdrom").  I make changes in %pre directly to /tmp/ks.cfg using
sed.  For example:

%pre
....

ks="/tmp/ks.cfg"
sed -e "/^network/s/^network.*/$line/" $ks >${ks}.tmp && mv ${ks}.tmp
$ks
("$line" is the "network" line, static ip config stuff. How I derive it
is off this topic.)
....

(Using the ip address, I determine the ftp server based on network,
then,)
url="url --url ftp:\/\/$ftp_server\/7.3"
# Rewrite default ftp url for initial install 
sed -e "/^url.*--url/s/^url.*/$url/" $ks > ${ks}.tmp && mv ${ks}.tmp $ks
.....

(Then I give myself the option to edit /tmp/ks.cfg while in %pre.  (So
far, I have only modified partition info here. I can't say for sure if
everything in the file is subject to modification this way.)
chvt 3 
exec < /dev/tty3 > /dev/tty3
echo 'Would you like to review or edit the kickstart
configuration(/tmp/ks.cfg)?'
echo 'Type "y" to edit or press enter to continue with kickstart'
read reply
if echo "$reply" |grep  -q ^y$
   then  vi /tmp/ks.cfg
fi
(I do the "echo variable |grep" because it appeared that the busybox
shell did not allow for string comparison.)

-Ed



On Wed, 2003-08-27 at 14:27, trax wrote:
> Donald,
> 	yep I see what you say, thats how I read it also.
> 
> I also read that the information should be configured in %pre.
> When does the ks.cfg actually get used.
> If I boot my cd, I see that it copys my basic ks.cfg to /tmp/ks.cfg
> Then the configuration menu gets called, then the hardware detection
> then the installation starts.
> Now if I replace information say in the ks.cfg for installation using
> the %include statement
> i.e. in my local test I remove cdrom. In place of cdrom I put %include
> /tmp/include-type
> 
> %pre 
> echo "cdrom" > /tmp/includetype
> 
> It does not seem to pick this up. And so I get the default redhat
> installation menus. Anaconda proceeds then I get my dialog box I have
> setup in %pre.
> I wish there was some documentation on this. I wonder if someone can
> explain how and when it is parsed.
>  
> On Wed, 2003-08-27 at 21:52, Bodle, Donald E wrote:
> > Sorry, haven't tried that.  It also depends on what version of Redhat you're
> > using.  Include didn't become part of anaconda until sometime after 7.1.
> > But in theory, once its available, you're supposed to be able to use it for
> > just about anything I thought.  Here's from the RH 8.0 customization guide:
> > 
> > %include
> > Use the %include /path/to/file command to include the contents of another
> > file in the
> > kickstart file as though the contents were at the location of the %include
> > command in the kickstart
> > file.
> > 
> > Donald E. Bodle, Jr., RHCT
> > Sr. Systems Integration Engineer
> > Platform Development
> > The Reynolds and Reynolds Co.
> > (937) 485-1954
> >  
> > 
> > 
> > -----Original Message-----
> > From: trax [mailto:traxtopel HotPOP com] 
> > Sent: Wednesday, August 27, 2003 3:38 PM
> > To: kickstart-list redhat com
> > Subject: RE: %include statement
> > 
> > 
> > Thanks Donald,
> > I think however I am wondering if you can use the %include for any field in
> > ks.cfg. Can I say add a %include /tmp/url And via a menu(I use dialog) in
> > %pre generate/select an entry echo "url --url ftp://me.bloggs.com/redhat"; >
> > /tmp/url
> > 
> > I have tried this but it does not seem to get read. Any tips?
> > 
> > On Wed, 2003-08-27 at 21:30, Bodle, Donald E wrote:
> > > Here's an example.  See in particular the "%include /tmp/partfile" and 
> > > the "cat >> /tmp/partfile << EOF"
> > > 
> > > lang en_US
> > > langsupport en_US
> > > ... stuff ...
> > > %include /tmp/partfile
> > > %packages
> > > @ Everything
> > > %pre
> > > shopt -s xpg_echo
> > > ... stuff ...
> > > ls /proc/ide/hdb > /dev/null 2>&1
> > > if [ $? -eq 0 ]
> > > then # hdb means cdrom is not hda, so ide disks exist
> > >   echo "Setting up IDE based partitioning" > /dev/tty3
> > >   echo "Setting up IDE based partitioning at `date`" >> 
> > > /tmp/reyinstall.log # okay, here we have to use fdisk to do 
> > > partitioning instead of letting # anaconda do it.  We already know its 
> > > an ide device.  Just have to create # the right partitions with the 
> > > right sizes
> > > 
> > > # start out fresh
> > > echo | fdisk /dev/hda << EOF
> > > o
> > > w
> > > EOF
> > > # now start creating partitions
> > > echo | fdisk /dev/hda << EOF
> > > n
> > > p
> > > 1
> > > 
> > > +64M
> > > n
> > > e
> > > 2
> > > 
> > > 
> > > n
> > > l
> > > 
> > > +4096M
> > > n
> > > l
> > > 
> > > +2048M
> > > n
> > > l
> > > 
> > > +2047M
> > > t
> > > 7
> > > 82
> > > n
> > > l
> > > 
> > > +512M
> > > n
> > > l
> > > 
> > > +448M
> > > n
> > > l
> > > 
> > > +320M
> > > n
> > > l
> > > 
> > > +256M
> > > w
> > > EOF
> > >   echo "IDE based partitioning completed" > /dev/tty3
> > >   echo "IDE based partitioning completed at `date`" >> /tmp/reyinstall.log
> > >   fdisk -l > /dev/tty3
> > >   fdisk -l >> /tmp/reyinstall.log
> > >   cat >> /tmp/partfile << EOF
> > > part /boot --onpart hda1
> > > part swap  --onpart hda7
> > > part /     --onpart hda10
> > > part /tmp  --onpart hda6
> > > part /usr  --onpart hda5
> > > part /var  --onpart hda8
> > > part /opt  --onpart hda11
> > > part /rs1  --onpart hda9
> > > EOF
> > >   echo "/dev/hda11" > /tmp/INSMGR_DEV
> > > else # if no hdb, then cdrom is hda, and scsi disks exist
> > >   echo "Setting up SCSI based partitioning" > /dev/tty3
> > >   echo "Setting up SCSI based partitioning at `date`" >> 
> > > /tmp/reyinstall.log # okay, here we have to use fdisk to do 
> > > partitioning instead of letting # anaconda do it.  We already know its 
> > > a scsi device.  Just have to create # the right partitions with the 
> > > right sizes
> > > 
> > > # start out fresh
> > > echo | fdisk /dev/sda << EOF
> > > o
> > > w
> > > EOF
> > > # now start creating partitions
> > > echo | fdisk /dev/sda << EOF
> > > n
> > > p
> > > 1
> > > 
> > > +64M
> > > n
> > > e
> > > 2
> > > 
> > > 
> > > n
> > > l
> > > 
> > > +4096M
> > > n
> > > l
> > > 
> > > +2048M
> > > n
> > > l
> > > 
> > > +2047M
> > > t
> > > 7
> > > 82
> > > n
> > > l
> > > 
> > > +512M
> > > n
> > > l
> > > 
> > > +448M
> > > n
> > > l
> > > 
> > > +320M
> > > n
> > > l
> > > 
> > > +256M
> > > w
> > > EOF
> > >   echo "SCSI based partitioning completed" > /dev/tty3
> > >   echo "SCSI based partitioning completed at `date`" >>
> > /tmp/reyinstall.log
> > >   fdisk -l > /dev/tty3
> > >   fdisk -l >> /tmp/reyinstall.log
> > >   cat >> /tmp/partfile << EOF
> > > part /boot --onpart sda1
> > > part swap  --onpart sda7
> > > part /     --onpart sda10
> > > part /tmp  --onpart sda6
> > > part /usr  --onpart sda5
> > > part /var  --onpart sda8
> > > part /opt  --onpart sda11
> > > part /rs1  --onpart sda9
> > > EOF
> > >     echo "/dev/sda11" > /tmp/INSMGR_DEV
> > > fi
> > > %post --nochroot
> > > echo "Beginning postinstall steps" > /dev/tty3
> > > echo "Beginning postinstall steps at `date`" >> /tmp/reyinstall.log 
> > > ... stuff ... chroot /mnt/sysimage /tmp/postscript I
> > > echo "Done running chroot postscript" > /dev/tty3
> > > echo "Done running chroot postscript at `date`" >>
> > > /mnt/sysimage/tmp/reyinstall.
> > > log
> > > 
> > > Donald E. Bodle, Jr., RHCT
> > > Sr. Systems Integration Engineer
> > > Platform Development
> > > The Reynolds and Reynolds Co.
> > > (937) 485-1954
> > >  
> > > 
> > > 
> > > -----Original Message-----
> > > From: trax [mailto:traxtopel HotPOP com]
> > > Sent: Wednesday, August 27, 2003 2:39 PM
> > > To: kickstart-list redhat com
> > > Subject: %include statement
> > > 
> > > 
> > > Hi,
> > > can anyone show me an example of a ks.cfg which incorporates the 
> > > %include statement in it. I seem to have some issues getting mine to 
> > > read it correctly.
> -- 
> trax <traxtopel HotPOP com>
> 
> 
> 
> _______________________________________________
> Kickstart-list mailing list
> Kickstart-list redhat com
> https://www.redhat.com/mailman/listinfo/kickstart-list
> 





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]