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 |
|
|
repo --name=smeos --baseurl=http://mirror.canada.pialasse.com/releases/testing/10/smeos/x86_64/ |
27 |
|
|
repo --name=smeupdates --baseurl=http://mirror.canada.pialasse.com/releases/testing/10/smeupdates/x86_64/ |
28 |
|
|
|
29 |
|
|
# Packages to install |
30 |
|
|
%packages |
31 |
|
|
@^minimal |
32 |
|
|
@base |
33 |
|
|
@core |
34 |
|
|
-chrony |
35 |
|
|
-kexec-tools |
36 |
|
|
%end |
37 |
|
|
|
38 |
unnilennium |
1.3 |
|
39 |
chrissn |
1.5 |
# Partitioning in pre-install |
40 |
|
|
%pre --interpreter=/bin/bash --log=/var/log/ks.pre01.log |
41 |
|
|
|
42 |
|
|
# Minimum size of hard drive needed specified in GB |
43 |
unnilennium |
1.4 |
MINSIZE=5 |
44 |
unnilennium |
1.3 |
|
45 |
unnilennium |
1.4 |
# Number of detected drives |
46 |
|
|
NDEV=0 |
47 |
unnilennium |
1.3 |
|
48 |
chrissn |
1.5 |
# Loop through block devices and keep those over MINSIZE |
49 |
|
|
# TODO: Only pair up drives of the same size |
50 |
unnilennium |
1.4 |
for DEV in $(lsblk -nl | grep disk | cut -d' ' -f1); do |
51 |
|
|
if [ -d /sys/block/$DEV ]; then |
52 |
|
|
REMOVABLE=`cat /sys/block/$DEV/removable` |
53 |
unnilennium |
1.3 |
if (( $REMOVABLE == 0 )); then |
54 |
unnilennium |
1.4 |
SIZE=`cat /sys/block/$DEV/size` |
55 |
unnilennium |
1.3 |
GB=$(($SIZE/2**21)) |
56 |
|
|
if [ $GB -gt $MINSIZE ]; then |
57 |
unnilennium |
1.4 |
DRIVES[$NDEV]=$DEV |
58 |
|
|
((NDEV++)) |
59 |
unnilennium |
1.3 |
fi |
60 |
|
|
fi |
61 |
|
|
fi |
62 |
|
|
done |
63 |
|
|
|
64 |
chrissn |
1.5 |
# Declare useful variables |
65 |
|
|
printf -v DRIVELIST ",%s" "${DRIVES[@]}" |
66 |
|
|
DRIVELIST=${DRIVELIST:1} |
67 |
|
|
LEVEL=1 |
68 |
|
|
SPARE=0 |
69 |
|
|
|
70 |
|
|
# Error if detection has failed and fall back |
71 |
|
|
if [ ${#DRIVES[@]} == 0 ] ; then |
72 |
|
|
echo "No drive suitable for installation found! Reverting to Anaconda defaults." |
73 |
|
|
|
74 |
|
|
cat > /tmp/part-include <<EOF |
75 |
|
|
# Clear the Master Boot Record |
76 |
|
|
zerombr |
77 |
|
|
|
78 |
|
|
# Clear current partitions |
79 |
|
|
clearpart --all --initlabel |
80 |
unnilennium |
1.3 |
|
81 |
chrissn |
1.5 |
# Automatically create partitions using LVM |
82 |
|
|
autopart --lvm --nohome |
83 |
unnilennium |
1.3 |
EOF |
84 |
|
|
|
85 |
chrissn |
1.5 |
# Otherwise clear detected devices and set up bootloader |
86 |
unnilennium |
1.3 |
else |
87 |
chrissn |
1.5 |
cat > /tmp/part-include <<EOF |
88 |
|
|
# Clear the Master Boot Record |
89 |
|
|
zerombr |
90 |
|
|
|
91 |
|
|
# Clear current partitions and install bootloader |
92 |
|
|
clearpart --all --drives=$DRIVELIST --initlabel |
93 |
|
|
ignoredisk --only-use=$DRIVELIST |
94 |
|
|
bootloader --location=mbr --driveorder=$DRIVELIST |
95 |
|
|
EOF |
96 |
|
|
|
97 |
|
|
# If single disk then set up partitioning without RAID |
98 |
|
|
# NOTE: From this point we're appending to part-include |
99 |
|
|
if [ ${#DRIVES[@]} == 1 ] ; then |
100 |
|
|
|
101 |
|
|
# Include the EFI partition if necessary |
102 |
|
|
if [ -d /sys/firmware/efi ] ; then |
103 |
|
|
printf "part /boot/efi --fstype=efi --size=200 --ondisk=%s\n" "${DRIVES[0]}" >> /tmp/part-include |
104 |
|
|
fi |
105 |
|
|
|
106 |
|
|
cat >> /tmp/part-include <<EOF |
107 |
|
|
part /boot --fstype=xfs --size=500 --ondisk=${DRIVES[0]} --label=BOOT |
108 |
|
|
part pv.01 --size=4300 --grow --ondisk=${DRIVES[0]} |
109 |
|
|
volgroup main pv.01 |
110 |
|
|
logvol / --fstype=xfs --name=root --vgname=main --grow --size=3000 --label=ROOT |
111 |
|
|
logvol swap --fstype=swap --name=swap --vgname=main --recommended --label=SWAP |
112 |
|
|
EOF |
113 |
|
|
|
114 |
|
|
# Otherwise multiple disks - prepare for RAID |
115 |
|
|
else |
116 |
unnilennium |
1.3 |
|
117 |
chrissn |
1.5 |
# Define EFI, boot and LVM RAID partitions |
118 |
|
|
for i in "${!DRIVES[@]}"; do |
119 |
|
|
if [ -d /sys/firmware/efi ] ; then |
120 |
|
|
printf "part raid.%s0 --size=200 --ondisk=%s\n" "$i" "${DRIVES[$i]}" >> /tmp/part-include |
121 |
|
|
fi |
122 |
|
|
printf "part raid.%s1 --size=500 --ondisk=%s\n" "$i" "${DRIVES[$i]}" >> /tmp/part-include |
123 |
|
|
printf "part raid.%s2 --size=4300 --grow --ondisk=%s\n" "$i" "${DRIVES[$i]}" >> /tmp/part-include |
124 |
|
|
done |
125 |
|
|
|
126 |
|
|
# Compute RAID level |
127 |
|
|
# from https://wiki.contribs.org/Raid |
128 |
|
|
# 2 Drives - Software RAID 1 |
129 |
|
|
# 3 Drives - Software RAID 1 + 1 Hot-spare |
130 |
chrissn |
1.6 |
# 4 Drives - Software RAID 6 |
131 |
|
|
# 5+ Drives - Software RAID 6 + 1 Hot-spare |
132 |
chrissn |
1.5 |
|
133 |
|
|
if [ ${#DRIVES[@]} == 2 ] ; then |
134 |
|
|
LEVEL=1 |
135 |
|
|
SPARE=0 |
136 |
|
|
elif [ ${#DRIVES[@]} == 3 ] ; then |
137 |
|
|
LEVEL=1 |
138 |
|
|
SPARE=1 |
139 |
chrissn |
1.6 |
elif [ ${#DRIVES[@]} == 4 ] ; then |
140 |
|
|
LEVEL=6 |
141 |
|
|
SPARE=0 |
142 |
chrissn |
1.5 |
else |
143 |
|
|
LEVEL=6 |
144 |
|
|
SPARE=1 |
145 |
|
|
fi |
146 |
unnilennium |
1.3 |
|
147 |
chrissn |
1.5 |
# Set up RAID devices |
148 |
|
|
printf -v EFIDEVS "raid.%s0 " "${!DRIVES[@]}" |
149 |
|
|
printf -v BOOTDEVS "raid.%s1 " "${!DRIVES[@]}" |
150 |
|
|
printf -v ROOTDEVS "raid.%s2 " "${!DRIVES[@]}" |
151 |
|
|
|
152 |
|
|
# Include the EFI partition if necessary |
153 |
|
|
if [ -d /sys/firmware/efi ] ; then |
154 |
chrissn |
1.6 |
printf "raid /boot/efi --fstype=efi --level=1 --spares=0 --device=md9 %s\n" "$EFIDEVS" >> /tmp/part-include |
155 |
chrissn |
1.5 |
fi |
156 |
unnilennium |
1.3 |
|
157 |
chrissn |
1.6 |
printf "raid /boot --fstype=xfs --level=1 --spares=0 --device=md0 %s\n" "$BOOTDEVS" >> /tmp/part-include |
158 |
chrissn |
1.5 |
printf "raid pv.01 --level=%s --spares=%s --device=md1 %s\n" "$LEVEL" "$SPARE" "$ROOTDEVS" >> /tmp/part-include |
159 |
unnilennium |
1.3 |
|
160 |
chrissn |
1.5 |
# Set up LVM |
161 |
|
|
cat >> /tmp/part-include <<EOF |
162 |
|
|
volgroup main pv.01 |
163 |
|
|
logvol / --fstype xfs --name=root --vgname=main --grow --size=3000 --label=ROOT |
164 |
|
|
logvol swap --fstype swap --name=swap --vgname=main --recommended --label=SWAP |
165 |
|
|
EOF |
166 |
unnilennium |
1.3 |
|
167 |
chrissn |
1.5 |
fi |
168 |
|
|
fi |
169 |
unnilennium |
1.1 |
|
170 |
|
|
%end |
171 |
|
|
|
172 |
|
|
|
173 |
chrissn |
1.5 |
# SME events in post-install |
174 |
unnilennium |
1.4 |
%post --interpreter=/usr/bin/bash --log=/var/log/ks.post02.log |
175 |
chrissn |
1.7 |
userdel -r installer |
176 |
|
|
sleep 2 |
177 |
|
|
/sbin/rsyslogd |
178 |
|
|
sleep 2 |
179 |
|
|
/sbin/e-smith/signal-event post-install |
180 |
|
|
sleep 2 |
181 |
|
|
/sbin/e-smith/db configuration set UnsavedChanges no |
182 |
unnilennium |
1.1 |
touch /forcequotacheck |
183 |
chrissn |
1.5 |
%end |
184 |
unnilennium |
1.1 |
|
185 |
unnilennium |
1.4 |
|
186 |
|
|
%post --nochroot --log=/mnt/sysimage/var/log/ks.post01.log |
187 |
|
|
#!/bin/bash |
188 |
|
|
sysimage="/mnt/sysimage" |
189 |
|
|
cp -r /tmp/anaconda.log ${sysimage}/root/ |
190 |
|
|
%end |