mirror of
https://github.com/parkervcp/eggs.git
synced 2024-11-26 16:19:04 +08:00
Merge pull request #397 from parkervcp/update/scripts
update scripts folder
This commit is contained in:
commit
a6de4d39af
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,3 @@
|
||||
*.DS_Store
|
||||
node_modules/
|
||||
.vuepress/
|
||||
.vuepress/*
|
11
scripts/download_link_validator.sh
Normal file
11
scripts/download_link_validator.sh
Normal 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
|
@ -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
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user