osquery-1/tools/provision/ubuntu.sh
2015-06-04 18:25:49 -07:00

143 lines
3.0 KiB
Bash
Executable File

#!/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 add_repo() {
REPO=$1
echo "Adding repository: $REPO"
if [[ $DISTRO = "lucid" ]]; then
sudo add-apt-repository $REPO
else
sudo add-apt-repository -y $REPO
fi
}
function main_ubuntu() {
if [[ $DISTRO = "precise" ]]; then
add_repo ppa:ubuntu-toolchain-r/test
elif [[ $DISTRO = "lucid" ]]; then
add_repo ppa:lucid-bleed/ppa
fi
sudo apt-get update -y
if [[ $DISTRO = "lucid" ]]; then
package git-core
else
package git
fi
package wget
package unzip
package build-essential
package bison
package flex
package devscripts
package debhelper
package python-pip
package python-dev
# package linux-headers-generic
package ruby-dev
package gcc
package doxygen
package autopoint
package libssl-dev
package liblzma-dev
package uuid-dev
package libpopt-dev
package libdpkg-dev
package libudev-dev
package libblkid-dev
package libbz2-dev
package libreadline-dev
if [[ $DISTRO = "lucid" ]]; then
package libopenssl-ruby
package clang
install_gcc
elif [[ $DISTRO = "precise" ]]; then
# Need gcc 4.8 from ubuntu-toolchain-r/test to compile RocksDB/osquery.
package gcc-4.8
package g++-4.8
sudo update-alternatives \
--install /usr/bin/gcc gcc /usr/bin/gcc-4.8 150 \
--slave /usr/bin/g++ g++ /usr/bin/g++-4.8
package clang-3.4
package clang-format-3.4
fi
if [[ $DISTRO = "precise" || $DISTRO = "lucid" ]]; then
package rubygems
# Temporary removes (so we can override default paths).
package autotools-dev
#remove_package pkg-config
remove_package autoconf
remove_package automake
remove_package libtool
#install_pkgconfig
package pkg-config
package libcurl4-openssl-dev
install_autoconf
install_automake
install_libtool
install_boost
else
package clang-3.5
package clang-format-3.5
sudo ln -sf /usr/bin/clang-3.5 /usr/bin/clang
sudo ln -sf /usr/bin/clang++-3.5 /usr/bin/clang++
sudo ln -sf /usr/bin/clang-format-3.5 /usr/bin/clang-format
sudo ln -sf /usr/bin/llvm-config-3.5 /usr/bin/llvm-config
package pkg-config
package autoconf
package automake
package libtool
package libboost1.55-all-dev
fi
set_cc gcc #-4.8
set_cxx g++ #-4.8
install_cmake
install_gflags
install_iptables_dev
if [[ $DISTRO = "lucid" ]]; then
install_snappy
install_libaptpkg
else
# No clang++ on lucid
set_cc clang
set_cxx clang++
package libsnappy-dev
package libapt-pkg-dev
fi
install_thrift
install_rocksdb
install_yara
# Need headers and PC macros
package libgcrypt-dev
package libdevmapper-dev
install_libcryptsetup
gem_install fpm
}