diff --git a/rofi.sh b/rofi.sh index 52ed81c..43c358e 100644 --- a/rofi.sh +++ b/rofi.sh @@ -18,27 +18,24 @@ # 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() { - local url="$1" - local import="$(mktemp)" + source-script() { + i="https://git.k4li.de/scripts/imports/raw/branch/main/dream.sh" + import="$(mktemp)" if command_exists curl; then - curl -fsSL $url -o $import - elif command_exists wget; then - wget -O $import $url + curl -fsSL $i -o $import else - echo "curl/wget is required, but missing.." - exit 69 + echo "curl is required, but missing.." + exit 1 fi source "$import" - sleep 0.2 + sleep 0.3 rm "$import" - echo "imported $url" } getDependencies() { local err - echo_info "Checking build dependencies.." + pen bold blue "Checking build dependencies.." # INFO: # ╭─────────────────────────────────────────────────────────────────────────╮ @@ -69,18 +66,15 @@ case "$distro" in debian | ubuntu | arch | fedora | alpine | opensuse) - # echo_info "Installing missing dependencies.." - spin "Instaling missing dependencies.." - if run -err err checkAndInstall "${pkgArray[@]}"; then - check "Installed dependencies $(pen blue ${pkgArray[@]}) correctly" - - # echo - # echo - # echo - # foo="$?" - # echo $foo + # pen bold blue "Installing missing dependencies.." + spin bold blue "Instaling missing packages.." + if run -err err check-and-install ${pkgArray[@]}; then + upclear + check bold green "Build dependencies installed" else - check "$err" + upclear + throw bold red "Error installing build dependencies" + echo-error "${err:-}" fi ;; *) @@ -91,7 +85,6 @@ } rofi_clone_and_build() { - getDependencies local rofiTemp="$(mktemp -d)" local err # echo_pkg clone "Cloning rofi to $rofiTemp/rofi" @@ -134,7 +127,7 @@ main() { if $silent; then - echo_warning "Executing script silently!" + pen bold yellow "Executing script silently!" fi getDependencies @@ -149,16 +142,28 @@ spin blue "Using arch, getting rofi directly.." sleep 1 if run -err err _install rofi; then - check "Installed rofi" + upclear + check bold green "Installed rofi" else - throw "Could not install rofi!" + upclear + throw bold red "Could not install rofi!" echo_error "${err:-}" fi ;; esac } - 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 + local dream=https://git.k4li.de/scripts/imports/raw/branch/main/dream.sh + + if ! command_exists pkg-install && ! command_exists check-and-install && ! command_exists spin; then + source-script $dream + fi + } + + if setup-env; then sleep 3 # ─< package variable >─────────────────────────────────────────────────────────────────── unset PACKAGE @@ -170,8 +175,8 @@ PACKAGE=rofi 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