forked from p15670423/monkey
Enable deployment_scripts/config to use wget or curl
This commit is contained in:
parent
b84d1f1708
commit
c807104a38
|
@ -4,8 +4,20 @@ export MONKEY_FOLDER_NAME="infection_monkey"
|
||||||
# Url of public git repository that contains monkey's source code
|
# Url of public git repository that contains monkey's source code
|
||||||
export MONKEY_GIT_URL="https://github.com/guardicore/monkey"
|
export MONKEY_GIT_URL="https://github.com/guardicore/monkey"
|
||||||
|
|
||||||
|
exists() {
|
||||||
|
command -v "$1" >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
get_latest_release() {
|
get_latest_release() {
|
||||||
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub API
|
RELEASE_URL="https://api.github.com/repos/$1/releases/latest"
|
||||||
|
|
||||||
|
if exists wget; then
|
||||||
|
RELEASE_INFO=$(wget --quiet -O - "$RELEASE_URL") # Get latest release from GitHub API
|
||||||
|
else
|
||||||
|
RELEASE_INFO=$(curl --silent "$RELEASE_URL") # Get latest release from GitHub API
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$RELEASE_INFO" |
|
||||||
grep '"tag_name":' | # Get tag line
|
grep '"tag_name":' | # Get tag line
|
||||||
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
|
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue