zed/script/linux
Aditya Kumar 45d4de75b3
Add jq as a dependency for Linux script for Arch Linux (#13569)
## Error
```sh
./script/install-linux 

+ [[ 0 -gt 0 ]]
+ export ZED_CHANNEL=dev
+ ZED_CHANNEL=dev
++ pwd
+ export 'ZED_UPDATE_EXPLANATION=You need to fetch and rebuild zed in /home/adityakrcodes/repos/zed'
+ ZED_UPDATE_EXPLANATION='You need to fetch and rebuild zed in /home/adityakrcodes/repos/zed'
+ script/bundle-linux
+ getopts h flag
+ export ZED_BUNDLE=true
+ ZED_BUNDLE=true
+ channel=dev
++ script/get-crate-version zed
script/get-crate-version: line 16: jq: command not found <-- ERROR
+ version=
```
The script fails to install zed on Arch Linux due to a missing
dependency, `jq`.
## My machine info
OS: Arch Linux
Kernel: 6.6.34-1-lts 
WM: dwm 
Terminal: kitty
CPU: Ryzen 5 5500U with Radeon Graphics
GPU: AMD ATI 04:00.0 Lucienne 
Memory: 16 GB

## Error Description
The error occurs when running the script in `script/install-linux`,
which is unable to find the `jq` package, which is not installed by
default on the machine.
## Solution
To resolve this issue, you can install `jq` independently by running
`sudo pacman -S jq`. Alternatively, I have updated script `script/linux`
to include `jq` as a dependency ([link to the
commit](2349ad111f)),
ensuring it is installed automatically when running the initial script
for system libraries.

Release Notes:

- N/A
2024-06-27 09:58:53 -06:00

159 lines
2.9 KiB
Bash
Executable File

#!/usr/bin/env bash
set -ex
# install the wasm toolchain
which rustup > /dev/null 2>&1 || curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# if sudo is not installed, define an empty alias
maysudo=$(command -v sudo || command -v doas || true)
# Ubuntu, Debian, etc.
# https://packages.ubuntu.com/
apt=$(command -v apt-get || true)
if [[ -n $apt ]]; then
deps=(
gcc
g++
libasound2-dev
libfontconfig-dev
libwayland-dev
libxkbcommon-x11-dev
libssl-dev
libstdc++-12-dev
libzstd-dev
libvulkan1
libgit2-dev
make
clang
mold
jq
gettext-base
elfutils
libsqlite3-dev
)
$maysudo "$apt" install -y "${deps[@]}"
exit 0
fi
# Fedora, CentOS, RHEL, etc.
# https://packages.fedoraproject.org/
dnf=$(command -v dnf || true)
if [[ -n $dnf ]]; then
deps=(
gcc
g++
clang
mold
alsa-lib-devel
fontconfig-devel
wayland-devel
libxkbcommon-x11-devel
openssl-devel
libzstd-devel
# Perl dependencies are needed for openssl-sys crate see https://docs.rs/openssl/latest/openssl/
perl-FindBin
perl-IPC-Cmd
perl-File-Compare
perl-File-Copy
vulkan-loader
sqlite-devel
)
# libxkbcommon-x11-devel is in the crb repo on RHEL and CentOS, not needed for Fedora
if ! grep -q "Fedora" /etc/redhat-release; then
$maysudo "$dnf" config-manager --set-enabled crb
fi
$maysudo "$dnf" install -y "${deps[@]}"
exit 0
fi
# openSUSE
# https://software.opensuse.org/
zyp=$(command -v zypper || true)
if [[ -n $zyp ]]; then
deps=(
gcc
gcc-c++
clang
make
alsa-devel
fontconfig-devel
wayland-devel
libxkbcommon-x11-devel
openssl-devel
libzstd-devel
libvulkan1
mold
sqlite3-devel
)
$maysudo "$zyp" install -y "${deps[@]}"
exit 0
fi
# Arch, Manjaro, etc.
# https://archlinux.org/packages
pacman=$(command -v pacman || true)
if [[ -n $pacman ]]; then
deps=(
gcc
clang
alsa-lib
fontconfig
wayland
libgit2
libxkbcommon-x11
openssl
zstd
pkgconf
mold
sqlite
jq
)
$maysudo "$pacman" -S --needed --noconfirm "${deps[@]}"
exit 0
fi
# Void
# https://voidlinux.org/packages/
xbps=$(command -v xbps-install || true)
if [[ -n $xbps ]]; then
deps=(
alsa-lib-devel
fontconfig-devel
libxcb-devel
libxkbcommon-devel
libzstd-devel
openssl-devel
wayland-devel
vulkan-loader
mold
sqlite-devel
)
$maysudo "$xbps" -Syu "${deps[@]}"
exit 0
fi
# Gentoo
# https://packages.gentoo.org/
emerge=$(command -v emerge || true)
if [[ -n $emerge ]]; then
deps=(
app-arch/zstd
dev-libs/openssl
dev-libs/wayland
media-libs/alsa-lib
media-libs/fontconfig
media-libs/vulkan-loader
x11-libs/libxcb
x11-libs/libxkbcommon
sys-devel/mold
dev-db/sqlite
)
$maysudo "$emerge" -u "${deps[@]}"
exit 0
fi
echo "Unsupported Linux distribution in script/linux"