This commit is contained in:
pika 2025-05-30 18:06:18 +02:00
parent c583880054
commit 8e7640758b

View file

@ -14,12 +14,12 @@
# fedora = bool # fedora = bool
# opensuse = bool.... # opensuse = bool....
# You can then use it for, `if $arch; then` # You can then use it for, `if $arch; then`
# Also this gives you the _install command, which installs a package pased on the packagemanager/distro used. # Also this gives you the pkg-install command, which installs a package pased on the packagemanager/distro used.
# CAUTION: # CAUTION:
# This only wokrs for generic package names, like neovim, or vim, or tmux etc.. # 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.. # not every package packagemanager has the same packagenames for their packages..
getImports() { getImports() {
i="https://git.k4li.de/scripts/imports/raw/branch/main/distros.sh" i="https://git.k4li.de/scripts/imports/raw/branch/main/dream.sh"
import="$(mktemp)" import="$(mktemp)"
if command_exists curl; then if command_exists curl; then
curl -fsSL $i -o $import curl -fsSL $i -o $import
@ -31,15 +31,15 @@
source "$import" source "$import"
sleep 0.3 sleep 0.3
rm "$import" rm "$import"
echo_warning "cleaned $import" pen bold yellow "cleaned $import"
} }
checkDeps() { checkDeps() {
echo_info "Checking dependencies.." pen bold blue "Checking dependencies.."
if ! command_exists pkgui; then if ! command_exists pkgui; then
return 0 return 0
else else
echo_warning "pkgui is already installed.." pen bold yellow "pkgui is already installed.."
return 69 return 69
fi fi
@ -49,7 +49,7 @@
if command_exists $pkg; then if command_exists $pkg; then
return 0 return 0
else else
echo_warning "$pkg is already installed.." pen bold yellow "$pkg is already installed.."
return 69 return 69
fi fi
;; ;;
@ -57,7 +57,7 @@
if command_exists $pkg; then if command_exists $pkg; then
return 0 return 0
else else
echo_warning "$pkg is required, but missing.." pen bold yellow "$pkg is required, but missing.."
return 69 return 69
fi fi
;; ;;
@ -66,16 +66,16 @@
} }
instDeps() { instDeps() {
echo_info "Installing missing dependencies.." pen bold blue "Installing missing dependencies.."
case "$distro" in case "$distro" in
arch | opensuse | fedora) arch | opensuse | fedora)
run _install go pkg-install go
;; ;;
debian | ubuntu) debian | ubuntu)
run _install golang pkg-install golang
;; ;;
*) *)
echo_error "$distro is not supported by this script" echo-error "$distro is not supported by this script"
;; ;;
esac esac
} }
@ -83,35 +83,31 @@
getPkgUI() { getPkgUI() {
local tempDir="$(mktemp -d)" local tempDir="$(mktemp -d)"
local url="https://git.k4li.de/scripts/installs/raw/branch/main/.src/pkgui" local url="https://git.k4li.de/scripts/installs/raw/branch/main/.src/pkgui"
echo_info "Getting the pkgui binary from $url" pen bold blue "Getting the pkgui binary from $url"
cd $tempDir || mkdir $tempDir && cd $tempDir cd $tempDir || mkdir $tempDir && cd $tempDir
echo_info "Curling the binary directly via $url.." pen bold blue "Curling the binary directly via $url.."
# echo_warning "DEBUG: curl -fsSL $url -o pkgui || pen bold yellow "Could not curl $url"
# $PWD
# $(ls -la)
# "
curl -fsSL $url -o pkgui || echo_warning "Could not curl $url"
chmod +x ./pkgui chmod +x ./pkgui
} }
instPkgUI() { instPkgUI() {
echo_info "Installing the binary" pen bold blue "Installing the binary"
if [ -d "$HOME/.local/bin" ]; then if [ -d "$HOME/.local/bin" ]; then
run ln -srf ./pkgui "$HOME/.local/bin/pkgui" && echo_note "Linked to $HOME/.local/bin/pkgui" ln -srf ./pkgui "$HOME/.local/bin/pkgui" && pen bold blue "Linked to $HOME/.local/bin/pkgui"
else else
echo_note "Couldn't find $HOME/.local/bin directory, linking systemwide.." pen bold blue "Couldn't find $HOME/.local/bin directory, linking systemwide.."
run $_sudo ln -sfr ./pkgui /bin/pkgui && echo_note "Linked to /bin/pkgui" $_sudo ln -sfr ./pkgui /bin/pkgui && pen bold blue "Linked to /bin/pkgui"
fi fi
} }
main() { main() {
if $silent; then if $silent; then
echo_warning "Executing script silently!" pen bold yellow "Executing script silently!"
fi fi
if ! getDependencies; then if ! getDependencies; then
echo_error "Error when installing dependencies.." echo-error "Error when installing dependencies.."
fi fi
checkDeps checkDeps
instDeps instDeps