/[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.4 by chrissn, Sun Jan 31 00:15:05 2021 UTC Revision 1.13 by jpp, Sun Apr 17 16:24:12 2022 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/  url --mirrorlist https://mirrorlist.koozali.org/mirrorlist/smeos-10-x86_64
27  repo --name=smeupdates --baseurl=https://mirror.canada.pialasse.com/releases/testing/10/smeupdates/x86_64/  repo --name=smeupdates --mirrorlist https://mirrorlist.koozali.org/mirrorlist/smeupdates-10-x86_64
28    repo --name=remi-safe --baseurl  http://rpms.famillecollet.com/enterprise/7/safe/x86_6/
29    #url --url 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/10/smeupdates/x86_64/
31    
32  # Packages to install  # Packages to install
33    # need to unselect to be able to use mirrorlist or anaconda errors before loading repo.
34  %packages  %packages
35  @^minimal  #@^minimal
36  @base  #@base
37  @core  #@core
38  -chrony  -chrony
39  -kexec-tools  -kexec-tools
40  %end  %end
41    
42    
43  # Partitioning in pre-install  # Partitioning in pre-install
44  %pre --interpreter=/bin/bash --log=/var/log/ks.pre01.log  %pre --interpreter=/bin/bash --log=/var/log/sme-partitioning.log
45    
46  # Minimum size of hard drive needed specified in GB  # Read command line arguments
47  MINSIZE=5  if grep nolvm "/proc/cmdline" ; then NOLVM=true ; fi
48    if grep noraid "/proc/cmdline" ; then NORAID=true ; fi
49    if grep noxfs "/proc/cmdline" ; then FSTYPE="ext4" ; else FSTYPE="xfs" ; fi
50    echo "Command line arguments:"
51    cat /proc/cmdline
52    
53  # Number of detected drives  # Minimum size of hard drive needed specified in MB
54    MINSIZE=5000
55    
56    # Number of detected drives and first disk size
57  NDEV=0  NDEV=0
58    BASESIZE=0
59    SIZEDIFF=0
60    
61  # 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
62  # TODO: Only pair up drives of the same size  for DEV in $(lsblk -nl | grep disk | cut -d' ' -f1) ; do
63  for DEV in $(lsblk -nl | grep disk | cut -d' ' -f1); do    if [ -d /sys/block/$DEV ] ; then
   if [ -d /sys/block/$DEV ]; then  
64      REMOVABLE=`cat /sys/block/$DEV/removable`      REMOVABLE=`cat /sys/block/$DEV/removable`
65      if (( $REMOVABLE == 0 )); then      if (( $REMOVABLE == 0 )) ; then
66        SIZE=`cat /sys/block/$DEV/size`        SIZE=`cat /sys/block/$DEV/size`
67        GB=$(($SIZE/2**21))        MB=$(($SIZE/2**11))
68        if [ $GB -gt $MINSIZE ]; then        if [ $MB -gt $MINSIZE ] ; then
69          DRIVES[$NDEV]=$DEV          if [ $NDEV == 0 ] ; then
70          ((NDEV++))            echo "First drive found: $DEV with size $MB MB"
71              DRIVES[$NDEV]=$DEV
72              BASESIZE=$MB
73              ((NDEV++))
74            else
75              SIZEDIFF=$(($MB-$BASESIZE))
76              if [ $SIZEDIFF -gt 100 ] || [ $SIZEDIFF -lt -100 ] ; then
77                echo "Drive found but size of $MB MB doesn't match $BASESIZE MB - ignoring"
78              else
79                echo "Additional drive found: $DEV with size $MB MB"
80                DRIVES[$NDEV]=$DEV
81                ((NDEV++))
82              fi
83            fi
84        fi        fi
85      fi      fi
86    fi    fi
87  done  done
88    echo "Total disks found: $NDEV"
89    
90    # Calculate recommended swap size for RAID + nolvm case
91    if [ -d /sys/firmware/efi ] ; then
92      DISKSPARE=$(($BASESIZE-200-500-3000))
93    else
94      DISKSPARE=$(($BASESIZE-1-500-3000))
95    fi
96    MEMSIZE=$(awk '/^MemTotal:/{print $2}' /proc/meminfo)
97    MEMSIZEMB=$(($MEMSIZE/2**10))
98    
99    if [ $MEMSIZEMB -lt 2000 ] ; then
100      SWAPSIZE=$((2*$MEMSIZEMB))
101    elif [ $MEMSIZEMB -lt 8000 ] ; then
102      SWAPSIZE=$MEMSIZEMB
103    else
104      SWAPSIZE=8000
105    fi
106    if [ $SWAPSIZE -gt $DISKSPARE ] ; then SWAPSIZE=$DISKSPARE ; fi
107    
108  # Declare useful variables  # Declare useful variables
109  printf -v DRIVELIST ",%s" "${DRIVES[@]}"  printf -v DRIVELIST ",%s" "${DRIVES[@]}"
110  DRIVELIST=${DRIVELIST:1}  if [ $NORAID ] ; then
111      DRIVELIST=${DRIVES[0]}
112    else
113      DRIVELIST=${DRIVELIST:1}
114    fi
115    
116    echo "Final drive list: $DRIVELIST"
117  LEVEL=1  LEVEL=1
118  SPARE=0  SPARE=0
119    
120    
121  # Error if detection has failed and fall back  # Error if detection has failed and fall back
122  if [ ${#DRIVES[@]} == 0 ] ; then  if [ ${#DRIVES[@]} == 0 ] ; then
123    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 145  else
145    bootloader --location=mbr --driveorder=$DRIVELIST    bootloader --location=mbr --driveorder=$DRIVELIST
146  EOF  EOF
147    
148    # If single disk then set up partitioning without RAID    # If single disk or noraid specific then set up partitioning without RAID
149    # NOTE: From this point we're appending to part-include    # NOTE: From this point we're appending to part-include
150    if [ ${#DRIVES[@]} == 1 ] ; then    if [ ${#DRIVES[@]} == 1 ] || [ $NORAID ] ; then
151    
152      # Include the EFI partition if necessary      # Include the EFI or biosboot partition if necessary
153      if [ -d /sys/firmware/efi ] ; then      if [ -d /sys/firmware/efi ] ; then
154        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
155        elif [ $BASESIZE -gt 2048000 ] ; then
156          printf "part biosboot --fstype=biosboot --size=1 --ondisk=%s\n" "${DRIVES[0]}" >> /tmp/part-include
157      fi      fi
158    
159      cat >> /tmp/part-include <<EOF      # Create boot partition
160      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
161      part pv.01 --size=4300 --grow --ondisk=${DRIVES[0]}  
162      volgroup main pv.01      # Default to LVM unless specified at command line
163      logvol / --fstype=xfs --name=root --vgname=main --grow --size=3000 --label=ROOT      if [ $NOLVM ] ; then
164      logvol swap --fstype=swap --name=swap --vgname=main --recommended --label=SWAP        cat >> /tmp/part-include <<EOF
165          part / --fstype=$FSTYPE --grow --size=3000 --label=ROOT --ondisk=${DRIVES[0]}
166          part swap --fstype=swap --recommended --label=SWAP --ondisk=${DRIVES[0]}
167  EOF  EOF
168        else
169          cat >> /tmp/part-include <<EOF
170          part pv.01 --size=4300 --grow --ondisk=${DRIVES[0]}
171          volgroup main pv.01
172          logvol / --fstype=$FSTYPE --name=root --vgname=main --grow --size=3000
173          logvol swap --fstype=swap --name=swap --vgname=main --recommended
174    EOF
175        fi
176    
177    # Otherwise multiple disks - prepare for RAID    # Otherwise multiple disks - prepare for RAID
178    else    else
179    
180      # Define EFI, boot and LVM RAID partitions      # Define EFI or biosboot and RAID partitions
181      for i in "${!DRIVES[@]}"; do      for i in "${!DRIVES[@]}"; do
182    
183        if [ -d /sys/firmware/efi ] ; then        if [ -d /sys/firmware/efi ] ; then
184          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
185          elif [ $BASESIZE -gt 2048000 ] ; then
186            printf "part biosboot --fstype=biosboot --size=1 --ondisk=%s\n" "${DRIVES[$i]}" >> /tmp/part-include
187        fi        fi
188        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
189        printf "part raid.%s2 --size=4300 --grow --ondisk=%s\n" "$i" "${DRIVES[$i]}" >> /tmp/part-include  
190          # Default to LVM unless specified
191          if [ $NOLVM ] ; then
192            printf "part raid.%s2 --size=3000 --grow --ondisk=%s\n" "$i" "${DRIVES[$i]}" >> /tmp/part-include
193            printf "part raid.%s3 --size=%s --ondisk=%s\n" "$i" "$SWAPSIZE" "${DRIVES[$i]}" >> /tmp/part-include
194          else
195            printf "part raid.%s2 --size=4300 --grow --ondisk=%s\n" "$i" "${DRIVES[$i]}" >> /tmp/part-include
196          fi
197    
198      done      done
199    
200      # Compute RAID level      # Compute RAID level
# Line 148  EOF Line 222  EOF
222      printf -v EFIDEVS "raid.%s0 " "${!DRIVES[@]}"      printf -v EFIDEVS "raid.%s0 " "${!DRIVES[@]}"
223      printf -v BOOTDEVS "raid.%s1 " "${!DRIVES[@]}"      printf -v BOOTDEVS "raid.%s1 " "${!DRIVES[@]}"
224      printf -v ROOTDEVS "raid.%s2 " "${!DRIVES[@]}"      printf -v ROOTDEVS "raid.%s2 " "${!DRIVES[@]}"
225        printf -v SWAPDEVS "raid.%s3 " "${!DRIVES[@]}"
226            
227      # Include the EFI partition if necessary      # Include the EFI partition if necessary
228      if [ -d /sys/firmware/efi ] ; then      if [ -d /sys/firmware/efi ] ; then
229        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
230      fi      fi
231    
232      printf "raid /boot --fstype=xfs --level=1 --spares=0 --device=md0 %s\n" "$BOOTDEVS" >> /tmp/part-include      # Boot partition
233      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
234    
235      # Set up LVM      # Default to LVM unless specified
236      cat >> /tmp/part-include <<EOF      if [ $NOLVM ] ; then
237      volgroup main pv.01        cat >> /tmp/part-include <<EOF
238      logvol / --fstype xfs --name=root --vgname=main --grow --size=3000 --label=ROOT        raid / --fstype=$FSTYPE --level=$LEVEL --spares=$SPARE --device=md1 $ROOTDEVS
239      logvol swap --fstype swap --name=swap --vgname=main --recommended --label=SWAP        raid swap --fstype=swap --level=$LEVEL --spares=$SPARE --device=md2 $SWAPDEVS
240  EOF  EOF
241        else
242          cat >> /tmp/part-include <<EOF
243          raid pv.01 --level=$LEVEL --spares=$SPARE --device=md1 $ROOTDEVS
244          volgroup main pv.01
245          logvol / --fstype=$FSTYPE --name=root --vgname=main --grow --size=3000
246          logvol swap --fstype swap --name=swap --vgname=main --recommended
247    EOF
248        fi
249    fi    fi
250  fi  fi
251    
252    echo "Final part-include output:"
253    cat /tmp/part-include
254    
255  %end  %end
256    
257    
# Line 174  fi Line 259  fi
259  %post  --interpreter=/usr/bin/bash --log=/var/log/ks.post02.log  %post  --interpreter=/usr/bin/bash --log=/var/log/ks.post02.log
260  userdel -r installer  userdel -r installer
261  sleep 2  sleep 2
 /sbin/rsyslogd  
 sleep 2  
262  /sbin/e-smith/signal-event post-install  /sbin/e-smith/signal-event post-install
263  sleep 2  sleep 2
264  /sbin/e-smith/db configuration set UnsavedChanges no  /sbin/e-smith/db configuration set UnsavedChanges no
# Line 186  touch /forcequotacheck Line 269  touch /forcequotacheck
269  %post  --nochroot --log=/mnt/sysimage/var/log/ks.post01.log  %post  --nochroot --log=/mnt/sysimage/var/log/ks.post01.log
270  #!/bin/bash  #!/bin/bash
271  sysimage="/mnt/sysimage"  sysimage="/mnt/sysimage"
272    cp -r /var/log/sme-partitioning.log ${sysimage}/root/
273  cp -r /tmp/anaconda.log ${sysimage}/root/  cp -r /tmp/anaconda.log ${sysimage}/root/
274  %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