6 # Redirect stdout ( 1> ) and stderr ( 2> ) into named pipes ( >() ) running "tee"
7 #exec 1> >(tee -i /tmp/bootstrap-out.log)
8 #exec 2> >(tee -i /tmp/bootstrap-err.log)
12 PACKAGES="" # initialize PACKAGES
16 VERSION=$(lsb_release -r | awk '{print $2}')
17 DIST=$(lsb_release -i | awk '{print $3}')
18 CODENAME=$(lsb_release -c | awk '{print $2}')
20 ISSUE_TXT=$(head -1 /etc/issue)
21 DIST=$(echo "${ISSUE_TXT}" | awk '{print $1}')
22 if [ "$DIST" = "Ubuntu" ]
24 VERSION=$(echo "${ISSUE_TXT}" | awk '{print $2}' | sed -e 's/^(\d+\.\d+)(\.\d+)?$/\1/')
25 elif [ "$DIST" = "Debian" ]
27 VERSION=$(echo "${ISSUE_TXT}" | awk '{print $3}')
29 echo "Unrecognized distribution: ${DIST}"
33 echo "---> Detected [${DIST} v${VERSION} (${CODENAME})]"
35 export DEBIAN_FRONTEND=noninteractive
36 cat <<EOF >> /etc/apt/apt.conf
40 allow-change-held-packages "true";
41 allow-downgrades "true";
42 allow-remove-essential "true";
53 # Install plymouth labels and themes to get rid of initrd warnings / errors
54 if [ "$VERSION" = '14.04' ]
57 # openjdk-8-jdk is not available in 14.04 repos by default
58 add-apt-repository ppa:openjdk-r/ppa
61 PACKAGES="$PACKAGES openjdk-8-jdk-headless"
63 # Install Oracle's jdk version 8
64 # apt-add-repository -y ppa:webupd8team/java
66 # echo "debconf shared/accepted-oracle-license-v1-1 select true
67 # debconf shared/accepted-oracle-license-v1-1 seen true" | sudo debconf-set-selections
68 # PACKAGES="$PACKAGES oracle-java8-installer"
70 # Install default jdk and plymouth packages
71 PACKAGES="$PACKAGES plymouth-themes plymouth-label default-jdk-headless"
75 echo '---> Updating OS'
76 # Standard update + upgrade dance
79 apt-get -qq dist-upgrade
81 # Fix the silly notion that /bin/sh should point to dash by pointing it to bash
83 update-alternatives --install /bin/sh sh /bin/bash 100
86 PACKAGES="$PACKAGES build-essential autoconf automake bison libssl-dev ccache libtool git dkms debhelper libganglia1-dev libapr1-dev libconfuse-dev"
88 # Install interface manipulation tools, editor, debugger and lsb
89 PACKAGES="$PACKAGES iproute2 bridge-utils vim gdb lsb-release"
91 # Install debian packaging tools
92 PACKAGES="$PACKAGES debhelper dh-systemd dkms"
94 # Install latest kernel and uio
95 PACKAGES="$PACKAGES linux-image-extra-virtual"
97 # $$$ comment out for the moment
98 # PACKAGES="$PACKAGES maven3"
100 # Install virtualenv for test execution
101 PACKAGES="$PACKAGES python-virtualenv python-pip python-dev"
103 echo '---> Installing packages'
104 # disable double quoting check
105 # shellcheck disable=SC2086
106 apt-get -qq install ${PACKAGES}
107 apt-get -qq autoremove
110 # update CA certificates
111 echo '---> Forcing CA certificate update'
112 update-ca-certificates -f
114 # It is not necessary to load the uio kernel module during the bootstrap phase
115 # modprobe uio_pci_generic
117 # Make sure uio loads at boot time
118 echo uio_pci_generic >> /etc/modules
120 # Setup for hugepages using sysctl so it persists across reboots
121 sysctl -w vm.nr_hugepages=1024
124 echo "hugetlbfs /mnt/huge hugetlbfs defaults 0 0" >> /etc/fstab
130 echo '---> Updating OS'
134 echo '---> Installing tools'
135 yum install -q -y @development openssl-devel glibc-static
137 # Install jdk and maven
138 yum install -q -y java-1.8.0-openjdk-devel
140 # Install python development
141 yum search python34-devel 2>&1 | grep -q 'No matches'
144 echo '---> Installing python-devel'
145 yum install -q -y python-devel
147 echo '---> Installying python34-devel'
148 yum install -q -y python34-devel
151 echo '---> Configuring EPEL'
153 yum install -q -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
155 # Install components to build Ganglia modules
156 yum install -q -y {apr,libconfuse,ganglia}-devel mock
159 echo "---> Attempting to detect OS"
161 if [ -f /usr/bin/yum ]
170 echo "---> RH type system detected"
174 echo "---> Ubuntu system detected"
178 echo "---> Unknown operating system"
182 echo "bootstrap process (PID=$$) complete."
184 #exec 1>&- # close STDOUT
185 #exec 2>&- # close STDERR