You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.5 KiB
47 lines
1.5 KiB
#!/bin/sh -eux
|
|
|
|
echo "reduce the grub menu time to 1 second"
|
|
sed -i -e 's/^GRUB_TIMEOUT=[0-9]\+$/GRUB_TIMEOUT=1/' /etc/default/grub
|
|
grub2-mkconfig -o /boot/grub2/grub.cfg
|
|
|
|
echo "Remove development and kernel source packages"
|
|
yum -y remove gcc cpp gc kernel-devel kernel-headers glibc-devel elfutils-libelf-devel glibc-headers kernel-devel kernel-headers
|
|
|
|
echo "Remove previous kernels that preserved for rollbacks"
|
|
if ! command -v package-cleanup >/dev/null 2>&1; then
|
|
yum -y install yum-utils
|
|
fi
|
|
package-cleanup --oldkernels --count=1 -y
|
|
|
|
echo "clean all package cache information"
|
|
yum -y clean all --enablerepo=\*;
|
|
|
|
# Clean up network interface persistence
|
|
rm -f /etc/udev/rules.d/70-persistent-net.rules;
|
|
mkdir -p /etc/udev/rules.d/70-persistent-net.rules;
|
|
rm -f /lib/udev/rules.d/75-persistent-net-generator.rules;
|
|
rm -rf /dev/.udev/;
|
|
|
|
for ndev in `ls -1 /etc/sysconfig/network-scripts/ifcfg-*`; do
|
|
if [ "`basename $ndev`" != "ifcfg-lo" ]; then
|
|
sed -i '/^HWADDR/d' "$ndev";
|
|
sed -i '/^UUID/d' "$ndev";
|
|
fi
|
|
done
|
|
|
|
|
|
echo "truncate any logs that have built up during the install"
|
|
find /var/log -type f -exec truncate --size=0 {} \;
|
|
|
|
echo "remove the contents of /tmp and /var/tmp"
|
|
rm -rf /tmp/* /var/tmp/*
|
|
|
|
echo "Force a new random seed to be generated"
|
|
rm -f /var/lib/systemd/random-seed
|
|
|
|
echo "Wipe netplan machine-id (DUID) so machines get unique ID generated on boot"
|
|
truncate -s 0 /etc/machine-id
|
|
|
|
echo "Clear the history so our install commands aren't there"
|
|
rm -f /root/.wget-hsts
|
|
export HISTSIZE=0
|