--- cdrom.image/sme10/Packages/base/sme-kickstart.cfg 2016/05/30 09:31:44 1.2 +++ cdrom.image/sme10/Packages/base/sme-kickstart.cfg 2016/05/31 12:37:44 1.3 @@ -2,55 +2,108 @@ auth --enableshadow --passalgo=sha512 # Use CDROM installation media cdrom -# Use graphical install -#graphical -#%include /usr/share/anaconda/interactive-defaults.ks -#install -ignoredisk --only-use=vda -# Keyboard layouts -keyboard --xlayouts='us' -# System language -lang en_US.UTF-8 +# we do not want Selinux selinux --disabled -#reboot +# services to activate +services --disabled=lm_sensors +# default root pass, willbe changed in post-install process anyway +rootpw --lock +# include the partitioning logic from the pre section. +%include /tmp/part-include -# System timezone -timezone America/New_York --isUtc +%pre +# pre section +#----- partitioning logic below-------------- +# pick the first drive that is not removable and is over MINSIZE +DIR="/sys/block" + +# minimum size of hard drive needed specified in GIGABYTES +MINSIZE=20 + +ROOTDRIVE="" + +# /sys/block/*/size is in 512 byte chunks + +for DEV in sda sdb sdc sdd hda hdb vda vdb xvda xvdb; do + if [ -d $DIR/$DEV ]; then + REMOVABLE=`cat $DIR/$DEV/removable` + if (( $REMOVABLE == 0 )); then + echo $DEV + SIZE=`cat $DIR/$DEV/size` + GB=$(($SIZE/2**21)) + if [ $GB -gt $MINSIZE ]; then + echo "$(($SIZE/2**21))" + if [ -z $ROOTDRIVE ]; then + ROOTDRIVE=$DEV + fi + fi + fi + fi +done + +echo "ROOTDRIVE=$ROOTDRIVE" +# drives smaller than 40GB use smaller boot and swap partitions +# drives larger than 40GB use percentage-based partition sizes -# System bootloader configuration -bootloader --append=" crashkernel=auto quiet" --location=mbr --boot-drive=vda -#Clear the Master Boot Record -#zerombr yes +if [ $GB -lt 40 ]; then + +# drives smaller than 40GB +cat << EOF > /tmp/part-include zerombr +clearpart --all --drives=$ROOTDRIVE --initlabel +bootloader --location=mbr --driveorder=$ROOTDRIVE +# for boot partition +part /boot --fstype ext4 --size=300 --ondisk=$ROOTDRIVE +# for LVM partition +part pv.8 --size=4600 --grow --ondisk=$ROOTDRIVE +# LVM +volgroup main --pesize=65536 pv.8 +logvol / --fstype ext4 --name=root --vgname=main --grow --size=3000 +logvol swap --fstype swap --name=swap --vgname=main --size=1500 + +EOF + + +else +# drives 40GB and larger + +cat << EOF > /tmp/part-include +zerombr +clearpart --all --drives=$ROOTDRIVE --initlabel +bootloader --location=mbr --driveorder=$ROOTDRIVE +# for boot partition +part /boot --fstype ext4 --size=500 --ondisk=$ROOTDRIVE +# for LVM partition +part pv.8 --size=4600 --grow --ondisk=$ROOTDRIVE +# LVM +volgroup main --pesize=65536 pv.8 +logvol / --fstype ext4 --name=root --vgname=main --grow --size=3000 +logvol swap --fstype swap --name=swap --vgname=main --size=4000 + +EOF + +fi + +%end + + + + + + + + + + + + -# Partition clearing information -#clearpart --all --initlabel --drives=vda -# autopartionning -autopart --type=lvm -## Disks for 500 MB boot partition -#part raid.01 --size=500 --asprimary --ondisk=vda -#part raid.02 --size=500 --asprimary --ondisk=vdb - -## Disks for LVM partition -#part raid.11 --size=1 --grow --ondisk=vda -#part raid.12 --size=1 --grow --ondisk=vdb - -## RAID settings -#raid /boot --fstype ext2 --device md0 --level=RAID1 raid.01 raid.02 -#raid pv.01 --device md1 --level=RAID1 raid.11 raid.12 - -# LVM configuration -#volgroup vg pv.01 -#logvol / --vgname=vg --size=1 --grow --fstype ext3 --name=root -#logvol swap --vgname=vg --recommended --name=swap -# services to activate -services --disabled=lm_sensors # packages to install %packages @^minimal