From c7e49404ea6d2a3e997d6fc1f1f6ce72c1ca1c29 Mon Sep 17 00:00:00 2001 From: pika Date: Fri, 16 May 2025 09:58:17 +0200 Subject: [PATCH] testing --- hyprutils.sh | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/hyprutils.sh b/hyprutils.sh index de9aa71..96d2168 100644 --- a/hyprutils.sh +++ b/hyprutils.sh @@ -7,6 +7,12 @@ command_exists() { command -v "$@" >/dev/null 2>&1 } +if command_exists $PACKAGE; then + echo_warning "$PACKAGE is alread installed!" + echo_warning "Exiting now!" + exit 69 +fi + # WHY: # This import will give you the following variables: # _sudo="sudo -E" <- only if non root user @@ -65,13 +71,11 @@ getDependencies() { # ╰────────────────────────────────────────────────────────────────╯ declare -n pkgArray="${deps[$distro]}" - case "$distro" in - debian) checkAndInstall "${pkgArray[@]}" ;; - *) - echo_error "There are no dependencies to install for $distro" - return 69 - ;; - esac + if checkComp; then + for pkg in "${pkgArray[@]}"; do + checkAndInstall "$pkg" + done + fi } build() { @@ -81,8 +85,8 @@ build() { } cloneAndInstall() { - # local cloneDir="$(mktemp -d)" - local cloneDir="$HOME/.builds" + local cloneDir="$(mktemp -d)" + # local cloneDir="$HOME/.builds" cd $cloneDir || mkdir -p $cloneDir && cd $cloneDir @@ -110,10 +114,12 @@ main() { esac } -if ! $arch || ! $debian; then - echo_error "Your distro $distro is not supported by this script!" - exit 69 -fi +checkComp() { + if ! $arch && ! $debian; then + echo_error "Your distro $distro is not compatible with this script" + return 69 + fi +} if getImports; then silent=false