2024-02-05 10:32:51 +03:00
|
|
|
#!/usr/bin/bash -e
|
2024-01-30 05:04:15 +03:00
|
|
|
|
|
|
|
# if not on Linux, do nothing
|
|
|
|
[[ $(uname) == "Linux" ]] || exit 0
|
|
|
|
|
2024-02-05 10:32:51 +03:00
|
|
|
# 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"
|
|
|
|
|
2024-01-30 05:04:15 +03:00
|
|
|
# if sudo is not installed, define an empty alias
|
|
|
|
maysudo=$(command -v sudo || true)
|
|
|
|
export maysudo
|
|
|
|
|
|
|
|
# Ubuntu, Debian, etc.
|
2024-02-05 10:08:05 +03:00
|
|
|
# https://packages.ubuntu.com/
|
2024-01-30 05:04:15 +03:00
|
|
|
apt=$(command -v apt-get || true)
|
|
|
|
if [[ -n $apt ]]; then
|
2024-02-05 10:08:05 +03:00
|
|
|
deps=(
|
|
|
|
libasound2-dev
|
|
|
|
libfontconfig-dev
|
|
|
|
)
|
2024-01-30 05:04:15 +03:00
|
|
|
$maysudo "$apt" install -y "${deps[@]}"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Fedora, CentOS, RHEL, etc.
|
2024-02-05 10:08:05 +03:00
|
|
|
# https://packages.fedoraproject.org/
|
2024-01-30 05:04:15 +03:00
|
|
|
dnf=$(command -v dnf || true)
|
|
|
|
if [[ -n $dnf ]]; then
|
2024-02-05 10:08:05 +03:00
|
|
|
deps=(
|
|
|
|
alsa-lib-devel
|
|
|
|
fontconfig-devel
|
|
|
|
)
|
2024-01-30 05:04:15 +03:00
|
|
|
$maysudo "$dnf" install -y "${deps[@]}"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Arch, Manjaro, etc.
|
2024-02-05 10:08:05 +03:00
|
|
|
# https://archlinux.org/packages
|
2024-01-30 05:04:15 +03:00
|
|
|
pacman=$(command -v pacman || true)
|
|
|
|
if [[ -n $pacman ]]; then
|
2024-02-05 10:08:05 +03:00
|
|
|
deps=(
|
|
|
|
alsa-lib
|
|
|
|
fontconfig
|
|
|
|
)
|
2024-01-30 05:04:15 +03:00
|
|
|
$maysudo "$pacman" -S --noconfirm "${deps[@]}"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Unsupported Linux distribution in script/linux"
|