This commit is contained in:
pika 2025-05-18 18:26:57 +02:00
parent b194b822c8
commit 17fa06a193
4 changed files with 139 additions and 72 deletions

View file

@ -6,6 +6,30 @@
command -v "$@" >/dev/null 2>&1
}
# ─< package variable >───────────────────────────────────────────────────────────────────
unset PACKAGE
# ─< argument list variables >────────────────────────────────────────────────────────────
silent=false
sleep 0.1
PACKAGE=neovim
if command_exists "$PACKAGE"; then
echo_warning "$PACKAGE is already installed!"
echo_warning "Exiting now!"
exit 69
fi
# ─< parse arguments and get variable contents >──────────────────────────────────────────
for arg in "$@"; do
case "$arg" in
--silent | -s)
export silent=true
;;
esac
done
# WHY:
# This import will give you the following variables:
# _sudo="sudo -E" <- only if non root user
@ -34,14 +58,14 @@
echo_warning "cleaned $import"
}
installBuildDependencies() {
getDependencies() {
echo_info "Checking build dependencies, and installs missing.."
local depsDebian=(ninja-build gettext cmake curl build-essential)
local depsFedora=(ninja-build cmake gcc make gettext curl glibc-gconv-extra)
local depsOpensuse=(ninja cmake gcc-c++ gettext-tools curl)
local depsArch=(base-devel cmake ninja curl)
local depsAlpine=(build-base cmake coreutils curl gettext-tiny-dev)
local depsDebian=(git ninja-build gettext cmake curl build-essential)
local depsFedora=(git ninja-build cmake gcc make gettext curl glibc-gconv-extra)
local depsOpensuse=(git ninja cmake gcc-c++ gettext-tools curl)
local depsArch=(git base-devel cmake ninja curl)
local depsAlpine=(git build-base cmake coreutils curl gettext-tiny-dev)
declare -A deps=(
[debian]="depsDebian"
@ -117,24 +141,24 @@
fi
}
main() {
if $silent; then
echo_warning "Executing script silently!"
fi
if ! getDependencies; then
echo_error "Error when installing dependencies.."
fi
cloneSources
makeInstall
checkAndInitConfig
}
if getImports; then
case "$1" in
--silent | -s)
silent=true
echo_warning "Running the script silently.."
;;
*)
silent=false
;;
esac
main
fi
installBuildDependencies
cloneSources
makeInstall
checkAndInitConfig
echo_note "Cleaning up old $cloneDir directory.."
rm -rf "$cloneDir"
}