linux

 1#!/usr/bin/bash -e
 2
 3# if sudo is not installed, define an empty alias
 4maysudo=$(command -v sudo || true)
 5
 6# Ubuntu, Debian, etc.
 7# https://packages.ubuntu.com/
 8apt=$(command -v apt-get || true)
 9if [[ -n $apt ]]; then
10  deps=(
11    libasound2-dev
12    libfontconfig-dev
13    libwayland-dev
14    libxkbcommon-x11-dev
15    libssl-dev
16  )
17  $maysudo "$apt" install -y "${deps[@]}"
18  exit 0
19fi
20
21# Fedora, CentOS, RHEL, etc.
22# https://packages.fedoraproject.org/
23dnf=$(command -v dnf || true)
24if [[ -n $dnf ]]; then
25  deps=(
26    alsa-lib-devel
27    fontconfig-devel
28    wayland-devel
29    libxkbcommon-x11-devel
30    openssl-devel
31  )
32  $maysudo "$dnf" install -y "${deps[@]}"
33  exit 0
34fi
35
36# openSuse
37# https://software.opensuse.org/
38zyp=$(command -v zypper || true)
39if [[ -n $zyp ]]; then
40  deps=(
41    alsa-devel
42    fontconfig-devel
43    wayland-devel
44    libxkbcommon-x11-devel
45    openssl-devel
46  )
47  $maysudo "$zyp" install -y "${deps[@]}"
48  exit 0
49fi
50
51# Arch, Manjaro, etc.
52# https://archlinux.org/packages
53pacman=$(command -v pacman || true)
54if [[ -n $pacman ]]; then
55  deps=(
56    alsa-lib
57    fontconfig
58    wayland
59    libxkbcommon-x11
60    openssl
61  )
62  $maysudo "$pacman" -S --needed --noconfirm "${deps[@]}"
63  exit 0
64fi
65
66echo "Unsupported Linux distribution in script/linux"