forked from jason/cpolis
		
	create check_dependency function
This commit is contained in:
		
							
								
								
									
										17
									
								
								update.sh
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								update.sh
									
									
									
									
									
								
							@@ -7,13 +7,20 @@ TAILWINDCSS_REPO_URL=https://api.github.com/repos/tailwindlabs/tailwindcss/relea
 | 
			
		||||
TMP_DIR=/tmp
 | 
			
		||||
BIN_DIR=/usr/local/bin
 | 
			
		||||
 | 
			
		||||
check_dependency() {
 | 
			
		||||
    if ! which $1 >/dev/null 2>&1; then
 | 
			
		||||
        echo "$1 needs to be installed" >&2
 | 
			
		||||
        exit 1
 | 
			
		||||
    fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
! groups | grep -E 'root|wheel|sudo' >/dev/null && echo "You need administrative privileges for this script" && exit 1
 | 
			
		||||
 | 
			
		||||
! which curl >/dev/null 2>&1 && echo "curl needs to be installed" >&2 && exit 1
 | 
			
		||||
! which go >/dev/null 2>&1 && echo "go needs to be installed" >&2 && exit 1
 | 
			
		||||
! which jq >/dev/null 2>&1 && echo "jq needs to be installed" >&2 && exit 1
 | 
			
		||||
! which tar >/dev/null 2>&1 && echo "tar needs to be installed" >&2 && exit 1
 | 
			
		||||
! which xargs >/dev/null 2>&1 && echo "xargs needs to be installed" >&2 && exit 1
 | 
			
		||||
check_dependency curl
 | 
			
		||||
check_dependency go
 | 
			
		||||
check_dependency jq
 | 
			
		||||
check_dependency tar
 | 
			
		||||
check_dependency xargs
 | 
			
		||||
 | 
			
		||||
echo -e '\nDownloading cpolis...'
 | 
			
		||||
rm -fr $CPOLIS_DIR/*
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user