Skip to content

Commit

Permalink
install-dependencies.sh: improve arch detect
Browse files Browse the repository at this point in the history
Arch system may be detected simpler by checking
/etc/arch-release.

When script ran not under root it must clearly
report its state. There are cases for AUR that
are incompatible with root.

1) glibc 2.30-3 has sys/sdt.h (systemtap include)
   some old containers may contain glibc older,
   so enforce update on that one.
2) if problems with signatures, ensure having fresh
   archlinux-keyring: pacman -Sy archlinux-keyring && pacman -Syyu
3) aur installations require having sudo and being
   a sudoer. makepkg does not work otherwise.

Tested on Arch 5.4.2-arch1-1 and docker archlinux.

Signed-off-by: Ivan Prisyazhnyy <ivan@scylladb.com>
Message-Id: <20200118161911.823648-1-ivan@scylladb.com>
  • Loading branch information
Ivan Prisyazhnyy authored and avikivity committed Jan 20, 2020
1 parent 96ccbbe commit 40d592c
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
#

# os-release may be missing in container environment by default.
if [ ! -f "/etc/os-release" ]; then
# if we are on Arch, provide os-release
if [ -x "/usr/sbin/pacman" ]; then
/usr/sbin/pacman -Sy --noconfirm filesystem
fi
if [ -f "/etc/os-release" ]; then
. /etc/os-release
elif [ -f "/etc/arch-release" ]; then
export ID=arch
else
echo "/etc/os-release missing."
exit 1
fi

. /etc/os-release

debian_packages=(
ninja-build
ragel
Expand Down Expand Up @@ -110,9 +110,13 @@ centos_packages=(
devtoolset-8-libatomic
)

# glibc 2.30-3 has sys/sdt.h (systemtap include)
# some old containers may contain glibc older,
# so enforce update on that one.
# 1) glibc 2.30-3 has sys/sdt.h (systemtap include)
# some old containers may contain glibc older,
# so enforce update on that one.
# 2) if problems with signatures, ensure having fresh
# archlinux-keyring: pacman -Sy archlinux-keyring && pacman -Syyu
# 3) aur installations require having sudo and being
# a sudoer. makepkg does not work otherwise.
arch_packages=(
gcc
ninja
Expand All @@ -139,6 +143,7 @@ arch_packages=(
fmt
python3
glibc
filesystem
)

opensuse_packages=(
Expand Down Expand Up @@ -184,8 +189,13 @@ elif [ "$ID" = "centos" ] || [ "$ID" = "fedora" ]; then
yum install -y epel-release centos-release-scl scl-utils
yum install -y "${centos_packages[@]}"
fi
elif [ "$ID" = "arch" -o "$ID_LIKE" = "arch" ]; then
pacman -Sy --noconfirm --needed "${arch_packages[@]}"
elif [ "$ID" = "arch" ]; then
# main
if [ "$EUID" -eq "0" ]; then
pacman -Sy --needed --noconfirm "${arch_packages[@]}"
else
echo "seastar: running without root. Skipping main dependencies (pacman)." 1>&2
fi
elif [ "$ID" = "opensuse-leap" ]; then
zypper install -y "${opensuse_packages[@]}"
else
Expand Down

0 comments on commit 40d592c

Please sign in to comment.