diff --git a/forgejo-release.sh b/forgejo-release.sh index e2285e0..e3a096e 100755 --- a/forgejo-release.sh +++ b/forgejo-release.sh @@ -42,7 +42,7 @@ get_tag() { if api GET "repos/$REPO/tags/$TAG_URL" >"$TAG_FILE"; then echo "tag $TAG exists" else - echo "tag $TAG does not exists" + echo "tag $TAG does not exist" fi fi test -s "$TAG_FILE" @@ -172,9 +172,24 @@ upload() { } setup_api() { - if ! which jq curl; then + needed="jq curl" + for cmd in $needed; do + command -v "$cmd" >/dev/null 2>&1 || missing="$missing $cmd" + done + + # debian/ubuntu + if command -v apt-get >/dev/null 2>&1; then apt-get -qq update - apt-get install -y -qq jq curl + apt-get install -y -qq "$missing" + # arch + elif command -v pacman >/dev/null 2>&1; then + pacman -Syu --noconfirm "$missing" + # alpine + elif command -v apk >/dev/null 2>&1; then + apk add --no-cache "$missing" + # gentoo + elif command -v emerge >/dev/null 2>&1; then + emerge -q "$missing" fi }