fixed neovide
This commit is contained in:
parent
a2ba25a426
commit
a386e00079
1 changed files with 17 additions and 90 deletions
107
neovide.sh
107
neovide.sh
|
@ -1,54 +1,4 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# ─< ANSI color codes >───────────────────────────────────────────────────────────────────
|
|
||||||
RED='\033[0;31m'
|
|
||||||
CYAN='\033[0;36m'
|
|
||||||
YELLOW='\033[0;33m'
|
|
||||||
LIGHT_GREEN='\033[0;92m'
|
|
||||||
BOLD='\033[1m'
|
|
||||||
NC='\033[0m' # No Color
|
|
||||||
|
|
||||||
echo_error() {
|
|
||||||
printf "${BOLD}${RED}ERROR: ${NC}${RED}%s${NC}\n" "$1" >&2
|
|
||||||
}
|
|
||||||
|
|
||||||
echo_info() {
|
|
||||||
printf "${BOLD}${CYAN}INFO: ${NC}${CYAN}%s${NC}\n" "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
echo_warning() {
|
|
||||||
printf "${BOLD}${YELLOW}WARNING: ${NC}${YELLOW}%s${NC}\n" "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
echo_note() {
|
|
||||||
printf "${BOLD}${LIGHT_GREEN}NOTE: ${NC}${LIGHT_GREEN}%s${NC}\n" "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
# ─< check if command exists silently >───────────────────────────────────────────────────
|
|
||||||
command_exists() {
|
|
||||||
command -v "$@" >/dev/null 2>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
# ─< Silent execution >─────────────────────────────────────────────────────────────────
|
|
||||||
silentexec() {
|
|
||||||
"$@" >/dev/null 2>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
# ─< Check if the user is root and set _sudo variable if necessary >───────────────────────
|
|
||||||
checkRoot() {
|
|
||||||
if [ "$(id -u)" -ne 0 ]; then
|
|
||||||
if command_exists sudo; then
|
|
||||||
echo_info "User is not root. Using sudo for privileged operations."
|
|
||||||
_sudo="sudo"
|
|
||||||
else
|
|
||||||
echo_error "No sudo found and you're not root! Can't install packages."
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo_info "Root access confirmed."
|
|
||||||
_sudo=""
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
installNeovide() {
|
installNeovide() {
|
||||||
if ! command_exists cargo; then
|
if ! command_exists cargo; then
|
||||||
|
@ -65,16 +15,14 @@ installNeovide() {
|
||||||
|
|
||||||
i_arch() {
|
i_arch() {
|
||||||
deps="base-devel fontconfig freetype2 libglvnd sndio cmake git gtk3 python sdl2 vulkan-intel libxkbcommon-x11"
|
deps="base-devel fontconfig freetype2 libglvnd sndio cmake git gtk3 python sdl2 vulkan-intel libxkbcommon-x11"
|
||||||
$_sudo pacman -Sy
|
|
||||||
for dep in $deps; do
|
for dep in $deps; do
|
||||||
if ! command_exists $dep; then
|
if ! command_exists $dep; then
|
||||||
silentexec $_sudo pacman --noconfirm -S "$dep" || echo_error "Couldn't install $dep"
|
_install "$dep" || echo_error "Couldn't install $dep"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
i_debian() {
|
i_debian() {
|
||||||
$_sudo apt-get update
|
|
||||||
deps="curl gnupg ca-certificates git gcc-multilib g++-multilib cmake libssl-dev pkg-config libfreetype6-dev libasound2-dev libexpat1-dev libxcb-composite0-dev libbz2-dev libsndio-dev freeglut3-dev libxmu-dev libxi-dev libfontconfig1-dev libxcursor-dev"
|
deps="curl gnupg ca-certificates git gcc-multilib g++-multilib cmake libssl-dev pkg-config libfreetype6-dev libasound2-dev libexpat1-dev libxcb-composite0-dev libbz2-dev libsndio-dev freeglut3-dev libxmu-dev libxi-dev libfontconfig1-dev libxcursor-dev"
|
||||||
for dep in $deps; do
|
for dep in $deps; do
|
||||||
if ! command_exists $dep; then
|
if ! command_exists $dep; then
|
||||||
|
@ -84,48 +32,27 @@ i_debian() {
|
||||||
}
|
}
|
||||||
|
|
||||||
i_fedora() {
|
i_fedora() {
|
||||||
deps="fontconfig-devel freetype-devel libX11-xcb libX11-devel libstdc++-static libstdc++-devel"
|
deps="fontconfig-devel freetype-devel libX11-xcb libX11-devel libstdc++-static libstdc++-devel dnf-plugins-core"
|
||||||
$_sudo dnf update
|
|
||||||
for dep in $deps; do
|
for dep in $deps; do
|
||||||
if ! command_exists $dep; then
|
if ! command_exists $dep; then
|
||||||
silentexec $_sudo dnf install "$dep" || echo_error "Couldn't install $dep"
|
_install "$dep" || echo_error "Couldn't install $dep"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
$_sudo dnf groupinstall "Development Tools" "Development Libraries"
|
$_sudo dnf groupinstall "Development Tools" "Development Libraries"
|
||||||
$_sudo dnf install dnf-plugins-core
|
|
||||||
}
|
}
|
||||||
|
|
||||||
checkDistrosAndDependencies() {
|
setup() {
|
||||||
if [ -f /etc/os-release ]; then
|
case "$distro" in
|
||||||
echo_info "Sourcing /etc/os-release to determine the distribution..."
|
arch) i_arch ;;
|
||||||
. /etc/os-release
|
fedora) i_fedora ;;
|
||||||
|
debian | ubuntu) i_debian ;;
|
||||||
case "$ID" in
|
*)
|
||||||
debian | ubuntu | kali | linuxmint | pop | elementary | zorin | kubuntu | neon | kdeneon | deepin | linuxlite | linuxmintdebian | linuxmintubuntu | linuxmintkali | linuxmintpop | linuxmintelementary | linuxmintzorin | linuxmintkubuntu | linuxmintneon | linuxmintkdeneon | linuxmintdeepin | linuxmintlinuxlite) i_debian ;;
|
echo_error "$distro is not supported by this script"
|
||||||
arch | manjaro | endeavouros) i_arch ;;
|
return 69
|
||||||
fedora | centos | rhel | rocky | almalinux) i_fedora ;;
|
;;
|
||||||
*)
|
esac
|
||||||
case "$ID_LIKE" in
|
|
||||||
*debian*) i_debian ;;
|
|
||||||
*arch*) i_arch ;;
|
|
||||||
*fedora*) i_fedora ;;
|
|
||||||
*)
|
|
||||||
echo_error "Unsupported distribution: $ID"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
else
|
|
||||||
echo_error "No os-release file found under /etc/. Exiting now!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
if setup; then
|
||||||
if checkRoot; then
|
installNeovide
|
||||||
checkDistrosAndDependencies && installNeovide
|
fi
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
main
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue