Skip to content

Commit 394bf5b

Browse files
committed
Prevent error on unsupported distros.
1 parent 94d83c5 commit 394bf5b

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

build.sh

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,20 @@
33

44
# Install Debian dependencies.
55
# TODO: Support Fedora/CentOS/etc. as well.
6-
pkgs='build-essential checkinstall tk-dev libc6-dev'
7-
install=false
8-
for pkg in $pkgs; do
9-
status="$(dpkg-query -W --showformat='${db:Status-Status}' "$pkg" 2>&1)"
10-
if [ ! $? = 0 ] || [ ! "$status" = installed ]; then
11-
install=true
12-
break
6+
if command -v apt &> /dev/null
7+
then
8+
pkgs='build-essential libc6-dev'
9+
install=false
10+
for pkg in $pkgs; do
11+
status="$(dpkg-query -W --showformat='${db:Status-Status}' "$pkg" 2>&1)"
12+
if [ ! $? = 0 ] || [ ! "$status" = installed ]; then
13+
install=true
14+
break
15+
fi
16+
done
17+
if "$install"; then
18+
sudo apt install $pkgs
1319
fi
14-
done
15-
if "$install"; then
16-
sudo apt install $pkgs
1720
fi
1821

1922
set -e

0 commit comments

Comments
 (0)