15d47f68cd8bb3005c84358b545ff56bfba54835
[releng/builder.git] / vagrant / rackspace-convert-base / bootstrap.sh
1 #!/bin/bash
2
3 # vim: ts=4 sw=4 sts=4 et tw=72 :
4
5 # Handle the occurance where SELINUX is actually disabled
6 if [ `grep SELINUX=permissive /etc/selinux/config` ]; then
7     # make sure that the filesystem is properly labelled.
8     # it could be not fully labeled correctly if it was just switched
9     # from disabled, the autorelabel misses some things
10     # skip relabelling on /dev as it will generally throw errors
11     restorecon -R -e /dev /
12
13     # enable enforcing mode from the very start
14     setenforce enforcing
15
16     # configure system for enforcing mode on next boot
17     sed -i 's/SELINUX=permissive/SELINUX=enforcing/' /etc/selinux/config
18 else
19     sed -i 's/SELINUX=disabled/SELINUX=permissive/' /etc/selinux/config
20     touch /.autorelabel
21
22     echo "*******************************************"
23     echo "** SYSTEM REQUIRES A RESTART FOR SELINUX **"
24     echo "*******************************************"
25 fi
26
27 yum clean all -q
28 yum update -y -q
29
30 # add in components we need or want on systems
31 yum install -y -q @base unzip xz puppet git perl-XML-XPath
32
33 # All of our systems require Java (because of Jenkins)
34 # Install all versions of the OpenJDK devel but force 1.7.0 to be the
35 # default
36
37 yum install -y -q 'java-*-openjdk-devel'
38 alternatives --set java /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
39 alternatives --set java_sdk_openjdk /usr/lib/jvm/java-1.7.0-openjdk.x86_64
40
41 # To handle the prompt style that is expected all over the environment
42 # with how use use robotframework we need to make sure that it is
43 # consistent for any of the users that are created during dynamic spin
44 # ups
45 echo 'PS1="[\u@\h \W]> "' >> /etc/skel/.bashrc
46
47 # Do any Distro specific installations here
48 echo "Checking distribution"
49 if [ `/usr/bin/facter operatingsystem` = "Fedora" ]; then
50     echo "---> Fedora found"
51     echo "No extra steps for Fedora"
52 else
53     if [ `/usr/bin/facter operatingsystemrelease | /bin/cut -d '.' -f1` = "7" ]; then
54         echo "---> CentOS 7"
55         echo "No extra steps currently for CentOS 7"
56     else
57         echo "---> CentOS 6"
58         echo "Installing ODL YUM repo"
59         yum install -q -y https://nexus.opendaylight.org/content/repositories/opendaylight-yum-epel-6-x86_64/rpm/opendaylight-release/0.1.0-1.el6.noarch/opendaylight-release-0.1.0-1.el6.noarch.rpm
60     fi
61 fi