Skip to repository content

tenant.openagents/omega

No repository description is available.

OpenAgents Git authority 2026-07-28T00:29:42.191Z Public web read
NIP-34 coordinate30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omega
MaintainersHidden in public view
References2 branches · 1 tag
Read-only clonegit clone https://openagents.com/git/tenant.openagents/omega.git
Browse files

linux

284 lines · 7.1 KB · text
1#!/usr/bin/env bash
2
3set -xeuo pipefail
4
5# if root or if sudo/unavailable, define an empty variable
6if [ "$(id -u)" -eq 0 ]
7then maysudo=''
8else maysudo="$(command -v sudo || command -v doas || true)"
9fi
10
11function finalize {
12  # after packages install (curl, etc), get the rust toolchain
13  which rustup > /dev/null 2>&1 || curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
14  cat <<EOF
15Finished installing Linux dependencies with script/linux
16EOF
17}
18
19# Ubuntu, Debian, Mint, Kali, Pop!_OS, Raspbian, etc.
20apt=$(command -v apt-get || true)
21if [[ -n $apt ]]; then
22  deps=(
23    gcc
24    g++
25    libasound2-dev
26    libfontconfig-dev
27    libgit2-dev
28    libglib2.0-dev
29    libssl-dev
30    libva-dev
31    libvulkan1
32    libwayland-dev
33    libx11-xcb-dev
34    libxkbcommon-x11-dev
35    libzstd-dev
36    make
37    cmake
38    clang
39    lld
40    llvm
41    jq
42    git
43    curl
44    gettext-base
45    elfutils
46    libsqlite3-dev
47    musl-tools
48    musl-dev
49    build-essential
50    pipewire
51    xdg-desktop-portal
52  )
53  if (grep -qP 'PRETTY_NAME="(Debian|Raspbian).+13' /etc/os-release); then
54      # libstdc++-14-dev is in build-essential
55      true
56  elif (grep -qP 'PRETTY_NAME="(Linux Mint 22|.+24\.(04|10))' /etc/os-release); then
57    deps+=( libstdc++-14-dev )
58  elif (grep -qP 'PRETTY_NAME="((Debian|Raspbian).+12|Linux Mint 21|.+22\.04)' /etc/os-release); then
59    deps+=( libstdc++-12-dev )
60  elif (grep -qP 'PRETTY_NAME="((Debian|Raspbian).+11|Linux Mint 20|.+20\.04)' /etc/os-release); then
61    # Ubuntu 20.04 ships clang-10 and libstdc++-10 which lack adequate C++20
62    # support for building webrtc-sys (requires -std=c++20, lambdas in
63    # unevaluated contexts from clang 17+, and working std::ranges in the
64    # stdlib).
65    # Note: the prebuilt libwebrtc.a is compiled with libstdc++, so we must
66    # use libstdc++ (not libc++) to avoid ABI mismatches at link time.
67
68    # libstdc++-11-dev (headers with working pointer_traits/contiguous_range)
69    # is only available from the ubuntu-toolchain-r PPA. Add the source list
70    # and GPG key manually instead of using add-apt-repository, whose HKP
71    # keyserver lookups (port 11371) frequently time out in CI.
72    $maysudo "$apt" install -y curl gnupg
73    codename=$(lsb_release -cs)
74    echo "deb https://ppa.launchpadcontent.net/ubuntu-toolchain-r/test/ubuntu $codename main" | \
75      $maysudo tee /etc/apt/sources.list.d/ubuntu-toolchain-r-test.list > /dev/null
76    curl -fsSL 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x1E9377A2BA9EF27F' | \
77      sed -n '/-----BEGIN PGP PUBLIC KEY BLOCK-----/,/-----END PGP PUBLIC KEY BLOCK-----/p' | \
78      $maysudo gpg --dearmor -o /etc/apt/trusted.gpg.d/ubuntu-toolchain-r-test.gpg
79    deps+=( clang-18 libstdc++-11-dev )
80  fi
81
82  $maysudo "$apt" update
83  $maysudo "$apt" install -y "${deps[@]}"
84
85  finalize
86  exit 0
87fi
88
89# Fedora, CentOS, RHEL, Alma, Amazon 2023, Oracle, etc.
90dnf=$(command -v dnf || true)
91# Old Redhat (yum only): Amazon Linux 2, Oracle Linux 7, etc.
92yum=$(command -v yum || true)
93
94if [[ -n $dnf ]] || [[ -n $yum ]]; then
95  pkg_cmd="${dnf:-${yum}}"
96  deps=(
97    musl-gcc
98    gcc
99    clang
100    cmake
101    alsa-lib-devel
102    fontconfig-devel
103    glib2-devel
104    libva-devel
105    wayland-devel
106    libxcb-devel
107    libxkbcommon-x11-devel
108    openssl-devel
109    libzstd-devel
110    vulkan-loader
111    sqlite-devel
112    pipewire
113    xdg-desktop-portal
114    jq
115    git
116    tar
117  )
118  # perl used for building openssl-sys crate. See: https://docs.rs/openssl/latest/openssl/
119  if grep -qP '^ID="?(fedora)' /etc/os-release; then
120    deps+=(
121      perl-FindBin
122      perl-IPC-Cmd
123      perl-File-Compare
124      perl-File-Copy
125    )
126  elif grep -qP '^ID="?(rhel|rocky|alma|centos|ol)' /etc/os-release; then
127    deps+=( perl-interpreter )
128  fi
129
130  # gcc-c++ is g++ on RHEL8 and 8.x clones
131  if grep -qP '^ID="?(rhel|rocky|alma|centos|ol)' /etc/os-release \
132      && grep -qP '^VERSION_ID="?(8)' /etc/os-release; then
133    deps+=( gcc-c++ )
134  else
135    deps+=( g++ )
136  fi
137
138  # libxkbcommon-x11-devel is in a non-default repo on RHEL 8.x/9.x (except on AmazonLinux)
139  if grep -qP '^VERSION_ID="?(8|9)' /etc/os-release && grep -qP '^ID="?(rhel|rocky|centos|alma|ol)' /etc/os-release; then
140    $maysudo dnf install -y 'dnf-command(config-manager)'
141    if grep -qP '^PRETTY_NAME="(AlmaLinux 8|Rocky Linux 8)' /etc/os-release; then
142      $maysudo dnf config-manager --set-enabled powertools
143    elif grep -qP '^PRETTY_NAME="((AlmaLinux|Rocky|CentOS Stream) 9|Red Hat.+(8|9))' /etc/os-release; then
144      $maysudo dnf config-manager --set-enabled crb
145    elif grep -qP '^PRETTY_NAME="Oracle Linux Server 8' /etc/os-release; then
146      $maysudo dnf config-manager --set-enabled ol8_codeready_builder
147    elif grep -qP '^PRETTY_NAME="Oracle Linux Server 9' /etc/os-release; then
148      $maysudo dnf config-manager --set-enabled ol9_codeready_builder
149    else
150      echo "Unexpected distro" && grep 'PRETTY_NAME' /etc/os-release && exit 1
151    fi
152  fi
153
154  $maysudo "$pkg_cmd" install -y "${deps[@]}"
155  finalize
156  exit 0
157fi
158
159# openSUSE
160# https://software.opensuse.org/
161zyp=$(command -v zypper || true)
162if [[ -n $zyp ]]; then
163  deps=(
164    alsa-devel
165    clang
166    cmake
167    fontconfig-devel
168    gcc
169    libva-devel
170    gcc-c++
171    glib2-devel
172    git
173    gzip
174    jq
175    libvulkan1
176    libx11-devel
177    libxcb-devel
178    libxkbcommon-devel
179    libxkbcommon-x11-devel
180    libzstd-devel
181    make
182    openssl-devel
183    sqlite3-devel
184    tar
185    wayland-devel
186    xcb-util-devel
187    pipewire
188    xdg-desktop-portal
189  )
190  $maysudo "$zyp" install -y "${deps[@]}"
191  finalize
192  exit 0
193fi
194
195# Arch, Manjaro, etc.
196# https://archlinux.org/packages
197pacman=$(command -v pacman || true)
198if [[ -n $pacman ]]; then
199  deps=(
200    gcc
201    clang
202    musl
203    cmake
204    alsa-lib
205    fontconfig
206    glib2
207    libva
208    wayland
209    libgit2
210    libxcb
211    libxkbcommon-x11
212    openssl
213    zstd
214    pkgconf
215    sqlite
216    pipewire
217    xdg-desktop-portal
218    jq
219    git
220  )
221  $maysudo "$pacman" -Syu --needed --noconfirm "${deps[@]}"
222  finalize
223  exit 0
224fi
225
226# Void
227# https://voidlinux.org/packages/
228xbps=$(command -v xbps-install || true)
229if [[ -n $xbps ]]; then
230  deps=(
231    gettext-devel
232    clang
233    cmake
234    jq
235    elfutils-devel
236    gcc
237    alsa-lib-devel
238    fontconfig-devel
239    glib-devel
240    libva-devel
241    libxcb-devel
242    libxkbcommon-devel
243    libzstd-devel
244    openssl-devel
245    wayland-devel
246    vulkan-loader
247    sqlite-devel
248    pipewire
249    xdg-desktop-portal
250  )
251  $maysudo "$xbps" -Syu "${deps[@]}"
252  finalize
253  exit 0
254fi
255
256# Gentoo
257# https://packages.gentoo.org/
258emerge=$(command -v emerge || true)
259if [[ -n $emerge ]]; then
260  deps=(
261    app-arch/zstd
262    app-misc/jq
263    dev-libs/glib
264    dev-libs/openssl
265    dev-libs/wayland
266    dev-build/cmake
267    media-libs/alsa-lib
268    media-libs/fontconfig
269    media-libs/libva
270    media-libs/vulkan-loader
271    x11-libs/libxcb
272    x11-libs/libxkbcommon
273    dev-db/sqlite
274    media-video/pipewire
275    sys-apps/xdg-desktop-portal
276  )
277  $maysudo "$emerge" -u "${deps[@]}"
278  finalize
279  exit 0
280fi
281
282echo "Unsupported Linux distribution in script/linux"
283exit 1
284
Served at tenant.openagents/omega Member data and write actions are omitted.