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

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

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


Revision 1.13 - (show annotations) (download)
Sun Apr 17 16:24:12 2022 UTC (2 years, 8 months ago) by jpp
Branch: MAIN
CVS Tags: HEAD
Changes since 1.12: +1 -0 lines
remi-safe repo

1 # System authorization information
2 auth --enableshadow --passalgo=sha512
3
4 # We do not want SELinux
5 selinux --disabled
6
7 # Services to activate
8 services --disabled=lm_sensors
9
10 # Default root pass, will be changed in post-install process anyway
11 rootpw --lock
12 user --name=installer --uid=9999
13
14 # Accept EULA
15 eula --agreed
16
17 # Partitioning from pre section
18 %include /tmp/part-include
19
20 # Disable kdump
21 %addon com_redhat_kdump --disable
22 %end
23
24
25 # Add netinstall repos
26 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 # 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
58 BASESIZE=0
59 SIZEDIFF=0
60
61 # Loop through block devices, keep those over MINSIZE and ensure additional drives for RAID are within 100MB of the first
62 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`
65 if (( $REMOVABLE == 0 )) ; then
66 SIZE=`cat /sys/block/$DEV/size`
67 MB=$(($SIZE/2**11))
68 if [ $MB -gt $MINSIZE ] ; then
69 if [ $NDEV == 0 ] ; then
70 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
85 fi
86 fi
87 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
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
135
136 # Otherwise clear detected devices and set up bootloader
137 else
138 cat > /tmp/part-include <<EOF
139 # Clear the Master Boot Record
140 zerombr
141
142 # Clear current partitions and install bootloader
143 clearpart --all --drives=$DRIVELIST --initlabel
144 ignoredisk --only-use=$DRIVELIST
145 bootloader --location=mbr --driveorder=$DRIVELIST
146 EOF
147
148 # 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 # 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 # Define EFI or biosboot and RAID partitions
181 for i in "${!DRIVES[@]}"; do
182
183 if [ -d /sys/firmware/efi ] ; then
184 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
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
260 userdel -r installer
261 sleep 2
262 /sbin/e-smith/signal-event post-install
263 sleep 2
264 /sbin/e-smith/db configuration set UnsavedChanges no
265 touch /forcequotacheck
266 %end
267
268
269 %post --nochroot --log=/mnt/sysimage/var/log/ks.post01.log
270 #!/bin/bash
271 sysimage="/mnt/sysimage"
272 cp -r /var/log/sme-partitioning.log ${sysimage}/root/
273 cp -r /tmp/anaconda.log ${sysimage}/root/
274 %end

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