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

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