zed/script/linux

61 lines
1.3 KiB
Plaintext
Raw Normal View History

#!/usr/bin/bash -e
# if not on Linux, do nothing
[[ $(uname) == "Linux" ]] || exit 0
# Copy settings and keymap to the user's home directory if they don't exist
mkdir -p "$HOME/.config/zed"
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
libxcb-dev
alsa-base
cmake
fontconfig
libssl-dev
build-essential
)
$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
)
$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
)
$maysudo "$pacman" -S --noconfirm "${deps[@]}"
exit 0
fi
echo "Unsupported Linux distribution in script/linux"