Rewrite autocluster in Python
[autocluster.git] / templates / basic-postinstall.sh
1 ##################################################
2 # BEGIN basic-postinstall.sh
3 #
4 [ "@@WEBPROXY@@" = "" ] || {
5   http_proxy=@@WEBPROXY@@
6   export http_proxy
7 }
8
9 echo "Using web proxy: \$http_proxy"
10
11 # Force up the network, as kickstart may not have started it.  Modern
12 # RHEL/Fedora renames network interfaces to "well-known" names that
13 # are hard to know in this script.  So find the 1st ethernet interface
14 # and use it.
15 rm -f /etc/sysconfig/network-scripts/ifcfg-eth*
16 rm -f /etc/sysconfig/network-scripts/ifcfg-en*
17
18 dev=$(ip link show |
19     awk '/^[[:digit:]]/ { dev=gensub(/:/, "", "", $2) } \\
20          /^[[:space:]]*link\\/ether/ { print dev ; exit}')
21 echo "Forcing up network interface \"$dev\""
22
23 ip link set $dev up
24 ip addr add @@INSTALL_IP@@ dev $dev
25 if [ -n "@@INSTALL_GW@@" ] ; then
26     ip route add default via @@INSTALL_GW@@
27 fi
28 ip addr show
29 ip route show
30
31 cat << EOF > /etc/resolv.conf
32 domain @@DOMAIN@@
33 search @@DNSSEARCH@@
34 nameserver @@NAMESERVER@@
35 EOF
36
37 echo "Setting up YUM repositories" 
38
39 cat << EOF > /etc/yum.repos.d/autocluster.repo
40 @@@YUM_TEMPLATE@@@
41 EOF
42
43 # CentOS has some weird plugins that slow thing down
44 echo "Switching off YUM plugins"
45
46 sed -i -e 's@^plugins=1@plugins=0@' /etc/yum.conf
47
48 echo "Updating from YUM repositories"
49 yum clean all
50 yum -y update
51 # Leave things in a state that forces any nodes based on this base
52 # image fetch all of the repo data next time an update is done.
53 yum clean all
54
55 # This stops NICs with fake MAC addresses being carried forward from
56 # the base install.
57 rm -f /etc/udev/rules.d/70-persistent-net.rules
58
59 sync
60 #
61 # END basic-postinstall.sh
62 ##################################################