3 # vim: ts=4 sw=4 sts=4 et tw=72 :
6 # Handle the occurance where SELINUX is actually disabled
7 if [ `grep SELINUX=permissive /etc/selinux/config` ]; then
8 # make sure that the filesystem is properly labelled.
9 # it could be not fully labeled correctly if it was just switched
10 # from disabled, the autorelabel misses some things
11 # skip relabelling on /dev as it will generally throw errors
12 restorecon -R -e /dev /
14 # enable enforcing mode from the very start
17 # configure system for enforcing mode on next boot
18 sed -i 's/SELINUX=permissive/SELINUX=enforcing/' /etc/selinux/config
20 sed -i 's/SELINUX=disabled/SELINUX=permissive/' /etc/selinux/config
23 echo "*******************************************"
24 echo "** SYSTEM REQUIRES A RESTART FOR SELINUX **"
25 echo "*******************************************"
28 # Allow jenkins access to alternatives command to switch java version
29 cat <<EOF >/etc/sudoers.d/89-jenkins-user-defaults
30 Defaults:jenkins !requiretty
31 jenkins ALL = NOPASSWD: /usr/sbin/alternatives
34 echo "---> Updating operating system"
38 # add in components we need or want on systems
39 echo "---> Installing base packages"
40 yum install -y -q @base
41 # separate group installs from package installs since a non-existing
42 # group with dnf based systems (F21+) will fail the install if such
43 # a group does not exist
44 yum install -y -q unzip xz puppet git perl-XML-XPath
46 # All of our systems require Java (because of Jenkins)
47 # Install all versions of the OpenJDK devel but force 1.7.0 to be the
50 echo "---> Configuring OpenJDK"
51 yum install -y -q 'java-*-openjdk-devel'
53 FACTER_OS=`/usr/bin/facter operatingsystem`
54 FACTER_OSVER=`/usr/bin/facter operatingsystemrelease`
57 if [ "$FACTER_OSVER" -ge "21" ]
59 echo "---> not modifying java alternatives as OpenJDK 1.7.0 does not exist"
61 alternatives --set java /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
62 alternatives --set java_sdk_openjdk /usr/lib/jvm/java-1.7.0-openjdk.x86_64
66 alternatives --set java /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
67 alternatives --set java_sdk_openjdk /usr/lib/jvm/java-1.7.0-openjdk.x86_64
73 # Ignore SELinux since slamming that onto Ubuntu leads to
76 # Allow jenkins access to update-alternatives command to switch java version
77 cat <<EOF >/etc/sudoers.d/89-jenkins-user-defaults
78 Defaults:jenkins !requiretty
79 jenkins ALL = NOPASSWD: /usr/bin/update-alternatives
82 echo "---> Updating operating system"
84 apt-get upgrade -y --force-yes -qq
86 # add in stuff we know we need
87 echo "---> Installing base packages"
88 apt-get install -y --force-yes -qq unzip xz-utils puppet git libxml-xpath-perl
91 echo "---> Configuring OpenJDK"
92 apt-get install -y --force-yes -qq openjdk-7-jdk
95 add-apt-repository -y ppa:openjdk-r/ppa
97 # We need to force openjdk-8-jdk to install
98 apt-get install -y -qq openjdk-8-jdk
100 # make sure that we still default to openjdk 7
101 update-alternatives --set java /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
102 update-alternatives --set javac /usr/lib/jvm/java-7-openjdk-amd64/bin/javac
106 # To handle the prompt style that is expected all over the environment
107 # with how use use robotframework we need to make sure that it is
108 # consistent for any of the users that are created during dynamic spin
110 echo 'PS1="[\u@\h \W]> "' >> /etc/skel/.bashrc
112 # Do any Distro specific installations here
113 echo "Checking distribution"
114 FACTER_OS=`/usr/bin/facter operatingsystem`
117 if [ `/usr/bin/facter operatingsystemrelease | /bin/cut -d '.' -f1` = "7" ]; then
120 echo "No extra steps currently for CentOS 7"
124 echo "Installing ODL YUM repo"
125 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
129 echo "---> $FACTER_OS found"
130 echo "No extra steps for $FACTER_OS"
135 echo "---> Attempting to detect OS"
137 if [ -f /usr/bin/yum ]
146 echo "---> RH type system detected"
150 echo "---> Ubuntu system detected"
154 echo "---> Unknown operating system"
158 # execute steps for all systems