/[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.1 by jpp, Sat Jun 13 20:01:09 2020 UTC Revision 1.13 by jpp, Sun Apr 17 16:24:12 2022 UTC
# Line 1  Line 1 
1  # System authorization information  # System authorization information
2  auth --enableshadow --passalgo=sha512  auth --enableshadow --passalgo=sha512
3    
4  # we do not want Selinux  # We do not want SELinux
5  selinux --disabled  selinux --disabled
6    
7  # services to activate  # Services to activate
8  services --disabled=lm_sensors  services --disabled=lm_sensors
9    
10  # default root pass, willbe changed in post-install process anyway  # Default root pass, will be changed in post-install process anyway
11  rootpw --lock  rootpw --lock
12    user --name=installer --uid=9999
13    
14  # Accept eula  # Accept EULA
15  eula --agreed  eula --agreed
16    
17  # include the partitioning logic from the pre section.  # Partitioning from pre section
18  %include /tmp/part-include  %include /tmp/part-include
19    
20  # disable kdump  # Disable kdump
21  %addon com_redhat_kdump --disable  %addon com_redhat_kdump --disable
22  %end  %end
23    
 # added for netinstall  
 url --url  https://mirror.canada.pialasse.com/releases/testing/10/smeos/x86_64/  
 repo --name=smeupdates --baseurl=https://mirror.canada.pialasse.com/releases/testing/10/smeupdates/x86_64/  
 #repo --name=remi-safe --baseurl=http://rpms.famillecollet.com/enterprise/7/safe/x86_64/  
 #repo --name=smeupdates-testing --baseurl=http://mirror.canada.pialasse.com/releases/testing/10/smeupdates-testing/x86_64/  
 #firewall --disabled  
 # /added for netinstall  
   
 %pre --interpreter=/bin/bash  
 # pre section  
 #----- partitioning logic below--------------  
 # pick the first drive that is not removable and is over MINSIZE  
 DIR="/sys/block"  
24    
25  # minimum size of hard drive needed specified in GIGABYTES  # Add netinstall repos
26  MINSIZE=5  url --mirrorlist https://mirrorlist.koozali.org/mirrorlist/smeos-10-x86_64
27    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
33    # need to unselect to be able to use mirrorlist or anaconda errors before loading repo.
34    %packages
35    #@^minimal
36    #@base
37    #@core
38    -chrony
39    -kexec-tools
40    %end
41    
42    
43    # Partitioning in pre-install
44    %pre --interpreter=/bin/bash --log=/var/log/sme-partitioning.log
45    
46    # Read command line arguments
47    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  for DEV in $(lsblk -nl | grep disk | cut -d' ' -f1); do  # Loop through block devices, keep those over MINSIZE and ensure additional drives for RAID are within 100MB of the first
62    if [ -d /sys/block/$DEV ]; then  for DEV in $(lsblk -nl | grep disk | cut -d' ' -f1) ; do
63      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  # For now keep things simple and just use the first one  # Calculate recommended swap size for RAID + nolvm case
91  # TODO:  if [ -d /sys/firmware/efi ] ; then
92  # * Create software RAID depending on the number of detected drives    DISKSPARE=$(($BASESIZE-200-500-3000))
93  # * Allow non LVM install  else
94      DISKSPARE=$(($BASESIZE-1-500-3000))
95  ROOTDRIVE=${DRIVES[0]}  fi
96  if [ $ROOTDRIVE == "" ] ; then  MEMSIZE=$(awk '/^MemTotal:/{print $2}' /proc/meminfo)
97  echo "No drive suitable for installation found! Please proceed manually."  MEMSIZEMB=$(($MEMSIZE/2**10))
 # 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  
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
109    printf -v DRIVELIST ",%s" "${DRIVES[@]}"
110    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
118    SPARE=0
119    
120    
121    # Error if detection has failed and fall back
122    if [ ${#DRIVES[@]} == 0 ] ; then
123      echo "No drive suitable for installation found! Reverting to Anaconda defaults."
124    
125      cat > /tmp/part-include <<EOF
126      # Clear the Master Boot Record
127      zerombr
128    
129      # Clear current partitions
130      clearpart --all  --initlabel
131    
132      # Automatically create partitions using LVM
133      autopart --lvm --nohome
134  EOF  EOF
135    
136    # Otherwise clear detected devices and set up bootloader
137  else  else
138  cat <<_EOF > /tmp/part-include    cat > /tmp/part-include <<EOF
139  zerombr    # Clear the Master Boot Record
140  clearpart --all --drives=$ROOTDRIVE --initlabel    zerombr
141  bootloader --boot-drive=$ROOTDRIVE  
142  part /boot --fstype xfs --size=500 --ondisk=$ROOTDRIVE --label=BOOT    # Clear current partitions and install bootloader
143  part pv.01 --size=4500 --grow --ondisk=$ROOTDRIVE    clearpart --all --drives=$DRIVELIST --initlabel
144  volgroup main pv.01    ignoredisk --only-use=$DRIVELIST
145  logvol / --fstype xfs --name=root --vgname=main --grow --size=3000 --label=ROOT    bootloader --location=mbr --driveorder=$DRIVELIST
146  logvol swap --fstype swap --name=swap --vgname=main --recommended --label=SWAP  EOF
 _EOF  
147    
148  fi    # If single disk or noraid specific then set up partitioning without RAID
149      # NOTE: From this point we're appending to part-include
150      if [ ${#DRIVES[@]} == 1 ] || [ $NORAID ] ; then
151    
152        # Include the EFI or biosboot partition if necessary
153        if [ -d /sys/firmware/efi ] ; then
154          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
158    
159  %end      # Create boot partition
160        printf "part /boot --fstype=%s --size=500  --label=BOOT --ondisk=%s\n" "$FSTYPE" "${DRIVES[0]}" >> /tmp/part-include
161    
162        # Default to LVM unless specified at command line
163        if [ $NOLVM ] ; then
164          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
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
178      else
179    
180  # packages to install      # Define EFI or biosboot and RAID partitions
181  %packages      for i in "${!DRIVES[@]}"; do
182  @base  
183  @core        if [ -d /sys/firmware/efi ] ; then
184  -chrony          printf "part raid.%s0 --size=200 --ondisk=%s\n" "$i" "${DRIVES[$i]}" >> /tmp/part-include
185  -kexec-tools        elif [ $BASESIZE -gt 2048000 ] ; then
186  -firewalld          printf "part biosboot --fstype=biosboot --size=1 --ondisk=%s\n" "${DRIVES[$i]}" >> /tmp/part-include
187  %end        fi
188          printf "part raid.%s1 --size=500 --ondisk=%s\n" "$i" "${DRIVES[$i]}" >> /tmp/part-include
189    
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
199    
200        # Compute RAID level
201        # from https://wiki.contribs.org/Raid
202        # 2 Drives - Software RAID 1
203        # 3 Drives - Software RAID 1 + 1 Hot-spare
204        # 4 Drives - Software RAID 6
205        # 5+ Drives - Software RAID 6 + 1 Hot-spare
206    
207        if [ ${#DRIVES[@]} == 2 ] ; then
208          LEVEL=1
209          SPARE=0
210        elif [ ${#DRIVES[@]} == 3 ] ; then
211          LEVEL=1
212          SPARE=1
213        elif [ ${#DRIVES[@]} == 4 ] ; then
214          LEVEL=6
215          SPARE=0
216        else
217          LEVEL=6
218          SPARE=1
219        fi
220    
221        # Set up RAID devices
222        printf -v EFIDEVS "raid.%s0 " "${!DRIVES[@]}"
223        printf -v BOOTDEVS "raid.%s1 " "${!DRIVES[@]}"
224        printf -v ROOTDEVS "raid.%s2 " "${!DRIVES[@]}"
225        printf -v SWAPDEVS "raid.%s3 " "${!DRIVES[@]}"
226        
227        # Include the EFI partition if necessary
228        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
230        fi
231    
232        # Boot partition
233        printf "raid /boot --fstype=%s --level=1 --spares=0 --device=md0 %s\n" "$FSTYPE" "$BOOTDEVS" >> /tmp/part-include
234    
235        # Default to LVM unless specified
236        if [ $NOLVM ] ; then
237          cat >> /tmp/part-include <<EOF
238          raid / --fstype=$FSTYPE --level=$LEVEL --spares=$SPARE --device=md1 $ROOTDEVS
239          raid swap --fstype=swap --level=$LEVEL --spares=$SPARE --device=md2 $SWAPDEVS
240    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
250    fi
251    
252    echo "Final part-include output:"
253    cat /tmp/part-include
254    
255    %end
256    
257    
258    # SME events in post-install
259  %post  --interpreter=/usr/bin/bash --log=/var/log/ks.post02.log  %post  --interpreter=/usr/bin/bash --log=/var/log/ks.post02.log
260  # before reboot performing post-install  userdel -r installer
261  # this is for first alpha iso. we should put this in anaconda  sleep 2
262  # and / or handle possible upgrade later  /sbin/e-smith/signal-event post-install
263  /sbin/rsyslogd;  sleep 2
264  sleep 2;  /sbin/e-smith/db configuration set UnsavedChanges no
 /sbin/e-smith/signal-event post-install;  
 sleep 2;  
 /sbin/e-smith/db configuration set UnsavedChanges no;  
265  touch /forcequotacheck  touch /forcequotacheck
   
266  %end  %end
267    
268    
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