From d657ae4f4b03f538bba2c812f78e9649b79b3fb6 Mon Sep 17 00:00:00 2001 From: pika Date: Sat, 24 May 2025 02:34:45 +0200 Subject: [PATCH] fix? --- gbar.sh | 55 +++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 18 deletions(-) diff --git a/gbar.sh b/gbar.sh index 52801ab..bc0f0c8 100644 --- a/gbar.sh +++ b/gbar.sh @@ -19,7 +19,7 @@ # 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() { - local url="https://git.k4li.de/scripts/imports/raw/branch/main/distros.sh" + local url="https://git.k4li.de/scripts/imports/raw/branch/main/dreams.sh" local import="$(mktemp)" if command_exists curl; then curl -fsSL $url -o $import @@ -36,7 +36,7 @@ } getDependencies() { - echo_info "Checking build dependencies.." + # pen bold yellow "Checking build dependencies.." # INFO: # ╭─────────────────────────────────────────────────────────────────────────╮ @@ -65,38 +65,51 @@ declare -n pkgArray="${deps[$distro]}" case "$distro" in - debian | ubuntu) checkAndInstall "${pkgArray[@]}" ;; + debian | ubuntu) checkAndInstall ${pkgArray[@]} ;; arch) return 0 ;; *) - echo_error "Cannot install for $distro" + echo-error "Cannot install for $distro" return 69 ;; esac } main() { - if $silent; then - echo_warning "Executing script silently!" - fi + # if $silent; then + # echo_warning "Executing script silently!" + # fi if ! getDependencies; then - echo_error "Error when installing dependencies.." + echo-error "Error when installing dependencies.." fi case "$distro" in arch) - checkAndInstall gbar-git + checkAndInstall gbar-git bluez ;; debian | ubuntu) local cloneDir="$(mktemp -d)" - echo_pkg clone "Cloning gBar source into $cloneDir/gbar" + # echo_pkg clone "Cloning gBar source into $cloneDir/gbar" + spin bold yellow "Cloning gBar source into $cloneDir/gbar" - cd "$cloneDir" || mkdir "$cloneDir" && cd "$cloneDir" - git clone --depth=1 https://github.com/scorpion-26/gBar.git gbar && cd gbar + cd "$cloneDir" || silentexec mkdir "$cloneDir" && cd "$cloneDir" + if run --err err git clone --depth=1 https://github.com/scorpion-26/gBar.git gbar; then + check "Cloned $PACKAGE-sources" + cd gbar + else + throw "Error cloning $PACKAGE-sources!" + echo-error "${err:-}" + fi - run meson setup build + spin "Building $PACKAGE.." + if run meson setup build && run ninja -C build; then + check "Build $PACKAGE" + else + throw "Error building $PACKAGE" + echo-error "${err:-}" + fi - run ninja -C build + # run ninja -C build $_sudo ninja -C build install @@ -105,7 +118,7 @@ if command_exists gBar; then echo_pkg post-installation-check "Gbar was installed successfully" else - echo_warning "Something went wrong.. maybe.." + pen bold yellow "Something went wrong.. maybe.." fi ;; *) @@ -115,7 +128,13 @@ esac } - if getImports; then + setup-env() { + if ! command_exists pkg-install && ! command_exists pen; then + getImports + fi + } + + if setup-env; then # ─< package variable >─────────────────────────────────────────────────────────────────── unset PACKAGE @@ -126,8 +145,8 @@ PACKAGE=gBar if command_exists "$PACKAGE"; then - echo_warning "$PACKAGE is already installed!" - echo_warning "Exiting now!" + pen bold yellow "$PACKAGE is already installed!" + pen bold yellow "Exiting now!" exit 69 fi