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

Annotation 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 - (hide annotations) (download)
Wed Jun 9 08:27:41 2021 UTC (3 years, 6 months ago) by jpp
Branch: MAIN
CVS Tags: HEAD
Changes since 1.14: +4 -2 lines
mirrorlist

1 unnilennium 1.1 # System authorization information
2     auth --enableshadow --passalgo=sha512
3 unnilennium 1.4
4 chrissn 1.5 # We do not want SELinux
5 unnilennium 1.1 selinux --disabled
6 unnilennium 1.4
7 chrissn 1.5 # Services to activate
8 unnilennium 1.3 services --disabled=lm_sensors
9 unnilennium 1.4
10 chrissn 1.5 # Default root pass, will be changed in post-install process anyway
11     rootpw --lock
12 chrissn 1.7 user --name=installer --uid=9999
13 unnilennium 1.1
14 chrissn 1.5 # Accept EULA
15 unnilennium 1.4 eula --agreed
16    
17 chrissn 1.5 # Partitioning from pre section
18 unnilennium 1.3 %include /tmp/part-include
19 unnilennium 1.1
20 chrissn 1.5 # Disable kdump
21 unnilennium 1.4 %addon com_redhat_kdump --disable
22     %end
23    
24    
25 chrissn 1.5 # Add netinstall repos
26 jpp 1.13 #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 jpp 1.15 #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 chrissn 1.5
34     # Packages to install
35     %packages
36     @^minimal
37     @base
38     @core
39     -chrony
40     -kexec-tools
41     %end
42    
43 unnilennium 1.3
44 chrissn 1.5 # Partitioning in pre-install
45 chrissn 1.9 %pre --interpreter=/bin/bash --log=/var/log/sme-partitioning.log
46 chrissn 1.5
47 chrissn 1.9 # 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 chrissn 1.10 if grep noxfs "/proc/cmdline" ; then FSTYPE="ext4" ; else FSTYPE="xfs" ; fi
51 chrissn 1.9 echo "Command line arguments:"
52     cat /proc/cmdline
53 unnilennium 1.3
54 chrissn 1.9 # Minimum size of hard drive needed specified in MB
55     MINSIZE=5000
56    
57     # Number of detected drives and first disk size
58 unnilennium 1.4 NDEV=0
59 chrissn 1.9 BASESIZE=0
60     SIZEDIFF=0
61 unnilennium 1.3
62 chrissn 1.9 # 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 unnilennium 1.4 REMOVABLE=`cat /sys/block/$DEV/removable`
66 chrissn 1.9 if (( $REMOVABLE == 0 )) ; then
67 unnilennium 1.4 SIZE=`cat /sys/block/$DEV/size`
68 chrissn 1.9 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 unnilennium 1.3 fi
86     fi
87     fi
88     done
89 chrissn 1.9 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 unnilennium 1.3
109 chrissn 1.5 # Declare useful variables
110     printf -v DRIVELIST ",%s" "${DRIVES[@]}"
111 chrissn 1.9 if [ $NORAID ] ; then
112     DRIVELIST=${DRIVES[0]}
113     else
114     DRIVELIST=${DRIVELIST:1}
115     fi
116    
117     echo "Final drive list: $DRIVELIST"
118 chrissn 1.5 LEVEL=1
119     SPARE=0
120    
121 chrissn 1.9
122 chrissn 1.5 # 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 unnilennium 1.3
133 chrissn 1.5 # Automatically create partitions using LVM
134     autopart --lvm --nohome
135 unnilennium 1.3 EOF
136    
137 chrissn 1.5 # Otherwise clear detected devices and set up bootloader
138 unnilennium 1.3 else
139 chrissn 1.5 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 chrissn 1.9 # If single disk or noraid specific then set up partitioning without RAID
150 chrissn 1.5 # NOTE: From this point we're appending to part-include
151 chrissn 1.9 if [ ${#DRIVES[@]} == 1 ] || [ $NORAID ] ; then
152 chrissn 1.5
153 chrissn 1.9 # Include the EFI or biosboot partition if necessary
154 chrissn 1.5 if [ -d /sys/firmware/efi ] ; then
155     printf "part /boot/efi --fstype=efi --size=200 --ondisk=%s\n" "${DRIVES[0]}" >> /tmp/part-include
156 chrissn 1.9 elif [ $BASESIZE -gt 2048000 ] ; then
157     printf "part biosboot --fstype=biosboot --size=1 --ondisk=%s\n" "${DRIVES[0]}" >> /tmp/part-include
158 chrissn 1.5 fi
159    
160 chrissn 1.9 # Create boot partition
161 chrissn 1.10 printf "part /boot --fstype=%s --size=500 --label=BOOT --ondisk=%s\n" "$FSTYPE" "${DRIVES[0]}" >> /tmp/part-include
162 chrissn 1.9
163     # Default to LVM unless specified at command line
164     if [ $NOLVM ] ; then
165     cat >> /tmp/part-include <<EOF
166 chrissn 1.10 part / --fstype=$FSTYPE --grow --size=3000 --label=ROOT --ondisk=${DRIVES[0]}
167 chrissn 1.9 part swap --fstype=swap --recommended --label=SWAP --ondisk=${DRIVES[0]}
168 chrissn 1.5 EOF
169 chrissn 1.9 else
170     cat >> /tmp/part-include <<EOF
171     part pv.01 --size=4300 --grow --ondisk=${DRIVES[0]}
172     volgroup main pv.01
173 chrissn 1.10 logvol / --fstype=$FSTYPE --name=root --vgname=main --grow --size=3000
174 chrissn 1.9 logvol swap --fstype=swap --name=swap --vgname=main --recommended
175     EOF
176     fi
177 chrissn 1.5
178     # Otherwise multiple disks - prepare for RAID
179     else
180 unnilennium 1.3
181 chrissn 1.9 # Define EFI or biosboot and RAID partitions
182 chrissn 1.5 for i in "${!DRIVES[@]}"; do
183 chrissn 1.9
184 chrissn 1.5 if [ -d /sys/firmware/efi ] ; then
185     printf "part raid.%s0 --size=200 --ondisk=%s\n" "$i" "${DRIVES[$i]}" >> /tmp/part-include
186 chrissn 1.9 elif [ $BASESIZE -gt 2048000 ] ; then
187     printf "part biosboot --fstype=biosboot --size=1 --ondisk=%s\n" "${DRIVES[$i]}" >> /tmp/part-include
188 chrissn 1.5 fi
189     printf "part raid.%s1 --size=500 --ondisk=%s\n" "$i" "${DRIVES[$i]}" >> /tmp/part-include
190 chrissn 1.9
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 chrissn 1.5 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 chrissn 1.6 # 4 Drives - Software RAID 6
206     # 5+ Drives - Software RAID 6 + 1 Hot-spare
207 chrissn 1.5
208     if [ ${#DRIVES[@]} == 2 ] ; then
209     LEVEL=1
210     SPARE=0
211     elif [ ${#DRIVES[@]} == 3 ] ; then
212     LEVEL=1
213     SPARE=1
214 chrissn 1.6 elif [ ${#DRIVES[@]} == 4 ] ; then
215     LEVEL=6
216     SPARE=0
217 chrissn 1.5 else
218     LEVEL=6
219     SPARE=1
220     fi
221 unnilennium 1.3
222 chrissn 1.5 # 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 chrissn 1.9 printf -v SWAPDEVS "raid.%s3 " "${!DRIVES[@]}"
227 chrissn 1.5
228     # Include the EFI partition if necessary
229     if [ -d /sys/firmware/efi ] ; then
230 chrissn 1.6 printf "raid /boot/efi --fstype=efi --level=1 --spares=0 --device=md9 %s\n" "$EFIDEVS" >> /tmp/part-include
231 chrissn 1.5 fi
232 unnilennium 1.3
233 chrissn 1.9 # Boot partition
234 chrissn 1.10 printf "raid /boot --fstype=%s --level=1 --spares=0 --device=md0 %s\n" "$FSTYPE" "$BOOTDEVS" >> /tmp/part-include
235 unnilennium 1.3
236 chrissn 1.9 # Default to LVM unless specified
237     if [ $NOLVM ] ; then
238     cat >> /tmp/part-include <<EOF
239 chrissn 1.10 raid / --fstype=$FSTYPE --level=$LEVEL --spares=$SPARE --device=md1 $ROOTDEVS
240 chrissn 1.9 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 chrissn 1.10 logvol / --fstype=$FSTYPE --name=root --vgname=main --grow --size=3000
247 chrissn 1.9 logvol swap --fstype swap --name=swap --vgname=main --recommended
248 chrissn 1.5 EOF
249 chrissn 1.9 fi
250 chrissn 1.5 fi
251     fi
252 unnilennium 1.1
253 chrissn 1.9 echo "Final part-include output:"
254     cat /tmp/part-include
255    
256 unnilennium 1.1 %end
257    
258    
259 chrissn 1.5 # SME events in post-install
260 unnilennium 1.4 %post --interpreter=/usr/bin/bash --log=/var/log/ks.post02.log
261 chrissn 1.7 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 unnilennium 1.1 touch /forcequotacheck
267 chrissn 1.5 %end
268 unnilennium 1.1
269 unnilennium 1.4
270     %post --nochroot --log=/mnt/sysimage/var/log/ks.post01.log
271     #!/bin/bash
272     sysimage="/mnt/sysimage"
273 chrissn 1.9 cp -r /var/log/sme-partitioning.log ${sysimage}/root/
274 unnilennium 1.4 cp -r /tmp/anaconda.log ${sysimage}/root/
275     %end

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