Oracle 5.11

This commit is contained in:
Teddy Reed 2015-04-30 15:47:33 -07:00
parent 525c584a0b
commit f5945f98b4
12 changed files with 349 additions and 59 deletions

View File

@ -34,10 +34,9 @@ macro(ADD_OSQUERY_LINK_INTERNAL LINK LINK_PATHS LINK_SET)
string(REPLACE " " ";" ITEMS "${LINK}")
foreach(ITEM ${ITEMS})
find_library("${ITEM}_library" NAMES "lib${ITEM}.a" "${ITEM}" ${LINK_PATHS})
message("-- Found library dependency ${${ITEM}_library}")
LOG("Found library dependency ${${ITEM}_library}")
if("${${ITEM}_library}" STREQUAL "${${ITEM}_library}-NOTFOUND")
string(ASCII 27 Esc)
message(WARNING "${Esc}[31mDependent library '${ITEM}' not found${Esc}[m")
WARNING_LOG("Dependent library '${ITEM}' not found")
list(APPEND ${LINK_SET} ${ITEM})
else()
list(APPEND ${LINK_SET} "${${ITEM}_library}")
@ -226,3 +225,12 @@ function(JOIN VALUES GLUE OUTPUT)
string(REPLACE ";" "${GLUE}" _TMP_STR "${VALUES}")
set(${OUTPUT} "${_TMP_STR}" PARENT_SCOPE)
endfunction(JOIN)
macro(WARNING_LOG MESSAGE)
string(ASCII 27 Esc)
message("-- ${Esc}[31m${MESSAGE}${Esc}[m")
endmacro(WARNING_LOG)
macro(LOG MESSAGE)
message("-- ${MESSAGE}")
endmacro(LOG)

View File

@ -6,7 +6,8 @@ endif()
set(GLOG_ROOT_DIR "${CMAKE_BINARY_DIR}/third-party/glog")
set(GLOG_SOURCE_DIR "${CMAKE_SOURCE_DIR}/third-party/glog")
set(GLOG_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-register -Wno-unnamed-type-template-args -Wno-deprecated -Wno-error")
set(GLOG_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_COMPILE_FLAGS}")
set(GLOG_CXX_FLAGS "${GLOG_CXX_FLAGS} -Wno-deprecated-register -Wno-unnamed-type-template-args -Wno-deprecated -Wno-error")
INCLUDE(ExternalProject)
ExternalProject_Add(

View File

@ -4,13 +4,13 @@ if(NOT DEFINED ENV{CC})
set(CMAKE_C_COMPILER "clang")
else()
set(CMAKE_C_COMPILER "$ENV{CC}")
message("-- Overriding C compiler from clang to $ENV{CC}")
LOG("Overriding C compiler from clang to $ENV{CC}")
endif()
if(NOT DEFINED ENV{CXX})
set(CMAKE_CXX_COMPILER "clang++")
else()
set(CMAKE_CXX_COMPILER "$ENV{CXX}")
message("-- Overriding CXX compiler from clang++ to $ENV{CXX}")
LOG("Overriding CXX compiler from clang++ to $ENV{CXX}")
endif()
add_compile_options(
@ -82,7 +82,7 @@ endif()
# RHEL6 uses a different gcc 4.9 runtime
if(${OSQUERY_BUILD_DISTRO} STREQUAL "rhel6")
set(GCC_RUNTIME "/opt/rh/devtoolset-3/root/usr/")
message("-- Setting RHEL6 GCC runtime: ${GCC_RUNTIME}")
WARNING_LOG("Setting RHEL6 GCC runtime: ${GCC_RUNTIME}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --gcc-toolchain=${GCC_RUNTIME}")
endif()
@ -100,7 +100,7 @@ if(DEFINED ENV{DEBUG})
set(CMAKE_BUILD_TYPE "Debug")
add_compile_options(-g -O0)
add_definitions(-DDEBUG)
message("-- Setting DEBUG build")
WARNING_LOG("Setting DEBUG build")
elseif(DEFINED ENV{SANITIZE})
# make sanitize (cannot make debug sanitize)
add_compile_options(-g -O0 -fno-omit-frame-pointer)
@ -141,6 +141,10 @@ endif()
# Finished setting compiler/compiler flags.
project(OSQUERY)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake" "${CMAKE_MODULE_PATH}")
set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY TRUE)
include(CMakeLibs)
# Make sure deps were built before compiling (else show warning).
execute_process(
COMMAND "${CMAKE_SOURCE_DIR}/tools/provision.sh" check "${CMAKE_BINARY_DIR}"
@ -149,9 +153,8 @@ execute_process(
RESULT_VARIABLE OSQUERY_DEPS_CHECK
OUTPUT_STRIP_TRAILING_WHITESPACE
)
string(ASCII 27 Esc)
if(OSQUERY_DEPS_CHECK)
message("-- ${Esc}[31m${OSQUERY_DEPS_MESSAGE}${Esc}[m")
WARNING_LOG("${OSQUERY_DEPS_MESSAGE}")
endif()
# Discover build version from an environment variable or from the git checkout.
@ -186,30 +189,41 @@ add_definitions(
)
if(APPLE)
message("-- Building for OS X")
LOG("Building for OS X")
elseif(OSQUERY_BUILD_PLATFORM STREQUAL "ubuntu")
set(DEBIAN_BASED TRUE)
set(UBUNTU TRUE)
message("-- Building for Ubuntu")
LOG("Building for Ubuntu")
elseif(OSQUERY_BUILD_PLATFORM STREQUAL "centos")
set(REDHAT_BASED TRUE)
set(CENTOS TRUE)
message("-- Building for CentOS")
LOG("Building for CentOS")
elseif(OSQUERY_BUILD_PLATFORM STREQUAL "rhel")
set(REDHAT_BASED TRUE)
set(RHEL TRUE)
message("-- Building for RHEL")
LOG("Building for RHEL")
elseif(OSQUERY_BUILD_PLATFORM STREQUAL "amazon")
set(REDHAT_BASED TRUE)
set(AMAZON TRUE)
message("-- Building for Amazon")
LOG("Building for Amazon Linux")
elseif(OSQUERY_BUILD_PLATFORM STREQUAL "oracle")
set(REDHAT_BASED TRUE)
set(ORACLE TRUE)
LOG("Building for Oracle Linux")
elseif(OSQUERY_BUILD_PLATFORM STREQUAL "freebsd")
set(FREEBSD TRUE)
message("-- Building for FreeBSD")
LOG("Building for FreeBSD")
endif()
if(REDHAT_BASED)
add_definitions(-DREDHAT_BASED=1)
elseif(DEBIAN_BASED)
add_definitions(-DDEBIAN_BASED=1)
endif()
# Make sure the generated paths exist
execute_process(COMMAND mkdir -p "${CMAKE_BINARY_DIR}/generated")
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake" "${CMAKE_MODULE_PATH}")
set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY TRUE)
# We need to link some packages as dynamic/dependent.
set(CMAKE_FIND_LIBRARY_SUFFIXES .dylib .so)
find_package(OpenSSL REQUIRED)
@ -231,10 +245,13 @@ find_package(Thrift 0.9.1 REQUIRED)
# Python is used for table spec generation and formating.
find_package(PythonInterp 2 REQUIRED)
if(PYTHON_VERSION_MAJOR STREQUAL "2" AND PYTHON_VERSION_MINOR STREQUAL "4")
WARNING_LOG("Found python 2.4, overriding to /usr/bin/python2.6")
set(PYTHON_EXECUTABLE "/usr/bin/python2.6")
endif()
enable_testing()
include(CMakeLibs)
include(Packages)
include(Thrift)

View File

@ -7,18 +7,26 @@
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
ORACLE_RELEASE=/etc/oracle-release
SYSTEM_RELEASE=/etc/system-release
UBUNTU_RELEASE=/etc/lsb-release
function platform() {
local __out=$1
if [[ -n `grep -o "CentOS" $SYSTEM_RELEASE 2>/dev/null` ]]; then
if [[ -f "$ORACLE_RELEASE" ]]; then
FAMILY="redhat"
eval $__out="oracle"
elif [[ -n `grep -o "CentOS" $SYSTEM_RELEASE 2>/dev/null` ]]; then
FAMILY="redhat"
eval $__out="centos"
elif [[ -n `grep -o "Red Hat Enterprise" $SYSTEM_RELEASE 2>/dev/null` ]]; then
FAMILY="redhat"
eval $__out="rhel"
elif [[ -n `grep -o "Amazon Linux" $SYSTEM_RELEASE 2>/dev/null` ]]; then
FAMILY="redhat"
eval $__out="amazon"
elif [[ -f "$UBUNTU_RELEASE" ]]; then
FAMILY="debian"
eval $__out="ubuntu"
else
eval $__out=`uname -s | tr '[:upper:]' '[:lower:]'`
@ -32,7 +40,9 @@ function _platform() {
function distro() {
local __out=$2
if [[ $1 = "centos" ]]; then
if [[ $1 = "oracle" ]]; then
eval $__out=`grep -o "release [5-7]" $SYSTEM_RELEASE | sed 's/release /oracle/g'`
elif [[ $1 = "centos" ]]; then
eval $__out=`grep -o "release [6-7]" $SYSTEM_RELEASE | sed 's/release /centos/g'`
elif [[ $1 = "rhel" ]]; then
eval $__out=`grep -o "release [6-7]" $SYSTEM_RELEASE | sed 's/release /rhel/g'`
@ -57,12 +67,14 @@ function _distro() {
function threads() {
local __out=$1
platform OS
if [ $OS = "centos" ] || [ $OS = "rhel" ] || [ $OS = "ubuntu" ] || [ $OS = "amazon" ]; then
if [ $FAMILY = "redhat" ] || [ $FAMILY = "debian" ]; then
eval $__out=`cat /proc/cpuinfo | grep processor | wc -l`
elif [[ $OS = "darwin" ]]; then
eval $__out=`sysctl hw.ncpu | awk '{print $2}'`
elif [[ $OS = "freebsd" ]]; then
eval $__out=`sysctl -n kern.smp.cpus`
else
eval $__out=1
fi
}

View File

@ -13,6 +13,7 @@ CFLAGS="-fPIE -fPIC -O2 -DNDEBUG"
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
BUILD_DIR="$SCRIPT_DIR/../build"
WORKING_DIR="/tmp/osquery-provisioning"
FILES_DIR="$SCRIPT_DIR/provision/files"
export PATH="$PATH:/usr/local/bin"
source "$SCRIPT_DIR/lib.sh"
@ -39,7 +40,11 @@ function main() {
fi
cd "$WORKING_DIR"
if [[ $OS = "centos" ]]; then
if [[ $OS = "oracle" ]]; then
log "detected oracle ($DISTRO)"
source "$SCRIPT_DIR/provision/oracle.sh"
main_oracle
elif [[ $OS = "centos" ]]; then
log "detected centos ($DISTRO)"
source "$SCRIPT_DIR/provision/centos.sh"
main_centos

View File

@ -9,6 +9,7 @@
function main_centos() {
sudo yum update -y
package epel-release -y
package texinfo
package wget
@ -16,18 +17,21 @@ function main_centos() {
package unzip
package xz
package xz-devel
package epel-release
package python-pip
package python-devel
package rpm-build
package ruby-devel
package rubygems
package bzip2
package bzip2-devel
package openssl-devel
package readline-devel
package rpm-devel
package libblkid-devel
if [[ $DISTRO = "centos6" ]]; then
pushd /etc/yum.repos.d
if [[ ! -f /etc/yum.repos.d/devtools-2.repo ]]; then
sudo wget http://people.centos.org/tru/devtools-2/devtools-2.repo
fi
# Install the CentOS6 Devtools-2 yum repository.
sudo cp $FILES_DIR/centos6.devtools-2.repo /etc/yum.repos.d/
package devtoolset-2-gcc
package devtoolset-2-binutils
@ -44,8 +48,6 @@ function main_centos() {
if [[ ! -d /usr/lib/gcc ]]; then
sudo ln -s /opt/rh/devtoolset-2/root/usr/lib/gcc /usr/lib/
fi
popd
elif [[ $DISTRO = "centos7" ]]; then
package gcc
package binutils
@ -55,14 +57,6 @@ function main_centos() {
package clang
package clang-devel
package bzip2
package bzip2-devel
package openssl-devel
package readline-devel
package rpm-devel
package rpm-build
package libblkid-devel
install_cmake
set_cc clang

View File

@ -0,0 +1,30 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.2.6 (GNU/Linux)
mQGiBEXopTIRBACZDBMOoFOakAjaxw1LXjeSvh/kmE35fU1rXfM7T0AV31NATCLF
l5CQiNDA4oWreDThg2Bf6+LIVTsGQb1V+XXuLak4Em5yTYwMTVB//4/nMxQEbpl/
QB2XwlJ7EQ0vW+kiPDz/7pHJz1p1jADzd9sQQicMtzysS4qT2i5A23j0VwCg1PB/
lpYqo0ZhWTrevxKMa1n34FcD/REavj0hSLQFTaKNLHRotRTF8V0BajjSaTkUT4uk
/RTaZ8Kr1mTosVtosqmdIAA2XHxi8ZLiVPPSezJjfElsSqOAxEKPL0djfpp2wrTm
l/1iVnX+PZH5DRKCbjdCMLDJhYap7YUhcPsMGSeUKrwmBCBJUPc6DhjFvyhA9IMl
1T0+A/9SKTv94ToP/JYoCTHTgnG5MoVNafisfe0wojP2mWU4gRk8X4dNGKMj6lic
vM6gne3hESyjcqZSmr7yELPPGhI9MNauJ6Ob8cTR2T12Fmv9w03DD3MnBstR6vhP
QcqZKhc5SJYYY7oVfxlSOfF4xfwcHQKoD5TOKwIAQ6T8jyFpKbQkRmVkb3JhIEVQ
RUwgPGVwZWxAZmVkb3JhcHJvamVjdC5vcmc+iGQEExECACQFAkXopTICGwMFCRLM
AwAGCwkIBwMCAxUCAwMWAgECHgECF4AACgkQEZzANiF1IfabmQCgzvE60MnHSOBa
ZXXF7uU2Vzu8EOkAoKg9h+j0NuNom6WUYZyJQt4zc5seuQINBEXopTYQCADapnR/
blrJ8FhlgNPl0X9S3JE/kygPbNXIqne4XBVYisVp0uzNCRUxNZq30MpY027JCs2J
nL2fMpwvx33f0phU029vrIZKA3CmnnwVsjcWfMJOVPBmVN7m5bGU68F+PdRIcDsl
PMOWRLkTBZOGolLgIbM4719fqA8etewILrX6uPvRDwywV7/sPCFpRcfNNBUY+Zx3
5bf4fnkaCKxgXgQS3AT+hGYhlzIqQVTkGNveHTnt4SSzgAqR9sSwQwqvEfVtYNeS
w5rDguLG41HQm1Hojv59HNYjH6F/S1rClZi21bLgZbKpCFX76qPt8CTw+iQLBPPd
yoOGHfzyp7nsfhUrAAMFB/9/H9Gpk822ZpBexQW4y3LGFo9ZSnmu+ueOZPU3SqDA
DW1ovZdYzGuJTGGM9oMl6bL8eZrcUBBOFaWge5wZczIE3hx2exEOkDdvq+MUDVD1
axmN45q/7h1NYRp5GQL2ZsoV4g9U2gMdzHOFtZCER6PP9ErVlfJpgBUCdSL93V4H
Sgpkk7znmTOklbCM6l/G/A6q4sCRqfzHwVSTiruyTBiU9lfROsAl8fjIq2OzWJ2T
P9sadBe1llUYaow7txYSUxssW+89avct35gIyrBbof5M+CBXyAOUaSWmpM2eub24
0qbqiSr/Y6Om0t6vSzR8gRk7g+1H6IE0Tt1IJCvCAMimiE8EGBECAA8FAkXopTYC
GwwFCRLMAwAACgkQEZzANiF1IfZQYgCgiZHCv4xb+sTHCn/otc1Ovvi/OgMAnRXY
bbsLFWOfmzAnNIGvFRWy+YHi
=MMNL
-----END PGP PUBLIC KEY BLOCK-----

View File

@ -0,0 +1,5 @@
[testing-devtools-2-centos-$releasever]
name=testing 2 devtools for CentOS $releasever
baseurl=http://people.centos.org/tru/devtools-2/$releasever/$basearch/RPMS
gpgcheck=0

View File

@ -0,0 +1,26 @@
[epel]
name=Extra Packages for Enterprise Linux 5 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
[epel-debuginfo]
name=Extra Packages for Enterprise Linux 5 - $basearch - Debug
#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch/debug
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-debug-5&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
gpgcheck=1
[epel-source]
name=Extra Packages for Enterprise Linux 5 - $basearch - Source
#baseurl=http://download.fedoraproject.org/pub/epel/5/SRPMS
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-source-5&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
gpgcheck=1

View File

@ -7,6 +7,67 @@
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
function install_gcc() {
TARBALL=gcc-4.8.4.tar.gz
URL=http://www.netgull.com/gcc/releases/gcc-4.8.4/gcc-4.8.4.tar.gz
SOURCE=gcc-4.8.4
TARGET=/opt/osquery/gcc
if provision gcc $TARGET/bin/gcc4.8.4; then
log "compiling a gcc toolchain, this may take a while..."
TARGET_SOURCE=$SOURCE
# GCC-dependency: GMP
TARBALL=gmp-6.0.0a.tar.bz2
URL=https://gmplib.org/download/gmp/gmp-6.0.0a.tar.bz2
SOURCE=gmp-6.0.0
if provision gmp $WORKING_DIR/$TARGET_SOURCE/gmp/README; then
log "Moving gmp sources into $TARGET_SOURCE"
cp -R $SOURCE $TARGET_SOURCE/gmp
fi
# GCC-dependency: MPFR
TARBALL=mpfr-3.1.2.tar.gz
URL=http://www.mpfr.org/mpfr-current/mpfr-3.1.2.tar.gz
SOURCE=mpfr-3.1.2
if provision mpfr $WORKING_DIR/$TARGET_SOURCE/mpfr/README; then
log "Moving mpfr sources into $TARGET_SOURCE"
cp -R $SOURCE $TARGET_SOURCE/mpfr
fi
# GCC-dependency: MPC
TARBALL=mpc-1.0.3.tar.gz
URL=http://www.multiprecision.org/mpc/download/mpc-1.0.3.tar.gz
SOURCE=mpc-1.0.3
if provision mpc $WORKING_DIR/$TARGET_SOURCE/mpc/README; then
log "Moving mpc sources into $TARGET_SOURCE"
cp -R $SOURCE $TARGET_SOURCE/mpc
fi
sudo mkdir -p $TARGET
pushd $TARGET_SOURCE
./configure \
--disable-checking \
--enable-languages=c,c++ \
--disable-multilib \
--disable-multiarch \
--enable-shared \
--enable-threads=posix \
--program-suffix=4.8.4 \
--without-included-gettext \
--prefix=$TARGET
make -j $THREADS
sudo make install
[ -L /usr/bin/gcc ] && sudo unlink /usr/bin/gcc
[ -L /usr/bin/g++ ] && sudo unlink /usr/bin/g++
sudo ln -sf $TARGET/bin/gcc4.8.4 /usr/bin/gcc
sudo ln -sf $TARGET/bin/g++4.8.4 /usr/bin/g++
sudo ln -sf $TARGET/lib64/libstdc++.so.6.0.19 /usr/lib64/libstdc++.so.6
popd
fi
}
function install_cmake() {
TARBALL=cmake-3.2.1.tar.gz
URL=https://osquery-packages.s3.amazonaws.com/deps/cmake-3.2.1.tar.gz
@ -54,17 +115,19 @@ function install_rocksdb() {
if provision rocksdb /usr/local/lib/librocksdb.a; then
if [[ ! -f rocksdb-rocksdb-3.10.2/librocksdb.a ]]; then
if [[ $OS = "ubuntu" ]]; then
if [[ $FAMILY = "debian" ]]; then
CLANG_INCLUDE="-I/usr/include/clang/3.4/include"
elif [ $OS = "centos" ] || [ $OS = "rhel" ]; then
elif [ $FAMILY = "redhat" ]; then
CLANG_VERSION=`clang --version | grep version | cut -d" " -f3`
CLANG_INCLUDE="-I/usr/lib/clang/$CLANG_VERSION/include"
fi
pushd $SOURCE
if [[ $OS = "freebsd" ]]; then
CC=cc CXX=c++ gmake static_lib CFLAGS="$CLANG_INCLUDE $CFLAGS"
PORTABLE=1 CC=cc CXX=c++ gmake -j $THREADS static_lib \
CFLAGS="$CLANG_INCLUDE $CFLAGS"
else
CC="$CC" CXX="$CXX" make static_lib CFLAGS="$CLANG_INCLUDE $CFLAGS"
PORTABLE=1 CC="$CC" CXX="$CXX" make -j $THREADS static_lib \
CFLAGS="$CLANG_INCLUDE $CFLAGS"
fi
popd
fi
@ -127,7 +190,7 @@ function install_gflags() {
if provision gflags /usr/local/lib/libgflags.a; then
pushd $SOURCE
cmake -DCMAKE_CXX_FLAGS="$CFLAGS" -DGFLAGS_NAMESPACE:STRING=google .
make -j $THREADS
CC="$CC" CXX="$CXX" make -j $THREADS
sudo make install
popd
fi
@ -142,7 +205,7 @@ function install_iptables_dev() {
pushd $SOURCE
./configure --disable-shared --prefix=/usr/local
pushd libiptc
make -j $THREADS
CC="$CC" CXX="$CXX" make -j $THREADS
sudo make install
popd
pushd include
@ -186,7 +249,7 @@ function install_autoconf() {
if $PROVISION_AUTOCONF; then
pushd $SOURCE
./configure --prefix=/usr
make -j $THREADS
CC="$CC" CXX="$CXX" make -j $THREADS
sudo make install
popd
fi
@ -201,7 +264,7 @@ function install_automake() {
pushd $SOURCE
./bootstrap.sh
./configure --prefix=/usr
make -j $THREADS
CC="$CC" CXX="$CXX" make -j $THREADS
sudo make install
popd
fi
@ -236,15 +299,61 @@ function install_pkgconfig() {
fi
}
function install_udev_devel_095() {
TARBALL=udev-095.tar.gz
URL=https://osquery-packages.s3.amazonaws.com/deps/udev-095.tar.gz
SOURCE=udev-095
if provision udev-095 /usr/local/lib/libudev.a; then
pushd $SOURCE
CC="$CC" CXX="$CXX" make libudev.a
sudo cp libudev.a /usr/local/lib/
popd
fi
}
function install_pip() {
PYTHON_EXECUTABLE=$1
URL=https://bootstrap.pypa.io/get-pip.py
if [[ ! -e /usr/bin/pip ]]; then
curl $URL | sudo $PYTHON_EXECUTABLE -
fi
}
function install_ruby() {
TARBALL=ruby-1.8.7-p370.tar.gz
URL=ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p370.tar.gz
SOURCE=ruby-1.8.7-p370
if provision ruby-1.8.7 /usr/local/bin/ruby; then
pushd $SOURCE
./configure --prefix=/usr/local
CC="$CC" CXX="$CXX" make -j $THREADS
sudo make install
popd
fi
TARBALL=rubygems-1.8.24.tgz
URL=http://production.cf.rubygems.org/rubygems/rubygems-1.8.24.tgz
SOURCE=rubygems-1.8.24
if provision rubygems-1.8.24 /usr/local/bin/gem; then
pushd $SOURCE
sudo ruby setup.rb
popd
fi
}
function package() {
if [[ $OS = "ubuntu" ]]; then
if [[ $FAMILY = "debian" ]]; then
if [[ -n "$(dpkg --get-selections | grep $1)" ]]; then
log "$1 is already installed. skipping."
else
log "installing $1"
sudo apt-get install $1 -y
fi
elif [ $OS = "centos" ] || [ $OS = "rhel" ] || [ $OS = "amazon" ] ; then
elif [ $FAMILY = "redhat" ]; then
if [[ ! -n "$(rpm -V $1)" ]]; then
log "$1 is already installed. skipping."
else
@ -269,14 +378,14 @@ function package() {
}
function remove_package() {
if [[ $OS = "ubuntu" ]]; then
if [[ $FAMILY = "debian" ]]; then
if [[ -n "$(dpkg --get-selections | grep $1)" ]]; then
log "removing $1"
sudo apt-get remove $1 -y
else
log "Removing: $1 is not installed. skipping."
fi
elif [ $OS = "centos" ] || [ $OS = "rhel" ] || [ $OS = "amazon" ]; then
elif [ $FAMILY = "redhat" ]; then
if [[ -n "$(rpm -qa | grep $1)" ]]; then
log "removing $1"
sudo yum remove $1 -y

83
tools/provision/oracle.sh Normal file
View File

@ -0,0 +1,83 @@
#!/usr/bin/env bash
# Copyright (c) 2014, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
function main_oracle() {
if [[ $DISTRO = "oracle5" ]]; then
# Install the Fedora EPEL yum repository.
sudo cp $FILES_DIR/oracle5.epel.repo /etc/yum.repos.d/
sudo cp $FILES_DIR/RPM-GPG-KEY-EPEL /etc/pki/rpm-gpg/
package epel-release -y
fi
sudo yum update -y
package texinfo
package wget
package git-all
package unzip
package xz
package xz-devel
package python-devel
package rpm-build
package bzip2
package bzip2-devel
package openssl-devel
package readline-devel
package rpm-devel
# Not needed, libblkid.a already installed.
#package libblkid-devel
if [[ $DISTRO = "oracle5" ]]; then
package gcc
install_gcc
fi
set_cc gcc
set_cxx g++
install_cmake
install_boost
if [[ $DISTRO = "oracle5" ]]; then
package cryptsetup-luks-devel
install_udev_devel_095
fi
install_gflags
install_iptables_dev
package doxygen
package byacc
package flex
package bison
if [[ $DISTRO = "oracle5" ]]; then
install_autoconf
install_automake
install_libtool
fi
install_snappy
install_rocksdb
install_thrift
install_yara
if [[ $DISTRO = "oracle5" ]]; then
# Install python26 and pip from PyPA.
package python26
package python26-devel
install_pip python2.6
# Install ruby 1.8.7/gems.
install_ruby
fi
gem_install fpm
}

View File

@ -32,6 +32,14 @@ function enable_repo() {
}
function main_rhel() {
if [[ -z `rpm -qa epel-release` ]]; then
if [[ $DISTRO = "rhel6" ]]; then
sudo rpm -iv https://osquery-packages.s3.amazonaws.com/deps/epel-release-6-8.noarch.rpm
elif [[ $DISTRO = "rhel7" ]]; then
sudo rpm -iv https://osquery-packages.s3.amazonaws.com/deps/epel-release-7-5.noarch.rpm
fi
fi
sudo yum update -y
package git
@ -42,14 +50,6 @@ function main_rhel() {
package xz-devel
package subscription-manager
if [[ -z `rpm -qa epel-release` ]]; then
if [[ $DISTRO = "rhel6" ]]; then
sudo rpm -iv https://osquery-packages.s3.amazonaws.com/deps/epel-release-6-8.noarch.rpm
elif [[ $DISTRO = "rhel7" ]]; then
sudo rpm -iv https://osquery-packages.s3.amazonaws.com/deps/epel-release-7-5.noarch.rpm
fi
fi
package python-pip
package python-devel
package rpm-build