1 |
# System authorization information |
# System authorization information |
2 |
auth --enableshadow --passalgo=sha512 |
auth --enableshadow --passalgo=sha512 |
|
# Use CDROM installation media |
|
|
cdrom |
|
|
# we do not want Selinux |
|
|
selinux --disabled |
|
|
# services to activate |
|
|
services --disabled=lm_sensors |
|
|
# default root pass, willbe changed in post-install process anyway |
|
|
rootpw --lock |
|
|
|
|
|
# include the partitioning logic from the pre section. |
|
|
%include /tmp/part-include |
|
|
|
|
|
%pre |
|
|
# pre section |
|
|
#----- partitioning logic below-------------- |
|
|
# pick the first drive that is not removable and is over MINSIZE |
|
|
DIR="/sys/block" |
|
|
|
|
|
# minimum size of hard drive needed specified in GIGABYTES |
|
|
MINSIZE=20 |
|
|
|
|
|
ROOTDRIVE="" |
|
|
|
|
|
# /sys/block/*/size is in 512 byte chunks |
|
|
|
|
|
for DEV in sda sdb sdc sdd hda hdb vda vdb xvda xvdb; do |
|
|
if [ -d $DIR/$DEV ]; then |
|
|
REMOVABLE=`cat $DIR/$DEV/removable` |
|
|
if (( $REMOVABLE == 0 )); then |
|
|
echo $DEV |
|
|
SIZE=`cat $DIR/$DEV/size` |
|
|
GB=$(($SIZE/2**21)) |
|
|
if [ $GB -gt $MINSIZE ]; then |
|
|
echo "$(($SIZE/2**21))" |
|
|
if [ -z $ROOTDRIVE ]; then |
|
|
ROOTDRIVE=$DEV |
|
|
fi |
|
|
fi |
|
|
fi |
|
|
fi |
|
|
done |
|
|
|
|
|
echo "ROOTDRIVE=$ROOTDRIVE" |
|
|
|
|
|
# drives smaller than 40GB use smaller boot and swap partitions |
|
|
# drives larger than 40GB use percentage-based partition sizes |
|
3 |
|
|
4 |
if [ $GB -lt 40 ]; then |
# We do not want SELinux |
5 |
|
selinux --disabled |
6 |
|
|
7 |
# drives smaller than 40GB |
# Services to activate |
8 |
cat << EOF > /tmp/part-include |
services --disabled=lm_sensors |
|
zerombr |
|
|
clearpart --all --drives=$ROOTDRIVE --initlabel |
|
|
bootloader --location=mbr --driveorder=$ROOTDRIVE |
|
|
# for boot partition |
|
|
part /boot --fstype ext4 --size=300 --ondisk=$ROOTDRIVE |
|
|
# for LVM partition |
|
|
part pv.8 --size=4600 --grow --ondisk=$ROOTDRIVE |
|
|
# LVM |
|
|
volgroup main --pesize=65536 pv.8 |
|
|
logvol / --fstype ext4 --name=root --vgname=main --grow --size=3000 |
|
|
logvol swap --fstype swap --name=swap --vgname=main --size=1500 |
|
9 |
|
|
10 |
EOF |
# Default root pass, will be changed in post-install process anyway |
11 |
|
rootpw --lock |
12 |
|
|
13 |
|
# Accept EULA |
14 |
|
eula --agreed |
15 |
|
|
16 |
else |
# Partitioning from pre section |
17 |
# drives 40GB and larger |
%include /tmp/part-include |
18 |
|
|
19 |
cat << EOF > /tmp/part-include |
# Disable kdump |
20 |
zerombr |
%addon com_redhat_kdump --disable |
21 |
clearpart --all --drives=$ROOTDRIVE --initlabel |
%end |
|
bootloader --location=mbr --driveorder=$ROOTDRIVE |
|
|
# for boot partition |
|
|
part /boot --fstype ext4 --size=500 --ondisk=$ROOTDRIVE |
|
|
# for LVM partition |
|
|
part pv.8 --size=4600 --grow --ondisk=$ROOTDRIVE |
|
|
# LVM |
|
|
volgroup main --pesize=65536 pv.8 |
|
|
logvol / --fstype ext4 --name=root --vgname=main --grow --size=3000 |
|
|
logvol swap --fstype swap --name=swap --vgname=main --size=4000 |
|
22 |
|
|
|
EOF |
|
23 |
|
|
24 |
fi |
# Add netinstall repos |
25 |
|
repo --name=smeos --baseurl=http://mirror.canada.pialasse.com/releases/testing/10/smeos/x86_64/ |
26 |
|
repo --name=smeupdates --baseurl=http://mirror.canada.pialasse.com/releases/testing/10/smeupdates/x86_64/ |
27 |
|
|
28 |
|
# Packages to install |
29 |
|
%packages |
30 |
|
@^minimal |
31 |
|
@base |
32 |
|
@core |
33 |
|
-chrony |
34 |
|
-kexec-tools |
35 |
%end |
%end |
36 |
|
|
37 |
|
|
38 |
|
# Partitioning in pre-install |
39 |
|
%pre --interpreter=/bin/bash --log=/var/log/ks.pre01.log |
40 |
|
|
41 |
|
# Minimum size of hard drive needed specified in GB |
42 |
|
MINSIZE=5 |
43 |
|
|
44 |
|
# Number of detected drives |
45 |
|
NDEV=0 |
46 |
|
|
47 |
|
# Loop through block devices and keep those over MINSIZE |
48 |
|
# TODO: Only pair up drives of the same size |
49 |
|
for DEV in $(lsblk -nl | grep disk | cut -d' ' -f1); do |
50 |
|
if [ -d /sys/block/$DEV ]; then |
51 |
|
REMOVABLE=`cat /sys/block/$DEV/removable` |
52 |
|
if (( $REMOVABLE == 0 )); then |
53 |
|
SIZE=`cat /sys/block/$DEV/size` |
54 |
|
GB=$(($SIZE/2**21)) |
55 |
|
if [ $GB -gt $MINSIZE ]; then |
56 |
|
DRIVES[$NDEV]=$DEV |
57 |
|
((NDEV++)) |
58 |
|
fi |
59 |
|
fi |
60 |
|
fi |
61 |
|
done |
62 |
|
|
63 |
|
# Declare useful variables |
64 |
|
printf -v DRIVELIST ",%s" "${DRIVES[@]}" |
65 |
|
DRIVELIST=${DRIVELIST:1} |
66 |
|
LEVEL=1 |
67 |
|
SPARE=0 |
68 |
|
|
69 |
|
# Error if detection has failed and fall back |
70 |
|
if [ ${#DRIVES[@]} == 0 ] ; then |
71 |
|
echo "No drive suitable for installation found! Reverting to Anaconda defaults." |
72 |
|
|
73 |
|
cat > /tmp/part-include <<EOF |
74 |
|
# Clear the Master Boot Record |
75 |
|
zerombr |
76 |
|
|
77 |
|
# Clear current partitions |
78 |
|
clearpart --all --initlabel |
79 |
|
|
80 |
|
# Automatically create partitions using LVM |
81 |
|
autopart --lvm --nohome |
82 |
|
EOF |
83 |
|
|
84 |
|
# Otherwise clear detected devices and set up bootloader |
85 |
|
else |
86 |
|
cat > /tmp/part-include <<EOF |
87 |
|
# Clear the Master Boot Record |
88 |
|
zerombr |
89 |
|
|
90 |
|
# Clear current partitions and install bootloader |
91 |
|
clearpart --all --drives=$DRIVELIST --initlabel |
92 |
|
ignoredisk --only-use=$DRIVELIST |
93 |
|
bootloader --location=mbr --driveorder=$DRIVELIST |
94 |
|
EOF |
95 |
|
|
96 |
|
# If single disk then set up partitioning without RAID |
97 |
|
# NOTE: From this point we're appending to part-include |
98 |
|
if [ ${#DRIVES[@]} == 1 ] ; then |
99 |
|
|
100 |
|
# Include the EFI partition if necessary |
101 |
|
if [ -d /sys/firmware/efi ] ; then |
102 |
|
printf "part /boot/efi --fstype=efi --size=200 --ondisk=%s\n" "${DRIVES[0]}" >> /tmp/part-include |
103 |
|
fi |
104 |
|
|
105 |
|
cat >> /tmp/part-include <<EOF |
106 |
|
part /boot --fstype=xfs --size=500 --ondisk=${DRIVES[0]} --label=BOOT |
107 |
|
part pv.01 --size=4300 --grow --ondisk=${DRIVES[0]} |
108 |
|
volgroup main pv.01 |
109 |
|
logvol / --fstype=xfs --name=root --vgname=main --grow --size=3000 --label=ROOT |
110 |
|
logvol swap --fstype=swap --name=swap --vgname=main --recommended --label=SWAP |
111 |
|
EOF |
112 |
|
|
113 |
|
# Otherwise multiple disks - prepare for RAID |
114 |
|
else |
115 |
|
|
116 |
|
# Define EFI, boot and LVM RAID partitions |
117 |
|
for i in "${!DRIVES[@]}"; do |
118 |
|
if [ -d /sys/firmware/efi ] ; then |
119 |
|
printf "part raid.%s0 --size=200 --ondisk=%s\n" "$i" "${DRIVES[$i]}" >> /tmp/part-include |
120 |
|
fi |
121 |
|
printf "part raid.%s1 --size=500 --ondisk=%s\n" "$i" "${DRIVES[$i]}" >> /tmp/part-include |
122 |
|
printf "part raid.%s2 --size=4300 --grow --ondisk=%s\n" "$i" "${DRIVES[$i]}" >> /tmp/part-include |
123 |
|
done |
124 |
|
|
125 |
|
# Compute RAID level |
126 |
|
# from https://wiki.contribs.org/Raid |
127 |
|
# 2 Drives - Software RAID 1 |
128 |
|
# 3 Drives - Software RAID 1 + 1 Hot-spare |
129 |
|
# 4-6 Drives - Software RAID 5 + 1 Hot-spare |
130 |
|
# 7+ Drives - Software RAID 6 + 1 Hot-spare |
131 |
|
|
132 |
|
if [ ${#DRIVES[@]} == 2 ] ; then |
133 |
|
LEVEL=1 |
134 |
|
SPARE=0 |
135 |
|
elif [ ${#DRIVES[@]} == 3 ] ; then |
136 |
|
LEVEL=1 |
137 |
|
SPARE=1 |
138 |
|
elif (( ${#DRIVES[@]} > 3 && ${#DRIVES[@]} <= 6 )) ; then |
139 |
|
LEVEL=5 |
140 |
|
SPARE=1 |
141 |
|
else |
142 |
|
LEVEL=6 |
143 |
|
SPARE=1 |
144 |
|
fi |
145 |
|
|
146 |
|
# Set up RAID devices |
147 |
|
printf -v EFIDEVS "raid.%s0 " "${!DRIVES[@]}" |
148 |
|
printf -v BOOTDEVS "raid.%s1 " "${!DRIVES[@]}" |
149 |
|
printf -v ROOTDEVS "raid.%s2 " "${!DRIVES[@]}" |
150 |
|
|
151 |
|
# Include the EFI partition if necessary |
152 |
|
if [ -d /sys/firmware/efi ] ; then |
153 |
|
printf "raid /boot/efi --fstype=efi --level=1 --spares=%s --device=md9 %s\n" "$SPARE" "$EFIDEVS" >> /tmp/part-include |
154 |
|
fi |
155 |
|
|
156 |
|
printf "raid /boot --fstype=xfs --level=1 --spares=%s --device=md0 %s\n" "$SPARE" "$BOOTDEVS" >> /tmp/part-include |
157 |
|
printf "raid pv.01 --level=%s --spares=%s --device=md1 %s\n" "$LEVEL" "$SPARE" "$ROOTDEVS" >> /tmp/part-include |
158 |
|
|
159 |
|
# Set up LVM |
160 |
|
cat >> /tmp/part-include <<EOF |
161 |
|
volgroup main pv.01 |
162 |
|
logvol / --fstype xfs --name=root --vgname=main --grow --size=3000 --label=ROOT |
163 |
|
logvol swap --fstype swap --name=swap --vgname=main --recommended --label=SWAP |
164 |
|
EOF |
165 |
|
|
166 |
# packages to install |
fi |
167 |
%packages |
fi |
|
@^minimal |
|
|
@base |
|
|
@core |
|
|
-chrony |
|
|
-kexec-tools |
|
168 |
|
|
169 |
%end |
%end |
170 |
|
|
171 |
|
|
172 |
# pre script could be inserted there to handle partitionning |
# SME events in post-install |
173 |
|
%post --interpreter=/usr/bin/bash --log=/var/log/ks.post02.log |
174 |
%post --interpreter=/usr/bin/bash |
/sbin/rsyslogd; |
175 |
# before reboot performing post-install |
sleep 2; |
176 |
# this is for first alpha iso. we should put this in anaconda |
/sbin/e-smith/signal-event post-install; |
|
# and / or handle possible upgrade later |
|
|
/sbin/rsyslogd; |
|
|
sleep 2; |
|
|
/sbin/e-smith/signal-event post-install; |
|
177 |
sleep 2; |
sleep 2; |
178 |
/sbin/e-smith/db configuration set UnsavedChanges no; |
/sbin/e-smith/db configuration set UnsavedChanges no; |
179 |
touch /forcequotacheck |
touch /forcequotacheck |
180 |
|
%end |
181 |
|
|
182 |
|
|
183 |
|
%post --nochroot --log=/mnt/sysimage/var/log/ks.post01.log |
184 |
|
#!/bin/bash |
185 |
|
sysimage="/mnt/sysimage" |
186 |
|
cp -r /tmp/anaconda.log ${sysimage}/root/ |
187 |
%end |
%end |