create check_dependency function
This commit is contained in:
parent
beec20cdda
commit
ee31a9f8e2
17
update.sh
17
update.sh
@ -7,13 +7,20 @@ TAILWINDCSS_REPO_URL=https://api.github.com/repos/tailwindlabs/tailwindcss/relea
|
|||||||
TMP_DIR=/tmp
|
TMP_DIR=/tmp
|
||||||
BIN_DIR=/usr/local/bin
|
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
|
! 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
|
check_dependency curl
|
||||||
! which go >/dev/null 2>&1 && echo "go needs to be installed" >&2 && exit 1
|
check_dependency go
|
||||||
! which jq >/dev/null 2>&1 && echo "jq needs to be installed" >&2 && exit 1
|
check_dependency jq
|
||||||
! which tar >/dev/null 2>&1 && echo "tar needs to be installed" >&2 && exit 1
|
check_dependency tar
|
||||||
! which xargs >/dev/null 2>&1 && echo "xargs needs to be installed" >&2 && exit 1
|
check_dependency xargs
|
||||||
|
|
||||||
echo -e '\nDownloading cpolis...'
|
echo -e '\nDownloading cpolis...'
|
||||||
rm -fr $CPOLIS_DIR/*
|
rm -fr $CPOLIS_DIR/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user