/[smeserver]/cdrom.image/sme10/Packages/base/sme-kickstart.cfg
ViewVC logotype

Contents of /cdrom.image/sme10/Packages/base/sme-kickstart.cfg

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


Revision 1.15 - (show annotations) (download)
Wed Jun 9 08:27:41 2021 UTC (3 years, 4 months ago) by jpp
Branch: MAIN
CVS Tags: HEAD
Changes since 1.14: +4 -2 lines
Error occurred while calculating annotation data.
mirrorlist

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 #this one gives curl 6 errors on netinstall while added manually works from time to time
27 #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/10/smeupdates/x86_64/
31 repo --name=smeos --mirrorlist https://mirrorlist.koozali.org/mirrorlist/smeos-10-x86_64
32 repo --name=smeupdates --mirrorlist https://mirrorlist.koozali.org/mirrorlist/smeupdates-10-x86_64
33
34 # Packages to install
35 %packages
36 @^minimal
37 @base
38 @core
39 -chrony
40 -kexec-tools
41 %end
42
43
44 # Partitioning in pre-install
45 %pre --interpreter=/bin/bash --log=/var/log/sme-partitioning.log
46
47 # Read command line arguments
48 if grep nolvm "/proc/cmdline" ; then NOLVM=true ; fi
49 if grep noraid "/proc/cmdline" ; then NORAID=true ; fi
50 if grep noxfs "/proc/cmdline" ; then FSTYPE="ext4" ; else FSTYPE="xfs" ; fi
51 echo "Command line arguments:"
52 cat /proc/cmdline
53
54 # Minimum size of hard drive needed specified in MB
55 MINSIZE=5000
56
57 # Number of detected drives and first disk size
58 NDEV=0
59 BASESIZE=0
60 SIZEDIFF=0
61
62 # Loop through block devices, keep those over MINSIZE and ensure additional drives for RAID are within 100MB of the first
63 for DEV in $(lsblk -nl | grep disk | cut -d' ' -f1) ; do
64 if [ -d /sys/block/$DEV ] ; then
65 REMOVABLE=`cat /sys/block/$DEV/removable`
66 if (( $REMOVABLE == 0 )) ; then
67 SIZE=`cat /sys/block/$DEV/size`
68 MB=$(($SIZE/2**11))
69 if [ $MB -gt $MINSIZE ] ; then
70 if [ $NDEV == 0 ] ; then
71 echo "First drive found: $DEV with size $MB MB"
72 DRIVES[$NDEV]=$DEV
73 BASESIZE=$MB
74 ((NDEV++))
75 else
76 SIZEDIFF=$(($MB-$BASESIZE))
77 if [ $SIZEDIFF -gt 100 ] || [ $SIZEDIFF -lt -100 ] ; then
78 echo "Drive found but size of $MB MB doesn't match $BASESIZE MB - ignoring"
79 else
80 echo "Additional drive found: $DEV with size $MB MB"
81 DRIVES[$NDEV]=$DEV
82 ((NDEV++))
83 fi
84 fi
85 fi
86 fi
87 fi
88 done
89 echo "Total disks found: $NDEV"
90
91 # Calculate recommended swap size for RAID + nolvm case
92 if [ -d /sys/firmware/efi ] ; then
93 DISKSPARE=$(($BASESIZE-200-500-3000))
94 else
95 DISKSPARE=$(($BASESIZE-1-500-3000))
96 fi
97 MEMSIZE=$(awk '/^MemTotal:/{print $2}' /proc/meminfo)
98 MEMSIZEMB=$(($MEMSIZE/2**10))
99
100 if [ $MEMSIZEMB -lt 2000 ] ; then
101 SWAPSIZE=$((2*$MEMSIZEMB))
102 elif [ $MEMSIZEMB -lt 8000 ] ; then
103 SWAPSIZE=$MEMSIZEMB
104 else
105 SWAPSIZE=8000
106 fi
107 if [ $SWAPSIZE -gt $DISKSPARE ] ; then SWAPSIZE=$DISKSPARE ; fi
108
109 # Declare useful variables
110 printf -v DRIVELIST ",%s" "${DRIVES[@]}"
111 if [ $NORAID ] ; then
112 DRIVELIST=${DRIVES[0]}
113 else
114 DRIVELIST=${DRIVELIST:1}
115 fi
116
117 echo "Final drive list: $DRIVELIST"
118 LEVEL=1
119 SPARE=0
120
121
122 # Error if detection has failed and fall back
123 if [ ${#DRIVES[@]} == 0 ] ; then
124 echo "No drive suitable for installation found! Reverting to Anaconda defaults."
125
126 cat > /tmp/part-include <<EOF
127 # Clear the Master Boot Record
128 zerombr
129
130 # Clear current partitions
131 clearpart --all --initlabel
132
133 # Automatically create partitions using LVM
134 autopart --lvm --nohome
135 EOF
136
137 # Otherwise clear detected devices and set up bootloader
138 else
139 cat > /tmp/part-include <<EOF
140 # Clear the Master Boot Record
141 zerombr
142
143 # Clear current partitions and install bootloader
144 clearpart --all --drives=$DRIVELIST --initlabel
145 ignoredisk --only-use=$DRIVELIST
146 bootloader --location=mbr --driveorder=$DRIVELIST
147 EOF
148
149 # If single disk or noraid specific then set up partitioning without RAID
150 # NOTE: From this point we're appending to part-include
151 if [ ${#DRIVES[@]} == 1 ] || [ $NORAID ] ; then
152
153 # Include the EFI or biosboot partition if necessary
154 if [ -d /sys/firmware/efi ] ; then
155 printf "part /boot/efi --fstype=efi --size=200 --ondisk=%s\n" "${DRIVES[0]}" >> /tmp/part-include
156 elif [ $BASESIZE -gt 2048000 ] ; then
157 printf "part biosboot --fstype=biosboot --size=1 --ondisk=%s\n" "${DRIVES[0]}" >> /tmp/part-include
158 fi
159
160 # Create boot partition
161 printf "part /boot --fstype=%s --size=500 --label=BOOT --ondisk=%s\n" "$FSTYPE" "${DRIVES[0]}" >> /tmp/part-include
162
163 # Default to LVM unless specified at command line
164 if [ $NOLVM ] ; then
165 cat >> /tmp/part-include <<EOF
166 part / --fstype=$FSTYPE --grow --size=3000 --label=ROOT --ondisk=${DRIVES[0]}
167 part swap --fstype=swap --recommended --label=SWAP --ondisk=${DRIVES[0]}
168 EOF
169 else
170 cat >> /tmp/part-include <<EOF
171 part pv.01 --size=4300 --grow --ondisk=${DRIVES[0]}
172 volgroup main pv.01
173 logvol / --fstype=$FSTYPE --name=root --vgname=main --grow --size=3000
174 logvol swap --fstype=swap --name=swap --vgname=main --recommended
175 EOF
176 fi
177
178 # Otherwise multiple disks - prepare for RAID
179 else
180
181 # Define EFI or biosboot and RAID partitions
182 for i in "${!DRIVES[@]}"; do
183
184 if [ -d /sys/firmware/efi ] ; then
185 printf "part raid.%s0 --size=200 --ondisk=%s\n" "$i" "${DRIVES[$i]}" >> /tmp/part-include
186 elif [ $BASESIZE -gt 2048000 ] ; then
187 printf "part biosboot --fstype=biosboot --size=1 --ondisk=%s\n" "${DRIVES[$i]}" >> /tmp/part-include
188 fi
189 printf "part raid.%s1 --size=500 --ondisk=%s\n" "$i" "${DRIVES[$i]}" >> /tmp/part-include
190
191 # Default to LVM unless specified
192 if [ $NOLVM ] ; then
193 printf "part raid.%s2 --size=3000 --grow --ondisk=%s\n" "$i" "${DRIVES[$i]}" >> /tmp/part-include
194 printf "part raid.%s3 --size=%s --ondisk=%s\n" "$i" "$SWAPSIZE" "${DRIVES[$i]}" >> /tmp/part-include
195 else
196 printf "part raid.%s2 --size=4300 --grow --ondisk=%s\n" "$i" "${DRIVES[$i]}" >> /tmp/part-include
197 fi
198
199 done
200
201 # Compute RAID level
202 # from https://wiki.contribs.org/Raid
203 # 2 Drives - Software RAID 1
204 # 3 Drives - Software RAID 1 + 1 Hot-spare
205 # 4 Drives - Software RAID 6
206 # 5+ Drives - Software RAID 6 + 1 Hot-spare
207
208 if [ ${#DRIVES[@]} == 2 ] ; then
209 LEVEL=1
210 SPARE=0
211 elif [ ${#DRIVES[@]} == 3 ] ; then
212 LEVEL=1
213 SPARE=1
214 elif [ ${#DRIVES[@]} == 4 ] ; then
215 LEVEL=6
216 SPARE=0
217 else
218 LEVEL=6
219 SPARE=1
220 fi
221
222 # Set up RAID devices
223 printf -v EFIDEVS "raid.%s0 " "${!DRIVES[@]}"
224 printf -v BOOTDEVS "raid.%s1 " "${!DRIVES[@]}"
225 printf -v ROOTDEVS "raid.%s2 " "${!DRIVES[@]}"
226 printf -v SWAPDEVS "raid.%s3 " "${!DRIVES[@]}"
227
228 # Include the EFI partition if necessary
229 if [ -d /sys/firmware/efi ] ; then
230 printf "raid /boot/efi --fstype=efi --level=1 --spares=0 --device=md9 %s\n" "$EFIDEVS" >> /tmp/part-include
231 fi
232
233 # Boot partition
234 printf "raid /boot --fstype=%s --level=1 --spares=0 --device=md0 %s\n" "$FSTYPE" "$BOOTDEVS" >> /tmp/part-include
235
236 # Default to LVM unless specified
237 if [ $NOLVM ] ; then
238 cat >> /tmp/part-include <<EOF
239 raid / --fstype=$FSTYPE --level=$LEVEL --spares=$SPARE --device=md1 $ROOTDEVS
240 raid swap --fstype=swap --level=$LEVEL --spares=$SPARE --device=md2 $SWAPDEVS
241 EOF
242 else
243 cat >> /tmp/part-include <<EOF
244 raid pv.01 --level=$LEVEL --spares=$SPARE --device=md1 $ROOTDEVS
245 volgroup main pv.01
246 logvol / --fstype=$FSTYPE --name=root --vgname=main --grow --size=3000
247 logvol swap --fstype swap --name=swap --vgname=main --recommended
248 EOF
249 fi
250 fi
251 fi
252
253 echo "Final part-include output:"
254 cat /tmp/part-include
255
256 %end
257
258
259 # SME events in post-install
260 %post --interpreter=/usr/bin/bash --log=/var/log/ks.post02.log
261 userdel -r installer
262 sleep 2
263 /sbin/e-smith/signal-event post-install
264 sleep 2
265 /sbin/e-smith/db configuration set UnsavedChanges no
266 touch /forcequotacheck
267 %end
268
269
270 %post --nochroot --log=/mnt/sysimage/var/log/ks.post01.log
271 #!/bin/bash
272 sysimage="/mnt/sysimage"
273 cp -r /var/log/sme-partitioning.log ${sysimage}/root/
274 cp -r /tmp/anaconda.log ${sysimage}/root/
275 %end

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