8000 install-check-clang-version.sh: Add is_installed · ClangBuiltLinux/misc-scripts@d47c454 · GitHub
[go: up one dir, main page]

Skip to content

Commit d47c454

Browse files
committed
install-check-clang-version.sh: Add is_installed
This is a little cleaner for documentation purposes. Signed-off-by: Nathan Chancellor <nathan@kernel.org>
1 parent def258b commit d47c454

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

distro-clang/install-check-clang-version.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,30 @@
11
#!/usr/bin/env bash
22

3+
function is_installed() {
4+
command -v "$1" &>/dev/null
5+
}
6+
37
results=$(dirname "$(readlink -f "${0}")")/results.log
48

59
set -x
610

711
# Debian/Ubuntu
8-
if command -v apt-get &>/dev/null; then
12+
if is_installed apt-get; then
913
export DEBIAN_FRONTEND=noninteractive
1014

1115
apt-get update
1216
apt-get upgrade -y
1317
apt-get install --no-install-recommends -y clang
1418
# Fedora
15-
elif command -v dnf &>/dev/null; then
19+
elif is_installed dnf; then
1620
dnf update -y
1721
dnf install -y clang
1822
# Arch
19-
elif command -v pacman &>/dev/null; then
23+
elif is_installed pacman; then
2024
pacman -Syyu --noconfirm
2125
pacman -S --noconfirm clang
2226
# OpenSUSE Leap/Tumbleweed
23-
elif command -v zypper &>/dev/null; then
27+
elif is_installed zypper; then
2428
zypper -n up
2529
zypper -n in clang
2630
fi

0 commit comments

Comments
 (0)
0