56 lines
1.4 KiB
Bash
Executable file
56 lines
1.4 KiB
Bash
Executable file
#!/bin/sh
|
|
# Install the system packages this config expects, then install the config.
|
|
set -eu
|
|
|
|
repo_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|
|
|
install_fd() {
|
|
if command -v fd >/dev/null 2>&1; then
|
|
return
|
|
fi
|
|
|
|
if command -v emerge >/dev/null 2>&1; then
|
|
if sudo emerge --ask sys-apps/fd; then
|
|
return
|
|
fi
|
|
echo 'Gentoo fd package failed; trying cargo fallback.' >&2
|
|
fi
|
|
|
|
if command -v cargo >/dev/null 2>&1; then
|
|
tmpdir=$(mktemp -d)
|
|
cargo install --locked --root "$tmpdir" fd-find
|
|
sudo mkdir -p /usr/local/bin
|
|
sudo install -m 755 "$tmpdir/bin/fd" /usr/local/bin/fd
|
|
rm -rf "$tmpdir"
|
|
return
|
|
fi
|
|
|
|
echo 'fd not installed; install sys-apps/fd or cargo manually.' >&2
|
|
}
|
|
|
|
install_deps() {
|
|
if command -v apt-get >/dev/null 2>&1; then
|
|
sudo apt-get update
|
|
sudo apt-get install -y git neovim nodejs npm ripgrep fd-find
|
|
return
|
|
fi
|
|
|
|
if command -v pacman >/dev/null 2>&1; then
|
|
sudo pacman -S --needed git neovim nodejs npm ripgrep fd
|
|
return
|
|
fi
|
|
|
|
if command -v emerge >/dev/null 2>&1; then
|
|
sudo mkdir -p /etc/portage/package.use
|
|
printf '%s\n' 'net-libs/nodejs npm' | sudo tee /etc/portage/package.use/nvim-config-nodejs >/dev/null
|
|
sudo emerge --ask dev-vcs/git app-editors/neovim net-libs/nodejs sys-apps/ripgrep
|
|
install_fd
|
|
return
|
|
fi
|
|
|
|
echo 'Unsupported distro: install git, neovim, nodejs/npm, ripgrep, and fd manually.' >&2
|
|
exit 1
|
|
}
|
|
|
|
install_deps
|
|
sh "$repo_dir/install.sh"
|