1 |
# System authorization information |
# System authorization information |
2 |
auth --enableshadow --passalgo=sha512 |
auth --enableshadow --passalgo=sha512 |
|
# Use CDROM installation media |
|
|
cdrom |
|
|
# Use graphical install |
|
|
#graphical |
|
|
#%include /usr/share/anaconda/interactive-defaults.ks |
|
|
#install |
|
|
ignoredisk --only-use=vda |
|
|
# Keyboard layouts |
|
|
keyboard --xlayouts='us' |
|
|
# System language |
|
|
lang en_US.UTF-8 |
|
|
selinux --disabled |
|
|
#reboot |
|
|
|
|
|
|
|
|
# System timezone |
|
|
timezone America/New_York --isUtc |
|
|
|
|
3 |
|
|
4 |
# System bootloader configuration |
# We do not want SELinux |
5 |
bootloader --append=" crashkernel=auto quiet" --location=mbr --boot-drive=vda |
selinux --disabled |
|
#Clear the Master Boot Record |
|
|
#zerombr yes |
|
|
zerombr |
|
6 |
|
|
7 |
# Partition clearing information |
# Services to activate |
8 |
#clearpart --all --initlabel --drives=vda |
services --disabled=lm_sensors |
9 |
|
|
10 |
# autopartionning |
# Default root pass, will be changed in post-install process anyway |
11 |
autopart --type=lvm |
rootpw --lock |
12 |
|
user --name=installer --uid=9999 |
13 |
|
|
14 |
## Disks for 500 MB boot partition |
# Accept EULA |
15 |
#part raid.01 --size=500 --asprimary --ondisk=vda |
eula --agreed |
|
#part raid.02 --size=500 --asprimary --ondisk=vdb |
|
16 |
|
|
17 |
## Disks for LVM partition |
# Partitioning from pre section |
18 |
#part raid.11 --size=1 --grow --ondisk=vda |
%include /tmp/part-include |
|
#part raid.12 --size=1 --grow --ondisk=vdb |
|
19 |
|
|
20 |
## RAID settings |
# Disable kdump |
21 |
#raid /boot --fstype ext2 --device md0 --level=RAID1 raid.01 raid.02 |
%addon com_redhat_kdump --disable |
22 |
#raid pv.01 --device md1 --level=RAID1 raid.11 raid.12 |
%end |
23 |
|
|
|
# LVM configuration |
|
|
#volgroup vg pv.01 |
|
|
#logvol / --vgname=vg --size=1 --grow --fstype ext3 --name=root |
|
|
#logvol swap --vgname=vg --recommended --name=swap |
|
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 |
# services to activate |
# Packages to install |
|
services --disabled=lm_sensors |
|
|
# packages to install |
|
35 |
%packages |
%packages |
36 |
@^minimal |
@^minimal |
37 |
@base |
@base |
38 |
@core |
@core |
39 |
-chrony |
-chrony |
40 |
-kexec-tools |
-kexec-tools |
|
|
|
41 |
%end |
%end |
42 |
|
|
43 |
|
|
44 |
# pre script could be inserted there to handle partitionning |
# 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 |
%post --interpreter=/usr/bin/bash |
# SME events in post-install |
260 |
# before reboot performing post-install |
%post --interpreter=/usr/bin/bash --log=/var/log/ks.post02.log |
261 |
# this is for first alpha iso. we should put this in anaconda |
userdel -r installer |
262 |
# and / or handle possible upgrade later |
sleep 2 |
263 |
/sbin/rsyslogd; |
/sbin/e-smith/signal-event post-install |
264 |
sleep 2; |
sleep 2 |
265 |
/sbin/e-smith/signal-event post-install; |
/sbin/e-smith/db configuration set UnsavedChanges no |
|
sleep 2; |
|
|
/sbin/e-smith/db configuration set UnsavedChanges no; |
|
266 |
touch /forcequotacheck |
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 |
%end |