/[smeserver]/cdrom.image/sme10/netinstall/ks.cfg
ViewVC logotype

Diff of /cdrom.image/sme10/netinstall/ks.cfg

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

Revision 1.5 by jpp, Wed Feb 17 17:17:19 2021 UTC Revision 1.11 by jpp, Wed Jun 9 07:04:50 2021 UTC
# Line 23  eula --agreed Line 23  eula --agreed
23    
24    
25  # Add netinstall repos  # Add netinstall repos
26  url --url  https://mirror.canada.pialasse.com/releases/testing/10/smeos/x86_64/  #this one gives curl 6 errors on netinstall while added manually works from time to time
27  repo --name=smeupdates --baseurl=https://mirror.canada.pialasse.com/releases/testing/10/smeupdates/x86_64/  #url --mirrorlist https://mirrorlist.koozali.org/mirrorlist/smeos-10-x86_64
28    #repo --name=smeupdates --mirrorlist https://mirrorlist.koozali.org/mirrorlist/smeupdates-10-x86_64
29    repo --name=smeos --baseurl http://distro.ibiblio.org/pub/linux/distributions/smeserver/releases/10/smeos/x86_64/
30    repo --name=smeupdates --baseurl http://distro.ibiblio.org/pub/linux/distributions/smeserver/releases/testing/10/smeupdates/x86_64/
31    
32  # Packages to install  # Packages to install
33  %packages  %packages
# Line 37  repo --name=smeupdates --baseurl=https:/ Line 40  repo --name=smeupdates --baseurl=https:/
40    
41    
42  # Partitioning in pre-install  # Partitioning in pre-install
43  %pre --interpreter=/bin/bash --log=/var/log/ks.pre01.log  %pre --interpreter=/bin/bash --log=/var/log/sme-partitioning.log
44    
45  # Minimum size of hard drive needed specified in GB  # Read command line arguments
46  MINSIZE=5  if grep nolvm "/proc/cmdline" ; then NOLVM=true ; fi
47    if grep noraid "/proc/cmdline" ; then NORAID=true ; fi
48    if grep noxfs "/proc/cmdline" ; then FSTYPE="ext4" ; else FSTYPE="xfs" ; fi
49    echo "Command line arguments:"
50    cat /proc/cmdline
51    
52  # Number of detected drives  # Minimum size of hard drive needed specified in MB
53    MINSIZE=5000
54    
55    # Number of detected drives and first disk size
56  NDEV=0  NDEV=0
57    BASESIZE=0
58    SIZEDIFF=0
59    
60  # Loop through block devices and keep those over MINSIZE  # Loop through block devices, keep those over MINSIZE and ensure additional drives for RAID are within 100MB of the first
61  # TODO: Only pair up drives of the same size  for DEV in $(lsblk -nl | grep disk | cut -d' ' -f1) ; do
62  for DEV in $(lsblk -nl | grep disk | cut -d' ' -f1); do    if [ -d /sys/block/$DEV ] ; then
   if [ -d /sys/block/$DEV ]; then  
63      REMOVABLE=`cat /sys/block/$DEV/removable`      REMOVABLE=`cat /sys/block/$DEV/removable`
64      if (( $REMOVABLE == 0 )); then      if (( $REMOVABLE == 0 )) ; then
65        SIZE=`cat /sys/block/$DEV/size`        SIZE=`cat /sys/block/$DEV/size`
66        GB=$(($SIZE/2**21))        MB=$(($SIZE/2**11))
67        if [ $GB -gt $MINSIZE ]; then        if [ $MB -gt $MINSIZE ] ; then
68          DRIVES[$NDEV]=$DEV          if [ $NDEV == 0 ] ; then
69          ((NDEV++))            echo "First drive found: $DEV with size $MB MB"
70              DRIVES[$NDEV]=$DEV
71              BASESIZE=$MB
72              ((NDEV++))
73            else
74              SIZEDIFF=$(($MB-$BASESIZE))
75              if [ $SIZEDIFF -gt 100 ] || [ $SIZEDIFF -lt -100 ] ; then
76                echo "Drive found but size of $MB MB doesn't match $BASESIZE MB - ignoring"
77              else
78                echo "Additional drive found: $DEV with size $MB MB"
79                DRIVES[$NDEV]=$DEV
80                ((NDEV++))
81              fi
82            fi
83        fi        fi
84      fi      fi
85    fi    fi
86  done  done
87    echo "Total disks found: $NDEV"
88    
89    # Calculate recommended swap size for RAID + nolvm case
90    if [ -d /sys/firmware/efi ] ; then
91      DISKSPARE=$(($BASESIZE-200-500-3000))
92    else
93      DISKSPARE=$(($BASESIZE-1-500-3000))
94    fi
95    MEMSIZE=$(awk '/^MemTotal:/{print $2}' /proc/meminfo)
96    MEMSIZEMB=$(($MEMSIZE/2**10))
97    
98    if [ $MEMSIZEMB -lt 2000 ] ; then
99      SWAPSIZE=$((2*$MEMSIZEMB))
100    elif [ $MEMSIZEMB -lt 8000 ] ; then
101      SWAPSIZE=$MEMSIZEMB
102    else
103      SWAPSIZE=8000
104    fi
105    if [ $SWAPSIZE -gt $DISKSPARE ] ; then SWAPSIZE=$DISKSPARE ; fi
106    
107  # Declare useful variables  # Declare useful variables
108  printf -v DRIVELIST ",%s" "${DRIVES[@]}"  printf -v DRIVELIST ",%s" "${DRIVES[@]}"
109  DRIVELIST=${DRIVELIST:1}  if [ $NORAID ] ; then
110      DRIVELIST=${DRIVES[0]}
111    else
112      DRIVELIST=${DRIVELIST:1}
113    fi
114    
115    echo "Final drive list: $DRIVELIST"
116  LEVEL=1  LEVEL=1
117  SPARE=0  SPARE=0
118    
119    
120  # Error if detection has failed and fall back  # Error if detection has failed and fall back
121  if [ ${#DRIVES[@]} == 0 ] ; then  if [ ${#DRIVES[@]} == 0 ] ; then
122    echo "No drive suitable for installation found! Reverting to Anaconda defaults."    echo "No drive suitable for installation found! Reverting to Anaconda defaults."
# Line 94  else Line 144  else
144    bootloader --location=mbr --driveorder=$DRIVELIST    bootloader --location=mbr --driveorder=$DRIVELIST
145  EOF  EOF
146    
147    # If single disk then set up partitioning without RAID    # If single disk or noraid specific then set up partitioning without RAID
148    # NOTE: From this point we're appending to part-include    # NOTE: From this point we're appending to part-include
149    if [ ${#DRIVES[@]} == 1 ] ; then    if [ ${#DRIVES[@]} == 1 ] || [ $NORAID ] ; then
150    
151      # Include the EFI partition if necessary      # Include the EFI or biosboot partition if necessary
152      if [ -d /sys/firmware/efi ] ; then      if [ -d /sys/firmware/efi ] ; then
153        printf "part /boot/efi --fstype=efi --size=200 --ondisk=%s\n" "${DRIVES[0]}" >> /tmp/part-include        printf "part /boot/efi --fstype=efi --size=200 --ondisk=%s\n" "${DRIVES[0]}" >> /tmp/part-include
154        elif [ $BASESIZE -gt 2048000 ] ; then
155          printf "part biosboot --fstype=biosboot --size=1 --ondisk=%s\n" "${DRIVES[0]}" >> /tmp/part-include
156      fi      fi
157    
158      cat >> /tmp/part-include <<EOF      # Create boot partition
159      part /boot --fstype=xfs --size=500 --ondisk=${DRIVES[0]} --label=BOOT      printf "part /boot --fstype=%s --size=500  --label=BOOT --ondisk=%s\n" "$FSTYPE" "${DRIVES[0]}" >> /tmp/part-include
160      part pv.01 --size=4300 --grow --ondisk=${DRIVES[0]}  
161      volgroup main pv.01      # Default to LVM unless specified at command line
162      logvol / --fstype=xfs --name=root --vgname=main --grow --size=3000 --label=ROOT      if [ $NOLVM ] ; then
163      logvol swap --fstype=swap --name=swap --vgname=main --recommended --label=SWAP        cat >> /tmp/part-include <<EOF
164          part / --fstype=$FSTYPE --grow --size=3000 --label=ROOT --ondisk=${DRIVES[0]}
165          part swap --fstype=swap --recommended --label=SWAP --ondisk=${DRIVES[0]}
166  EOF  EOF
167        else
168          cat >> /tmp/part-include <<EOF
169          part pv.01 --size=4300 --grow --ondisk=${DRIVES[0]}
170          volgroup main pv.01
171          logvol / --fstype=$FSTYPE --name=root --vgname=main --grow --size=3000
172          logvol swap --fstype=swap --name=swap --vgname=main --recommended
173    EOF
174        fi
175    
176    # Otherwise multiple disks - prepare for RAID    # Otherwise multiple disks - prepare for RAID
177    else    else
178    
179      # Define EFI, boot and LVM RAID partitions      # Define EFI or biosboot and RAID partitions
180      for i in "${!DRIVES[@]}"; do      for i in "${!DRIVES[@]}"; do
181    
182        if [ -d /sys/firmware/efi ] ; then        if [ -d /sys/firmware/efi ] ; then
183          printf "part raid.%s0 --size=200 --ondisk=%s\n" "$i" "${DRIVES[$i]}" >> /tmp/part-include          printf "part raid.%s0 --size=200 --ondisk=%s\n" "$i" "${DRIVES[$i]}" >> /tmp/part-include
184          elif [ $BASESIZE -gt 2048000 ] ; then
185            printf "part biosboot --fstype=biosboot --size=1 --ondisk=%s\n" "${DRIVES[$i]}" >> /tmp/part-include
186        fi        fi
187        printf "part raid.%s1 --size=500 --ondisk=%s\n" "$i" "${DRIVES[$i]}" >> /tmp/part-include        printf "part raid.%s1 --size=500 --ondisk=%s\n" "$i" "${DRIVES[$i]}" >> /tmp/part-include
188        printf "part raid.%s2 --size=4300 --grow --ondisk=%s\n" "$i" "${DRIVES[$i]}" >> /tmp/part-include  
189          # Default to LVM unless specified
190          if [ $NOLVM ] ; then
191            printf "part raid.%s2 --size=3000 --grow --ondisk=%s\n" "$i" "${DRIVES[$i]}" >> /tmp/part-include
192            printf "part raid.%s3 --size=%s --ondisk=%s\n" "$i" "$SWAPSIZE" "${DRIVES[$i]}" >> /tmp/part-include
193          else
194            printf "part raid.%s2 --size=4300 --grow --ondisk=%s\n" "$i" "${DRIVES[$i]}" >> /tmp/part-include
195          fi
196    
197      done      done
198    
199      # Compute RAID level      # Compute RAID level
# Line 148  EOF Line 221  EOF
221      printf -v EFIDEVS "raid.%s0 " "${!DRIVES[@]}"      printf -v EFIDEVS "raid.%s0 " "${!DRIVES[@]}"
222      printf -v BOOTDEVS "raid.%s1 " "${!DRIVES[@]}"      printf -v BOOTDEVS "raid.%s1 " "${!DRIVES[@]}"
223      printf -v ROOTDEVS "raid.%s2 " "${!DRIVES[@]}"      printf -v ROOTDEVS "raid.%s2 " "${!DRIVES[@]}"
224        printf -v SWAPDEVS "raid.%s3 " "${!DRIVES[@]}"
225            
226      # Include the EFI partition if necessary      # Include the EFI partition if necessary
227      if [ -d /sys/firmware/efi ] ; then      if [ -d /sys/firmware/efi ] ; then
228        printf "raid /boot/efi --fstype=efi --level=1 --spares=0 --device=md9 %s\n" "$EFIDEVS" >> /tmp/part-include        printf "raid /boot/efi --fstype=efi --level=1 --spares=0 --device=md9 %s\n" "$EFIDEVS" >> /tmp/part-include
229      fi      fi
230    
231      printf "raid /boot --fstype=xfs --level=1 --spares=0 --device=md0 %s\n" "$BOOTDEVS" >> /tmp/part-include      # Boot partition
232      printf "raid pv.01 --level=%s --spares=%s --device=md1 %s\n" "$LEVEL" "$SPARE" "$ROOTDEVS" >> /tmp/part-include      printf "raid /boot --fstype=%s --level=1 --spares=0 --device=md0 %s\n" "$FSTYPE" "$BOOTDEVS" >> /tmp/part-include
233    
234      # Set up LVM      # Default to LVM unless specified
235      cat >> /tmp/part-include <<EOF      if [ $NOLVM ] ; then
236      volgroup main pv.01        cat >> /tmp/part-include <<EOF
237      logvol / --fstype xfs --name=root --vgname=main --grow --size=3000 --label=ROOT        raid / --fstype=$FSTYPE --level=$LEVEL --spares=$SPARE --device=md1 $ROOTDEVS
238      logvol swap --fstype swap --name=swap --vgname=main --recommended --label=SWAP        raid swap --fstype=swap --level=$LEVEL --spares=$SPARE --device=md2 $SWAPDEVS
239  EOF  EOF
240        else
241          cat >> /tmp/part-include <<EOF
242          raid pv.01 --level=$LEVEL --spares=$SPARE --device=md1 $ROOTDEVS
243          volgroup main pv.01
244          logvol / --fstype=$FSTYPE --name=root --vgname=main --grow --size=3000
245          logvol swap --fstype swap --name=swap --vgname=main --recommended
246    EOF
247        fi
248    fi    fi
249  fi  fi
250    
251    echo "Final part-include output:"
252    cat /tmp/part-include
253    
254  %end  %end
255    
256    
# Line 184  touch /forcequotacheck Line 268  touch /forcequotacheck
268  %post  --nochroot --log=/mnt/sysimage/var/log/ks.post01.log  %post  --nochroot --log=/mnt/sysimage/var/log/ks.post01.log
269  #!/bin/bash  #!/bin/bash
270  sysimage="/mnt/sysimage"  sysimage="/mnt/sysimage"
271    cp -r /var/log/sme-partitioning.log ${sysimage}/root/
272  cp -r /tmp/anaconda.log ${sysimage}/root/  cp -r /tmp/anaconda.log ${sysimage}/root/
273  %end  %end


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed