zed/script/linux
Amin Yahyaabadi d3562d4c9c
Fixes for file-watching, user assets, and system dependencies (#2)
* fix: avoid panics in case of non-existing path for watching

* fix: copy the themes and plugins

* Revert "add a few more libraries to the linux script"

This reverts commit 7509677003.

* fix: add vulkan validation layers to the system deps

* fix: fix the themes paths
2024-02-06 22:54:40 -08:00

64 lines
1.4 KiB
Bash
Executable file

#!/usr/bin/bash -e
# if not on Linux, do nothing
[[ $(uname) == "Linux" ]] || exit 0
# Copy assets to the user's home directory if they don't exist
mkdir -p "$HOME/.config/zed"
mkdir -p "$HOME/.config/zed/plugins"
mkdir -p "$HOME/.config/zed/themes"
cp -ruL ./assets/themes/*/*.json "$HOME/.config/zed/themes"
test -f "$HOME/.config/zed/settings.json" ||
cp -uL ./assets/settings/initial_user_settings.json "$HOME/.config/zed/settings.json"
test -f "$HOME/.config/zed/keymap.json" ||
cp -uL ./assets/keymaps/default.json "$HOME/.config/zed/keymap.json"
# if sudo is not installed, define an empty alias
maysudo=$(command -v sudo || true)
export maysudo
# Ubuntu, Debian, etc.
# https://packages.ubuntu.com/
apt=$(command -v apt-get || true)
if [[ -n $apt ]]; then
deps=(
libasound2-dev
libfontconfig-dev
vulkan-validationlayers*
)
$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=(
alsa-lib-devel
fontconfig-devel
vulkan-validation-layers
)
$maysudo "$dnf" install -y "${deps[@]}"
exit 0
fi
# Arch, Manjaro, etc.
# https://archlinux.org/packages
pacman=$(command -v pacman || true)
if [[ -n $pacman ]]; then
deps=(
alsa-lib
fontconfig
vulkan-validation-layers
)
$maysudo "$pacman" -S --noconfirm "${deps[@]}"
exit 0
fi
echo "Unsupported Linux distribution in script/linux"