testing new syntax.. kinda..
This commit is contained in:
parent
26cd0e40e5
commit
7dbb519902
1 changed files with 42 additions and 45 deletions
87
neovim.sh
87
neovim.sh
|
@ -18,7 +18,7 @@
|
|||
# CAUTION:
|
||||
# This only wokrs for generic package names, like neovim, or vim, or tmux etc..
|
||||
# not every package packagemanager has the same packagenames for their packages..
|
||||
getImports() {
|
||||
source-script() {
|
||||
local url="$1"
|
||||
local import="$(mktemp)"
|
||||
|
||||
|
@ -47,7 +47,6 @@
|
|||
|
||||
getDependencies() {
|
||||
local err
|
||||
echo_pkg deps "Checking build dependencies, and installs missing.."
|
||||
|
||||
local depsDebian=(git ninja-build gettext cmake curl build-essential)
|
||||
local depsFedora=(git ninja-build cmake gcc make gettext curl glibc-gconv-extra)
|
||||
|
@ -71,15 +70,11 @@
|
|||
for pkg in "${pkgArray[@]}"; do
|
||||
if ! command_exists $pkg; then
|
||||
spin yellow bold "Installing $(pen red $pkg)"
|
||||
sleep 1
|
||||
if run --err err pkg-install $pkg; then
|
||||
check "$pkg $(pen green installed)!"
|
||||
else
|
||||
throw "Something went wrong! Could not install $(pen bold red $pkg)"
|
||||
run --err err pkg-install $pkg && check "$pkg $(pen green installed)!" ||
|
||||
throw "Something went wrong! Could not install $(pen bold red $pkg)" &&
|
||||
throw "${err:-}"
|
||||
fi
|
||||
else
|
||||
pen "$pkg $(pen green bold 'already installed')"
|
||||
check "$pkg $(pen green bold 'already installed')"
|
||||
fi
|
||||
done
|
||||
;;
|
||||
|
@ -99,31 +94,20 @@
|
|||
|
||||
line
|
||||
|
||||
spin yellow "Cloning $(pen bold red $PACKAGE) $(pen yellow 'sources at') $(pen red $cloneDir/neovim).."
|
||||
# spin yellow "Cloning $(pen bold red $PACKAGE) $(pen yellow 'sources at') $(pen red $cloneDir/neovim).."
|
||||
|
||||
if command_exists git; then
|
||||
sleep 1
|
||||
if run --err err git clone --depth=1 https://github.com/neovim/neovim.git; then
|
||||
line
|
||||
check green "Cloned $PACKAGE sources"
|
||||
cd neovim || throw "Cannot navigate into neovim"
|
||||
# pen ${output:-}
|
||||
else
|
||||
throw "Cannot clone the repo.."
|
||||
pen bold red "The error: ${err:-}"
|
||||
fi
|
||||
run --err err git clone --depth=1 https://github.com/neovim/neovim.git && check green "Cloned $PACKAGE sources" && cd neovim || throw "Error cloning neovim" && pen bold red "The error: ${err:-}"
|
||||
else
|
||||
echo_error "Git was required, but is missing.. exiting now"
|
||||
exit 1
|
||||
return 69
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
makeInstall() {
|
||||
local err
|
||||
line
|
||||
# echo_pkg build "Compiling neovim from source"
|
||||
spin "Compiling neovim from source"
|
||||
spin "Compiling $PACKAGE from source"
|
||||
if run --err err make CMAKE_BUILD_TYPE=RelWithDebInfo; then
|
||||
check "Compiled $PACKAGE from source"
|
||||
line
|
||||
|
@ -138,14 +122,13 @@
|
|||
fi
|
||||
else
|
||||
echo_error "${err:-}"
|
||||
exit 1
|
||||
exit 69
|
||||
fi
|
||||
}
|
||||
|
||||
checkAndInitConfig() {
|
||||
local err
|
||||
|
||||
line
|
||||
if [ -d "$HOME/.config/nvim/" ]; then
|
||||
# echo_pkg qol "Prefetching neovim setup configuration.."
|
||||
spin "Prefetching neovim setup configuration.."
|
||||
|
@ -176,16 +159,6 @@
|
|||
throw "Clone failed!"
|
||||
pen "${err:-}"
|
||||
fi
|
||||
|
||||
spin bold yellow "Also sourcing config!"
|
||||
if run --err err nvim --headless +q; then
|
||||
line
|
||||
check "Prefetching config was successfull"
|
||||
else
|
||||
throw "Prefetching has failed hard!"
|
||||
pen "${err:-}"
|
||||
fi
|
||||
|
||||
;;
|
||||
"pika's minimal config")
|
||||
local url="https://git.k4li.de/dotfiles/nvim-mini.git"
|
||||
|
@ -199,23 +172,34 @@
|
|||
throw "Clone failed!"
|
||||
pen "${err:-}"
|
||||
fi
|
||||
;;
|
||||
none) exit 0 ;;
|
||||
own)
|
||||
local url err
|
||||
seek url "What is the url for your neovim config?"
|
||||
|
||||
spin bold yellow "Also sourcing config!"
|
||||
if run --err err nvim --headless +q; then
|
||||
line
|
||||
check "Prefetching config was successfull"
|
||||
spin yellow "Cloning your config!"
|
||||
if run --err err git clone --recursive --depth=1 $url "$HOME/.config/nvim"; then
|
||||
check "Cloned neovim config"
|
||||
else
|
||||
throw "Prefetching has failed hard!"
|
||||
throw "Clone failed!"
|
||||
pen "${err:-}"
|
||||
fi
|
||||
;;
|
||||
none) return 0 ;;
|
||||
*)
|
||||
echo_error "Something failed HARD!"
|
||||
return 69
|
||||
exit 69
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
spin bold yellow "Also sourcing config!"
|
||||
if run --err err nvim --headless +q; then
|
||||
check "Prefetching config was successfull"
|
||||
else
|
||||
throw "Prefetching has failed hard!"
|
||||
pen "${err:-}"
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
|
@ -233,7 +217,20 @@
|
|||
checkAndInitConfig </dev/tty
|
||||
}
|
||||
|
||||
if getImports "https://git.k4li.de/scripts/imports/raw/branch/main/distros.sh" && getImports "https://git.k4li.de/scripts/beddu/raw/branch/main/dist/beddu.sh"; then
|
||||
setup-env() {
|
||||
local beddu=https://git.k4li.de/scripts/beddu/raw/branch/main/dist/beddu.sh
|
||||
local pika=https://git.k4li.de/scripts/imports/raw/branch/main/distros.sh
|
||||
|
||||
if ! command_exists pkg-install && ! command_exists checkAndInstall; then
|
||||
source-script $pika
|
||||
fi
|
||||
|
||||
if ! command_exists pen && ! command_exists spin; then
|
||||
source-script $beddu
|
||||
fi
|
||||
}
|
||||
|
||||
if setup-env; then
|
||||
# ─< package variable >───────────────────────────────────────────────────────────────────
|
||||
unset PACKAGE
|
||||
|
||||
|
@ -261,6 +258,6 @@
|
|||
main </dev/tty
|
||||
fi
|
||||
|
||||
echo_note "Cleaning up old $cloneDir directory.."
|
||||
pen grey bold "Cleaning up old $cloneDir directory.."
|
||||
rm -rf "$cloneDir"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue