1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
|
#!/bin/bash
#
# Copyright(C) 2023 Sutou Kouhei <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
set -eux
if type sudo > /dev/null 2>&1; then
SUDO=sudo
else
SUDO=
fi
function setup_with_apt () {
if [ -f /etc/debian_version ]; then
${SUDO} apt update
${SUDO} apt install -y -V lsb-release wget
wget https://apache.jfrog.io/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb
${SUDO} apt install -y -V ./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb
rm apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb
${SUDO} apt update
fi
if type lsb_release > /dev/null 2>&1; then
distribution=$(lsb_release --id --short | tr 'A-Z' 'a-z')
code_name=$(lsb_release --codename --short)
else
distribution=unknown
code_name=unknown
fi
package_names=()
case "${distribution}-${code_name}" in
debian-*|ubuntu-*)
package_names+=(
ccache
cmake
doxygen
g++
gcc
gettext
graphviz
libarrow-dev
libedit-dev
liblz4-dev
libmecab-dev
libmsgpack-dev
libsimdjson-dev
libstemmer-dev
libxxhash-dev
libzstd-dev
ninja-build
pkg-config
python3-pip
rapidjson-dev
zlib1g-dev
)
;;
esac
case "${distribution}-${code_name}" in
debian-*|ubuntu-*)
${SUDO} apt install -y -V "${package_names[@]}"
;;
esac
}
function setup_with_dnf () {
os=$(cut -d: -f4 /etc/system-release-cpe)
case ${os} in
amazon)
os=amazon-linux
version=$(cut -d: -f6 /etc/system-release-cpe)
;;
*) # For AlmaLinux
version=$(cut -d: -f5 /etc/system-release-cpe | sed -e 's/\.[0-9]$//')
;;
esac
package_names=(
arrow-devel
cmake
intltool
libedit-devel
libevent-devel
libstemmer-devel
libzstd-devel
lz4-devel
ninja-build
openssl-devel
pkgconfig
ruby
tar
wget
xxhash-devel
zlib-devel
)
case "${os}" in
almalinux)
${SUDO} dnf install -y epel-release "dnf-command(config-manager)"
case "${version}" in
8)
${SUDO} dnf config-manager --set-enabled powertools
;;
9)
${SUDO} dnf config-manager --set-enabled crb
;;
esac
package_names+=(
ccache
doxygen
graphviz
mecab-devel
msgpack-devel
simdjson-devel
)
;;
amazon-linux)
;;
*)
echo "This OS setup is not supported."
exit 1
;;
esac
${SUDO} dnf update -y
${SUDO} dnf install -y \
https://apache.jfrog.io/artifactory/arrow/${os}/${version}/apache-arrow-release-latest.rpm
${SUDO} dnf groupinstall -y "Development Tools"
${SUDO} dnf install -y "${package_names[@]}"
}
if [ -f /etc/debian_version ]; then
setup_with_apt
elif type dnf > /dev/null 2>&1; then
setup_with_dnf
elif type brew > /dev/null 2>&1; then
brew bundle --file="$(dirname "${0}")/Brewfile"
else
echo "This OS setup is not supported."
exit 1
fi
|