-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcentos7.ks
122 lines (90 loc) · 2.7 KB
/
centos7.ks
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
install
keyboard us
network --bootproto=dhcp --device=eth0 --onboot=on
rootpw --iscrypted $1$UKLtvLuY$kka6S665oCFmU7ivSDZzU.
timezone UTC --isUtc
selinux --enforcing
firewall --disabled
repo --name="CentOS" --baseurl=http://mirror.centos.org/altarch/7/os/i386/ --cost=100
repo --name="Updates" --baseurl=http://mirror.centos.org/altarch/7/updates/i386/ --cost=100
clearpart --all --initlabel
part / --fstype ext4 --size=1024 --grow
reboot
%packages --excludedocs --nobase
bind-utils
bash
yum
vim-minimal
centos-release
shadow-utils
less
-kernel*
-*firmware
grub2
-os-prober
-gettext*
-bind-license
-freetype
iputils
iproute
-systemd
firewalld
rootfiles
passwd
%end
%post
# randomize root password and lock root account
dd if=/dev/urandom count=50 | md5sum | passwd --stdin root
passwd -l root
# create necessary devices
/sbin/MAKEDEV /dev/console
# cleanup unwanted stuff
# ami-creator requires grub during the install, so we remove it (and
# its dependencies) in %post
# some packages get installed even though we ask for them not to be,
# and they don't have any external dependencies that should make
# anaconda install them
yum -y remove grub2 centos-logos hwdata os-prober gettext* \
bind-license freetype kmod dracut passwd
# firewalld is necessary for building on centos7 but it is not
# necessary in the image. remove it and its requirements.
yum -y remove firewalld dbus-glib dbus-python ebtables \
gobject-introspection libselinux-python pygobject3-base \
python-decorator python-slip python-slip-dbus
rm -rf /etc/firewalld
rm -rf /boot
#delete a few systemd things
rm -rf /etc/machine-id
# Add tsflags to keep yum from installing docs
sed -i '/distroverpkg=centos-release/a tsflags=nodocs' /etc/yum.conf
# Remove files that are known to take up lots of space but leave
# directories intact since those may be required by new rpms.
# locales
# nuking the locales breaks things. Lets not do that anymore
# strip most of the languages from the archive.
localedef --delete-from-archive $(localedef --list-archive | \
grep -v -i ^en | xargs )
# prep the archive template
mv /usr/lib/locale/locale-archive /usr/lib/locale/locale-archive.tmpl
# rebuild archive
/usr/sbin/build-locale-archive
#empty the template
:>/usr/lib/locale/locale-archive.tmpl
#Generate installtime file record
/bin/date +%Y%m%d_%H%M > /etc/BUILDTIME
# man pages and documentation
find /usr/share/{man,doc,info,gnome/help} \
-type f | xargs /bin/rm
# cracklib
#find /usr/share/cracklib \
# -type f | xargs /bin/rm
# sln
rm -f /sbin/sln
# ldconfig
rm -rf /etc/ld.so.cache
rm -rf /var/cache/ldconfig/*
rm -rf /var/cache/yum/*
# Clean up after the installer.
rm -f /etc/rpm/macros.imgcreate
# temp fix for systemd /run/lock
%end