mirror of
https://code.forgejo.org/actions/forgejo-release.git
synced 2025-10-13 16:11:56 +03:00
forgejo-release.sh: check_dependencies should only act on passed arguments.
Removed the default curl and jq option, and passed it in when needed.
This commit is contained in:
parent
603d197551
commit
5d73a41e6a
1 changed files with 7 additions and 9 deletions
|
@ -43,16 +43,14 @@ get_arch() {
|
||||||
}
|
}
|
||||||
|
|
||||||
check_dependencies() {
|
check_dependencies() {
|
||||||
# Always required for API parsing and downloads
|
# Expect dependencies to be passed as arguments
|
||||||
deps="curl jq"
|
if [ "$#" -eq 0 ]; then
|
||||||
|
echo "check_dependencies: Please make sure to pass in at least one dependency when calling." >&2
|
||||||
# Append any extra arguments to the list of dependencies to check
|
return 1
|
||||||
if [ "$#" -gt 0 ]; then
|
|
||||||
deps="$deps $*"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
missing=""
|
missing=""
|
||||||
for cmd in $deps; do
|
for cmd in "$@"; do
|
||||||
if ! command -v "$cmd" >/dev/null 2>&1; then
|
if ! command -v "$cmd" >/dev/null 2>&1; then
|
||||||
missing="$missing $cmd"
|
missing="$missing $cmd"
|
||||||
fi
|
fi
|
||||||
|
@ -74,7 +72,7 @@ check_dependencies() {
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_tea() {
|
setup_tea() {
|
||||||
check_dependencies
|
check_dependencies curl
|
||||||
if command -v tea >/dev/null 2>&1; then
|
if command -v tea >/dev/null 2>&1; then
|
||||||
TEA_BIN=$(command -v tea)
|
TEA_BIN=$(command -v tea)
|
||||||
elif ! [ -f "$TEA_BIN" ]; then
|
elif ! [ -f "$TEA_BIN" ]; then
|
||||||
|
@ -215,7 +213,7 @@ upload() {
|
||||||
|
|
||||||
setup_api() {
|
setup_api() {
|
||||||
# Retained for future expansion, but dependency checking now handled globally
|
# Retained for future expansion, but dependency checking now handled globally
|
||||||
check_dependencies
|
check_dependencies curl jq
|
||||||
}
|
}
|
||||||
|
|
||||||
api() {
|
api() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue