diff --git a/README.md b/README.md index 3dab44b..9430346 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ # ALHP_PACMAN_HOOKS +In scripts you find a bash script to check the alhp api for building packages, a wrapper script for the use with the hooks and in hooks you find a hook for installing new packages that checks if the package is building right now and one for upgrades. diff --git a/scripts/alhp-check.sh b/scripts/alhp-check.sh index f578f25..0616ea2 100644 --- a/scripts/alhp-check.sh +++ b/scripts/alhp-check.sh @@ -6,7 +6,6 @@ updatesAvailable() { output_json=false check_pkg="" - # Parse arguments while [[ $# -gt 0 ]]; do case "$1" in -j|--json) output_json=true; shift ;; @@ -23,7 +22,6 @@ updatesAvailable() { declare -A pkgs - # Collect installed packages yay -Sl "${repos[@]}" | while read -r _ name version status; do if [[ $status == *installed* ]]; then pkgs["$name"]=1 @@ -34,7 +32,6 @@ updatesAvailable() { api_url="https://api.alhp.dev/packages?limit=0&offset=0&status=queued&status=building${repo_query}" if [[ -n "$check_pkg" ]]; then - # Check if a specific package is building building_pkgs=$(curl -s "$api_url" \ | jq -r --arg pkg "$check_pkg" '.packages[] | select(.split_packages[] == $pkg) | .split_packages[]') @@ -52,7 +49,6 @@ updatesAvailable() { fi else - # Full scan matches=() while read -r pkgname; do if [[ -n "${pkgs[$pkgname]}" ]]; then diff --git a/scripts/alhp-pacman-hook.sh b/scripts/alhp-pacman-hook.sh index 8e3c208..497ff00 100644 --- a/scripts/alhp-pacman-hook.sh +++ b/scripts/alhp-pacman-hook.sh @@ -4,7 +4,6 @@ ALHP_SCRIPT="/usr/local/bin/alhp-check.sh" building_pkgs=() if [[ $# -gt 0 ]]; then - # Check only specified packages (for install hook) for pkg in "$@"; do result=$($ALHP_SCRIPT --check-pkg "$pkg" -j) if [[ "$result" != "[]" ]]; then @@ -12,7 +11,6 @@ if [[ $# -gt 0 ]]; then fi done else - # No args: full scan (for upgrade hook) mapfile -t building_pkgs < <($ALHP_SCRIPT) fi