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