mirror of
				https://code.forgejo.org/actions/forgejo-release.git
				synced 2025-11-04 06:41:57 +02: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() {
 | 
			
		||||
    # Always required for API parsing and downloads
 | 
			
		||||
    deps="curl jq"
 | 
			
		||||
 | 
			
		||||
    # Append any extra arguments to the list of dependencies to check
 | 
			
		||||
    if [ "$#" -gt 0 ]; then
 | 
			
		||||
        deps="$deps $*"
 | 
			
		||||
    # Expect dependencies to be passed as arguments
 | 
			
		||||
    if [ "$#" -eq 0 ]; then
 | 
			
		||||
        echo "check_dependencies: Please make sure to pass in at least one dependency when calling." >&2
 | 
			
		||||
        return 1
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    missing=""
 | 
			
		||||
    for cmd in $deps; do
 | 
			
		||||
    for cmd in "$@"; do
 | 
			
		||||
        if ! command -v "$cmd" >/dev/null 2>&1; then
 | 
			
		||||
            missing="$missing $cmd"
 | 
			
		||||
        fi
 | 
			
		||||
| 
						 | 
				
			
			@ -74,7 +72,7 @@ check_dependencies() {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
setup_tea() {
 | 
			
		||||
    check_dependencies
 | 
			
		||||
    check_dependencies curl
 | 
			
		||||
    if command -v tea >/dev/null 2>&1; then
 | 
			
		||||
        TEA_BIN=$(command -v tea)
 | 
			
		||||
    elif ! [ -f "$TEA_BIN" ]; then
 | 
			
		||||
| 
						 | 
				
			
			@ -215,7 +213,7 @@ upload() {
 | 
			
		|||
 | 
			
		||||
setup_api() {
 | 
			
		||||
    # Retained for future expansion, but dependency checking now handled globally
 | 
			
		||||
    check_dependencies
 | 
			
		||||
    check_dependencies curl jq
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
api() {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue