--- 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/07/02 11:34:04 1.4 @@ -1,56 +1,93 @@ # System authorization information 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 +#cdrom #what about usb stick + +# 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 -# System timezone -timezone America/New_York --isUtc +# Accept eula +eula --agreed +# include the partitioning logic from the pre section. +%include /tmp/part-include +# disable kdump +%addon com_redhat_kdump --disable +%end + + +%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=5 + + +# Number of detected drives +NDEV=0 + +for DEV in $(lsblk -nl | grep disk | cut -d' ' -f1); do + if [ -d /sys/block/$DEV ]; then + REMOVABLE=`cat /sys/block/$DEV/removable` + if (( $REMOVABLE == 0 )); then + SIZE=`cat /sys/block/$DEV/size` + GB=$(($SIZE/2**21)) + if [ $GB -gt $MINSIZE ]; then + DRIVES[$NDEV]=$DEV + ((NDEV++)) + fi + fi + fi +done + +# For now keep things simple and just use the first one +# TODO: +# * Create software RAID depending on the number of detected drives +# * Allow non LVM install + +ROOTDRIVE=${DRIVES[0]} +if [ $ROOTDRIVE == "" ] ; then +echo "No drive suitable for installation found! Please proceed manually." +# first in case detection fails... +cat << EOF > /tmp/part-include +# Clear the Master Boot Record +zerombr # System bootloader configuration -bootloader --append=" crashkernel=auto quiet" --location=mbr --boot-drive=vda -#Clear the Master Boot Record -#zerombr yes +clearpart --all --initlabel +# Automatically create partitions, no LVM +autopart --lvm + +EOF + +else +cat <<_EOF > /tmp/part-include zerombr +clearpart --all --drives=$ROOTDRIVE --initlabel +bootloader --boot-drive=$ROOTDRIVE +part /boot --fstype xfs --size=500 --ondisk=$ROOTDRIVE --label=BOOT +part pv.01 --size=4500 --grow --ondisk=$ROOTDRIVE +volgroup main pv.01 +logvol / --fstype xfs --name=root --vgname=main --grow --size=3000 --label=ROOT +logvol swap --fstype swap --name=swap --vgname=main --recommended --label=SWAP +_EOF -# Partition clearing information -#clearpart --all --initlabel --drives=vda +fi -# autopartionning -autopart --type=lvm +%end -## 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 @@ -62,9 +99,8 @@ services --disabled=lm_sensors %end -# pre script could be inserted there to handle partitionning -%post --interpreter=/usr/bin/bash +%post --interpreter=/usr/bin/bash --log=/var/log/ks.post02.log # before reboot performing post-install # this is for first alpha iso. we should put this in anaconda # and / or handle possible upgrade later @@ -76,3 +112,10 @@ sleep 2; touch /forcequotacheck %end + +%post --nochroot --log=/mnt/sysimage/var/log/ks.post01.log +#!/bin/bash +sysimage="/mnt/sysimage" + +cp -r /tmp/anaconda.log ${sysimage}/root/ +%end