--- cdrom.image/sme10/Packages/base/sme-kickstart.cfg 2016/07/02 11:34:04 1.4 +++ cdrom.image/sme10/Packages/base/sme-kickstart.cfg 2021/01/31 00:15:05 1.7 @@ -1,42 +1,52 @@ # System authorization information auth --enableshadow --passalgo=sha512 -# Use CDROM installation media -#cdrom #what about usb stick - -# we do not want Selinux +# We do not want SELinux selinux --disabled -# services to activate +# Services to activate services --disabled=lm_sensors -# default root pass, willbe changed in post-install process anyway -rootpw --lock +# Default root pass, will be changed in post-install process anyway +rootpw --lock +user --name=installer --uid=9999 -# Accept eula +# Accept EULA eula --agreed -# include the partitioning logic from the pre section. +# Partitioning from pre section %include /tmp/part-include -# disable kdump +# 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" +# 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 -# minimum size of hard drive needed specified in GIGABYTES -MINSIZE=5 +# 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` @@ -51,71 +61,130 @@ for DEV in $(lsblk -nl | grep disk | cut 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 -clearpart --all --initlabel -# Automatically create partitions, no LVM -autopart --lvm +# 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 -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 + cat > /tmp/part-include <> /tmp/part-include + fi -%end + 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 -# packages to install -%packages -@^minimal -@base -@core --chrony --kexec-tools + # 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 -%end + 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 <