Re: Conditional partitioning/formatting of device possible

Francisco Javier Lloreda Sanchez <[email protected]>
Newsgroups gmane.linux.redhat.kickstart.general
Message-ID <[email protected]>
You can use a pre script to detect if is previously partitioned or not 
and then use something similar to:

%pre
#!/bin/sh

Discover condition

if condition;
then
     echo "part /boot --fstype ext3 --size=100 --ondisk=$DISCO" >> 
/tmp/part-include
     echo "part pv.100000 --size=1 --grow --ondisk=$DISCO" >>  
/tmp/part-include
     echo "volgroup Merca --pesize=32768 pv.100000" >> /tmp/part-include
     echo "logvol swap --fstype swap --name=Swap --vgname=Merca 
--size=2047" >> /tmp/part-include
     echo "logvol  / --fstype ext4 --name=root --vgname=Merca 
--size=2048" >> /tmp/part-include
     echo "logvol /home --fstype ext4 --size=1000 --name=home 
--vgname=Merca" >> /tmp/part-include
else
     echo "part /boot --fstype ext3 --size=100 --ondisk=$DISCO" >> 
/tmp/part-include
     echo "volgroup Merca --pesize=32768 --useexisting --noformat" >> 
/tmp/part-include
     echo "logvol swap --fstype swap --name=Swap --vgname=Merca 
--size=2047 --useexisting --noformat" >> /tmp/part-include
     echo "logvol  / --fstype ext4 --name=root --vgname=Merca 
--size=2048 --useexisting --noformat" >> /tmp/part-include
     echo "logvol /home --fstype ext4 --size=1000 --name=home 
--vgname=Merca --useexisting --noformat" >> /tmp/part-include
fi

Later in the partitioning section use %include /tmp/part-include

Hope this helps to you :)

--
Francisco Javier Lloreda
Red Hat Consultant
( RHCA , RHCDS , RHCVA ) #110-651-718
[email protected]
Mobile: 0034 600 48 39 73

c/ Jose Bardasano Baos, No. 9
Edificio Gorbea 3
Madrid, 28016 SPAIN

El 21/01/13 08:29, Fred van Zwieten escribió:
> Hi there,
>
> Is there a possibility in the kickstart syntax to partition/format a 
> device, but only if it's not already partitioned/formatted.
>
> Use case: I have a server with a data disk. First time deployment it 
> should be partitioned and formatted. Second time, the data partition 
> must be left as is and only mounted.
>
> I now about --noformat, but how to make that conditional?
>
> If not possible, I must use %post. Any examples on how to do this 
> there using bash or python?
>
> Regards,
>
> Fred
>
>
> _______________________________________________
> Kickstart-list mailing list
> [email protected]
> https://www.redhat.com/mailman/listinfo/kickstart-list

_______________________________________________
Kickstart-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/kickstart-list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.