1 |
# System authorization information |
# System authorization information |
2 |
auth --enableshadow --passalgo=sha512 |
auth --enableshadow --passalgo=sha512 |
3 |
|
|
4 |
# Use CDROM installation media |
# Use CDROM installation media |
5 |
cdrom |
#cdrom #what about usb stick |
6 |
|
|
7 |
# we do not want Selinux |
# we do not want Selinux |
8 |
selinux --disabled |
selinux --disabled |
9 |
|
|
10 |
# services to activate |
# services to activate |
11 |
services --disabled=lm_sensors |
services --disabled=lm_sensors |
12 |
|
|
13 |
# default root pass, willbe changed in post-install process anyway |
# default root pass, willbe changed in post-install process anyway |
14 |
rootpw --lock |
rootpw --lock |
15 |
|
|
16 |
|
# Accept eula |
17 |
|
eula --agreed |
18 |
|
|
19 |
# include the partitioning logic from the pre section. |
# include the partitioning logic from the pre section. |
20 |
%include /tmp/part-include |
%include /tmp/part-include |
21 |
|
|
22 |
|
# disable kdump |
23 |
|
%addon com_redhat_kdump --disable |
24 |
|
%end |
25 |
|
|
26 |
|
|
27 |
%pre |
%pre |
28 |
# pre section |
# pre section |
29 |
#----- partitioning logic below-------------- |
#----- partitioning logic below-------------- |
31 |
DIR="/sys/block" |
DIR="/sys/block" |
32 |
|
|
33 |
# minimum size of hard drive needed specified in GIGABYTES |
# minimum size of hard drive needed specified in GIGABYTES |
34 |
MINSIZE=20 |
MINSIZE=5 |
35 |
|
|
|
ROOTDRIVE="" |
|
36 |
|
|
37 |
# /sys/block/*/size is in 512 byte chunks |
# Number of detected drives |
38 |
|
NDEV=0 |
39 |
|
|
40 |
for DEV in sda sdb sdc sdd hda hdb vda vdb xvda xvdb; do |
for DEV in $(lsblk -nl | grep disk | cut -d' ' -f1); do |
41 |
if [ -d $DIR/$DEV ]; then |
if [ -d /sys/block/$DEV ]; then |
42 |
REMOVABLE=`cat $DIR/$DEV/removable` |
REMOVABLE=`cat /sys/block/$DEV/removable` |
43 |
if (( $REMOVABLE == 0 )); then |
if (( $REMOVABLE == 0 )); then |
44 |
echo $DEV |
SIZE=`cat /sys/block/$DEV/size` |
|
SIZE=`cat $DIR/$DEV/size` |
|
45 |
GB=$(($SIZE/2**21)) |
GB=$(($SIZE/2**21)) |
46 |
if [ $GB -gt $MINSIZE ]; then |
if [ $GB -gt $MINSIZE ]; then |
47 |
echo "$(($SIZE/2**21))" |
DRIVES[$NDEV]=$DEV |
48 |
if [ -z $ROOTDRIVE ]; then |
((NDEV++)) |
|
ROOTDRIVE=$DEV |
|
|
fi |
|
49 |
fi |
fi |
50 |
fi |
fi |
51 |
fi |
fi |
52 |
done |
done |
53 |
|
|
54 |
echo "ROOTDRIVE=$ROOTDRIVE" |
# For now keep things simple and just use the first one |
55 |
|
# TODO: |
56 |
# drives smaller than 40GB use smaller boot and swap partitions |
# * Create software RAID depending on the number of detected drives |
57 |
# drives larger than 40GB use percentage-based partition sizes |
# * Allow non LVM install |
58 |
|
|
59 |
if [ $GB -lt 40 ]; then |
ROOTDRIVE=${DRIVES[0]} |
60 |
|
if [ $ROOTDRIVE == "" ] ; then |
61 |
# drives smaller than 40GB |
echo "No drive suitable for installation found! Please proceed manually." |
62 |
|
# first in case detection fails... |
63 |
cat << EOF > /tmp/part-include |
cat << EOF > /tmp/part-include |
64 |
|
# Clear the Master Boot Record |
65 |
zerombr |
zerombr |
66 |
clearpart --all --drives=$ROOTDRIVE --initlabel |
# System bootloader configuration |
67 |
bootloader --location=mbr --driveorder=$ROOTDRIVE |
clearpart --all --initlabel |
68 |
# for boot partition |
# Automatically create partitions, no LVM |
69 |
part /boot --fstype ext4 --size=300 --ondisk=$ROOTDRIVE |
autopart --lvm |
|
# 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 |
|
70 |
|
|
71 |
EOF |
EOF |
72 |
|
|
|
|
|
73 |
else |
else |
74 |
# drives 40GB and larger |
cat <<_EOF > /tmp/part-include |
|
|
|
|
cat << EOF > /tmp/part-include |
|
75 |
zerombr |
zerombr |
76 |
clearpart --all --drives=$ROOTDRIVE --initlabel |
clearpart --all --drives=$ROOTDRIVE --initlabel |
77 |
bootloader --location=mbr --driveorder=$ROOTDRIVE |
bootloader --boot-drive=$ROOTDRIVE |
78 |
# for boot partition |
part /boot --fstype xfs --size=500 --ondisk=$ROOTDRIVE --label=BOOT |
79 |
part /boot --fstype ext4 --size=500 --ondisk=$ROOTDRIVE |
part pv.01 --size=4500 --grow --ondisk=$ROOTDRIVE |
80 |
# for LVM partition |
volgroup main pv.01 |
81 |
part pv.8 --size=4600 --grow --ondisk=$ROOTDRIVE |
logvol / --fstype xfs --name=root --vgname=main --grow --size=3000 --label=ROOT |
82 |
# LVM |
logvol swap --fstype swap --name=swap --vgname=main --recommended --label=SWAP |
83 |
volgroup main --pesize=65536 pv.8 |
_EOF |
|
logvol / --fstype ext4 --name=root --vgname=main --grow --size=3000 |
|
|
logvol swap --fstype swap --name=swap --vgname=main --size=4000 |
|
|
|
|
|
EOF |
|
84 |
|
|
85 |
fi |
fi |
86 |
|
|
88 |
|
|
89 |
|
|
90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
# packages to install |
# packages to install |
92 |
%packages |
%packages |
93 |
@^minimal |
@^minimal |
99 |
%end |
%end |
100 |
|
|
101 |
|
|
|
# pre script could be inserted there to handle partitionning |
|
102 |
|
|
103 |
%post --interpreter=/usr/bin/bash |
%post --interpreter=/usr/bin/bash --log=/var/log/ks.post02.log |
104 |
# before reboot performing post-install |
# before reboot performing post-install |
105 |
# this is for first alpha iso. we should put this in anaconda |
# this is for first alpha iso. we should put this in anaconda |
106 |
# and / or handle possible upgrade later |
# and / or handle possible upgrade later |
112 |
touch /forcequotacheck |
touch /forcequotacheck |
113 |
|
|
114 |
%end |
%end |
115 |
|
|
116 |
|
%post --nochroot --log=/mnt/sysimage/var/log/ks.post01.log |
117 |
|
#!/bin/bash |
118 |
|
sysimage="/mnt/sysimage" |
119 |
|
|
120 |
|
cp -r /tmp/anaconda.log ${sysimage}/root/ |
121 |
|
%end |