File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
+ function is_installed() {
4
+ command -v " $1 " & > /dev/null
5
+ }
6
+
3
7
results=$( dirname " $( readlink -f " ${0} " ) " ) /results.log
4
8
5
9
set -x
6
10
7
11
# Debian/Ubuntu
8
- if command -v apt-get & > /dev/null ; then
12
+ if is_installed apt-get; then
9
13
export DEBIAN_FRONTEND=noninteractive
10
14
11
15
apt-get update
12
16
apt-get upgrade -y
13
17
apt-get install --no-install-recommends -y clang
14
18
# Fedora
15
- elif command -v dnf & > /dev/null ; then
19
+ elif is_installed dnf; then
16
20
dnf update -y
17
21
dnf install -y clang
18
22
# Arch
19
- elif command -v pacman & > /dev/null ; then
23
+ elif is_installed pacman; then
20
24
pacman -Syyu --noconfirm
21
25
pacman -S --noconfirm clang
22
26
# OpenSUSE Leap/Tumbleweed
23
- elif command -v zypper & > /dev/null ; then
27
+ elif is_installed zypper; then
24
28
zypper -n up
25
29
zypper -n in clang
26
30
fi
You can’t perform that action at this time.
0 commit comments