2018-05-14 18:49:51 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e -x
|
|
|
|
|
|
|
|
# Dispatches package installation on various OS and distributives
|
|
|
|
|
|
|
|
WHAT=$1
|
|
|
|
|
|
|
|
[[ $EUID -ne 0 ]] && SUDO=sudo
|
|
|
|
|
|
|
|
command -v yum && PACKAGE_MANAGER=yum
|
|
|
|
command -v pkg && PACKAGE_MANAGER=pkg
|
2019-06-30 16:30:06 +00:00
|
|
|
command -v apt-get && PACKAGE_MANAGER=apt
|
2018-05-14 18:49:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
case $PACKAGE_MANAGER in
|
|
|
|
apt)
|
|
|
|
case $WHAT in
|
|
|
|
prepare)
|
|
|
|
$SUDO apt-get update
|
|
|
|
;;
|
|
|
|
svn)
|
|
|
|
$SUDO apt-get install -y subversion
|
|
|
|
;;
|
|
|
|
gcc*)
|
|
|
|
$SUDO apt-get install -y $WHAT ${WHAT/cc/++}
|
|
|
|
;;
|
|
|
|
clang*)
|
|
|
|
$SUDO apt-get install -y $WHAT libc++-dev libc++abi-dev
|
2018-05-14 19:13:00 +00:00
|
|
|
[[ $(uname -m) == "x86_64" ]] && $SUDO apt-get install -y ${WHAT/clang/lld} || true
|
2018-05-14 18:49:51 +00:00
|
|
|
;;
|
|
|
|
git)
|
|
|
|
$SUDO apt-get install -y git
|
|
|
|
;;
|
|
|
|
cmake)
|
|
|
|
$SUDO apt-get install -y cmake3 || $SUDO apt-get install -y cmake
|
|
|
|
;;
|
2018-06-18 02:32:49 +00:00
|
|
|
ninja)
|
|
|
|
$SUDO apt-get install -y ninja-build
|
|
|
|
;;
|
2018-05-14 18:49:51 +00:00
|
|
|
curl)
|
|
|
|
$SUDO apt-get install -y curl
|
|
|
|
;;
|
|
|
|
jq)
|
|
|
|
$SUDO apt-get install -y jq
|
|
|
|
;;
|
|
|
|
libicu-dev)
|
|
|
|
$SUDO apt-get install -y libicu-dev
|
|
|
|
;;
|
|
|
|
libreadline-dev)
|
|
|
|
$SUDO apt-get install -y libreadline-dev
|
|
|
|
;;
|
|
|
|
llvm-libs*)
|
2018-05-14 19:23:32 +00:00
|
|
|
$SUDO apt-get install -y ${WHAT/llvm-libs/liblld}-dev ${WHAT/llvm-libs/libclang}-dev
|
2018-05-14 18:49:51 +00:00
|
|
|
;;
|
|
|
|
qemu-user-static)
|
2018-05-14 18:54:40 +00:00
|
|
|
$SUDO apt-get install -y qemu-user-static
|
2018-05-14 18:49:51 +00:00
|
|
|
;;
|
|
|
|
vagrant-virtualbox)
|
|
|
|
$SUDO apt-get install -y vagrant virtualbox
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Unknown package"; exit 1;
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
2018-06-18 02:32:49 +00:00
|
|
|
yum)
|
|
|
|
case $WHAT in
|
|
|
|
prepare)
|
|
|
|
;;
|
|
|
|
svn)
|
|
|
|
$SUDO yum install -y subversion
|
|
|
|
;;
|
|
|
|
gcc*)
|
|
|
|
$SUDO yum install -y gcc gcc-c++ libstdc++-static
|
|
|
|
;;
|
|
|
|
git)
|
|
|
|
$SUDO yum install -y git
|
|
|
|
;;
|
|
|
|
cmake)
|
|
|
|
$SUDO yum install -y cmake
|
|
|
|
;;
|
|
|
|
ninja)
|
|
|
|
$SUDO yum install -y ninja-build
|
|
|
|
;;
|
|
|
|
curl)
|
|
|
|
$SUDO yum install -y curl
|
|
|
|
;;
|
|
|
|
jq)
|
|
|
|
$SUDO yum install -y jq
|
|
|
|
;;
|
|
|
|
libicu-dev)
|
|
|
|
$SUDO yum install -y libicu-devel
|
|
|
|
;;
|
|
|
|
libreadline-dev)
|
|
|
|
$SUDO yum install -y readline-devel
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Unknown package"; exit 1;
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
2018-05-14 18:49:51 +00:00
|
|
|
pkg)
|
|
|
|
case $WHAT in
|
|
|
|
prepare)
|
|
|
|
;;
|
|
|
|
svn)
|
|
|
|
$SUDO pkg install -y subversion
|
|
|
|
;;
|
|
|
|
gcc*)
|
|
|
|
$SUDO pkg install -y ${WHAT/-/}
|
|
|
|
;;
|
|
|
|
clang*)
|
|
|
|
$SUDO pkg install -y clang-devel
|
|
|
|
;;
|
|
|
|
git)
|
|
|
|
$SUDO pkg install -y git
|
|
|
|
;;
|
|
|
|
cmake)
|
|
|
|
$SUDO pkg install -y cmake
|
|
|
|
;;
|
2018-06-18 02:32:49 +00:00
|
|
|
ninja)
|
|
|
|
$SUDO pkg install -y ninja-build
|
|
|
|
;;
|
2018-05-14 18:49:51 +00:00
|
|
|
curl)
|
|
|
|
$SUDO pkg install -y curl
|
|
|
|
;;
|
|
|
|
jq)
|
|
|
|
$SUDO pkg install -y jq
|
|
|
|
;;
|
|
|
|
libicu-dev)
|
|
|
|
$SUDO pkg install -y icu
|
|
|
|
;;
|
|
|
|
libreadline-dev)
|
|
|
|
$SUDO pkg install -y readline
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Unknown package"; exit 1;
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Unknown distributive"; exit 1;
|
|
|
|
;;
|
|
|
|
esac
|