summaryrefslogtreecommitdiffstats
path: root/templates/basic-postinstall.sh
blob: f630b70618004cf4f3675410576a939fa9a5eb9c (plain)
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
##################################################
# BEGIN basic-postinstall.sh
#
[ "@@WEBPROXY@@" = "" ] || {
  http_proxy=@@WEBPROXY@@
  export http_proxy
}

echo "Using web proxy: \$http_proxy"

# Force up the network, as kickstart may not have started it.  Modern
# RHEL/Fedora renames network interfaces to "well-known" names that
# are hard to know in this script.  So find the 1st ethernet interface
# and use it.
rm -f /etc/sysconfig/network-scripts/ifcfg-eth*
rm -f /etc/sysconfig/network-scripts/ifcfg-en*

dev=$(ip link show |
    awk '/^[[:digit:]]/ { dev=gensub(/:/, "", "", $2) } \\
	 /^[[:space:]]*link\\/ether/ { print dev ; exit}')
echo "Forcing up network interface \"$dev\""

ip link set $dev up
ip addr add @@INSTALL_IP@@ dev $dev
if [ -n "@@INSTALL_GW@@" ] ; then
    ip route add default via @@INSTALL_GW@@
fi
ip addr show
ip route show

cat << EOF > /etc/resolv.conf
domain @@DOMAIN@@
search @@DNSSEARCH@@
nameserver @@NAMESERVER@@
EOF

echo "Setting up YUM repositories" 

cat << EOF > /etc/yum.repos.d/autocluster.repo
@@@YUM_TEMPLATE@@@
EOF

# CentOS has some weird plugins that slow thing down
echo "Switching off YUM plugins"

sed -i -e 's@^plugins=1@plugins=0@' /etc/yum.conf

echo "Updating from YUM repositories"
yum clean all
yum -y update
# Leave things in a state that forces any nodes based on this base
# image fetch all of the repo data next time an update is done.
yum clean all

# This stops NICs with fake MAC addresses being carried forward from
# the base install.
rm -f /etc/udev/rules.d/70-persistent-net.rules

sync
#
# END basic-postinstall.sh
##################################################