--- cdrom.image/sme10/Packages/base/sme-kickstart.cfg 2016/05/31 12:37:44 1.3 +++ cdrom.image/sme10/Packages/base/sme-kickstart.cfg 2021/01/31 00:15:05 1.7 @@ -1,131 +1,190 @@ # System authorization information auth --enableshadow --passalgo=sha512 -# Use CDROM installation media -cdrom -# we do not want Selinux -selinux --disabled -# 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 - -%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 -if [ $GB -lt 40 ]; then +# We do not want SELinux +selinux --disabled -# 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 +# Services to activate +services --disabled=lm_sensors -EOF +# Default root pass, will be changed in post-install process anyway +rootpw --lock +user --name=installer --uid=9999 +# Accept EULA +eula --agreed -else -# drives 40GB and larger +# Partitioning from pre section +%include /tmp/part-include -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 +# Disable kdump +%addon com_redhat_kdump --disable +%end -EOF -fi +# Add netinstall repos +repo --name=smeos --baseurl=http://mirror.canada.pialasse.com/releases/testing/10/smeos/x86_64/ +repo --name=smeupdates --baseurl=http://mirror.canada.pialasse.com/releases/testing/10/smeupdates/x86_64/ +# Packages to install +%packages +@^minimal +@base +@core +-chrony +-kexec-tools %end +# Partitioning in pre-install +%pre --interpreter=/bin/bash --log=/var/log/ks.pre01.log +# Minimum size of hard drive needed specified in GB +MINSIZE=5 +# Number of detected drives +NDEV=0 +# Loop through block devices and keep those over MINSIZE +# TODO: Only pair up drives of the same size +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 +# Declare useful variables +printf -v DRIVELIST ",%s" "${DRIVES[@]}" +DRIVELIST=${DRIVELIST:1} +LEVEL=1 +SPARE=0 + +# Error if detection has failed and fall back +if [ ${#DRIVES[@]} == 0 ] ; then + echo "No drive suitable for installation found! Reverting to Anaconda defaults." + + cat > /tmp/part-include < /tmp/part-include <> /tmp/part-include + fi + cat >> /tmp/part-include <> /tmp/part-include + fi + printf "part raid.%s1 --size=500 --ondisk=%s\n" "$i" "${DRIVES[$i]}" >> /tmp/part-include + printf "part raid.%s2 --size=4300 --grow --ondisk=%s\n" "$i" "${DRIVES[$i]}" >> /tmp/part-include + done + + # Compute RAID level + # from https://wiki.contribs.org/Raid + # 2 Drives - Software RAID 1 + # 3 Drives - Software RAID 1 + 1 Hot-spare + # 4 Drives - Software RAID 6 + # 5+ Drives - Software RAID 6 + 1 Hot-spare + + if [ ${#DRIVES[@]} == 2 ] ; then + LEVEL=1 + SPARE=0 + elif [ ${#DRIVES[@]} == 3 ] ; then + LEVEL=1 + SPARE=1 + elif [ ${#DRIVES[@]} == 4 ] ; then + LEVEL=6 + SPARE=0 + else + LEVEL=6 + SPARE=1 + fi + # Set up RAID devices + printf -v EFIDEVS "raid.%s0 " "${!DRIVES[@]}" + printf -v BOOTDEVS "raid.%s1 " "${!DRIVES[@]}" + printf -v ROOTDEVS "raid.%s2 " "${!DRIVES[@]}" + + # Include the EFI partition if necessary + if [ -d /sys/firmware/efi ] ; then + printf "raid /boot/efi --fstype=efi --level=1 --spares=0 --device=md9 %s\n" "$EFIDEVS" >> /tmp/part-include + fi + printf "raid /boot --fstype=xfs --level=1 --spares=0 --device=md0 %s\n" "$BOOTDEVS" >> /tmp/part-include + printf "raid pv.01 --level=%s --spares=%s --device=md1 %s\n" "$LEVEL" "$SPARE" "$ROOTDEVS" >> /tmp/part-include + # Set up LVM + cat >> /tmp/part-include <