Merge pull request #397 from parkervcp/update/scripts

update scripts folder
This commit is contained in:
Michael (Parker) Parker 2019-12-29 18:08:59 -05:00 committed by GitHub
commit a6de4d39af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 13 deletions

2
.gitignore vendored
View File

@ -1,3 +1,3 @@
*.DS_Store
node_modules/
.vuepress/
.vuepress/*

View File

@ -0,0 +1,11 @@
## this is a simple script to validate a download url actaully exists
if [ ! -z "${DOWNLOAD_URL}"]; then
if curl --output /dev/null --silent --head --fail ${DOWNLOAD_URL}; then
echo -e "link is valid. setting download link to ${DOWNLOAD_URL}"
DOWNLOAD_LINK=${DOWNLOAD_URL}
else
echo -e "link is invalid closing out"
exit 2
fi
fi

View File

@ -3,26 +3,25 @@
## this supports using oauth/personal access tokens via GITHUB_USER and GITHUB_OAUTH_TOKEN (both are required.)
## if you are getting hit with GitHub API limit issues then you need to have the user and token set.
if [ -z "$GITHUB_USER" ] && [ -z "$GITHUB_OAUTH_TOKEN" ] ; then
if [ -z "${GITHUB_USER}" ] && [ -z "${GITHUB_OAUTH_TOKEN}" ] ; then
echo -e "using anon api call"
else
echo -e "user and oauth token set"
alias curl='curl -u $GITHUB_USER:$GITHUB_OAUTH_TOKEN '
alias curl='curl -u ${GITHUB_USER}:${GITHUB_OAUTH_TOKEN} '
fi
## get release info and download links
LATEST_JSON=$(curl --silent "https://api.github.com/repos/$GITHUB_PACKAGE/releases/latest")
RELEASES=$(curl --silent "https://api.github.com/repos/$GITHUB_PACKAGE/releases")
LATEST_JSON=$(curl --silent "https://api.github.com/repos/${GITHUB_PACKAGE}/releases/latest")
RELEASES=$(curl --silent "https://api.github.com/repos/${GITHUB_PACKAGE}/releases")
if [ -z "$VERSION" ] || [ "$VERSION" == "latest" ]; then
DOWNLOAD_LINK=$(echo $LATEST_JSON | jq .assets | jq -r .[].browser_download_url | grep -i ${MATCH})
if [ -z "${VERSION}" ] || [ "${VERSION}" == "latest" ]; then
DOWNLOAD_LINK=$(echo ${LATEST_JSON} | jq .assets | jq -r .[].browser_download_url | grep -i ${MATCH})
else
VERSION_CHECK=$(echo $RELEASES | jq -r --arg VERSION "$VERSION" '.[] | select(.tag_name==$VERSION) | .tag_name')
if [ "$VERSION" == "$VERSION_CHECK" ]; then
DOWNLOAD_LINK=$(echo $RELEASES | jq -r --arg VERSION "$VERSION" '.[] | select(.tag_name==$VERSION) | .assets[].browser_download_url' | grep -i ${MATCH})
VERSION_CHECK=$(echo ${RELEASES} | jq -r --arg VERSION "${VERSION}" '.[] | select(.tag_name==$VERSION) | .tag_name')
if [ "${VERSION}" == "${VERSION_CHECK}" ]; then
DOWNLOAD_LINK=$(echo ${RELEASES} | jq -r --arg VERSION "${VERSION}" '.[] | select(.tag_name==$VERSION) | .assets[].browser_download_url' | grep -i ${MATCH})
else
echo -e "defaulting to latest release"
DOWNLOAD_LINK=$(echo $LATEST_JSON | jq .assets | jq -r .[].browser_download_url)
DOWNLOAD_LINK=$(echo ${LATEST_JSON} | jq .assets | jq -r .[].browser_download_url)
fi
fi

View File

@ -2,7 +2,7 @@
# steamcmd Base Installation Script
#
# Server Files: /mnt/server
# Image to install with is 'ubuntu:18.04'
# Image to install with is 'debian:buster-slim'
apt -y update
apt -y --no-install-recommends install curl lib32gcc1 ca-certificates