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

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

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


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

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