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