SHA256
first commit
This commit is contained in:
commit
21788ba270
643 files changed
+45536
No files matched your search
@@ -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
|
||||
@@ -0,0 +1,21 @@
|
||||
## only needs to have the file with a file passed into it to get the filetype.
|
||||
## only supports tar.gz/xz and zip currently for unpacking.
|
||||
## The value for ${DOWNLOAD_LINK##*/} is derived from DOWNLOAD_LINK
|
||||
## if the download link is https://launcher.mojang.com/v1/objects/3dc3d84a581f14691199cf6831b71ed1296a9fdf/server.jar then the ##*/ is server.jar
|
||||
|
||||
apt update
|
||||
apt install -y curl file unzip
|
||||
|
||||
curl -sSL ${DOWNLOAD_LINK}
|
||||
|
||||
FILETYPE=$(file -F ',' ${DOWNLOAD_LINK##*/} | cut -d',' -f2 | cut -d' ' -f2)
|
||||
if [ "$FILETYPE" == "gzip" ]; then
|
||||
tar xzvf ${DOWNLOAD_LINK##*/}
|
||||
elif [ "$FILETYPE" == "Zip" ]; then
|
||||
unzip -o ${DOWNLOAD_LINK##*/}
|
||||
elif [ "$FILETYPE" == "XZ" ]; then
|
||||
tar xvf ${DOWNLOAD_LINK##*/}
|
||||
else
|
||||
echo -e "unknown filetype. Exeting"
|
||||
exit 2
|
||||
fi
|
||||
@@ -0,0 +1,55 @@
|
||||
## clone git repos
|
||||
## supports both github and gitlab
|
||||
## supports using a personal access token to run git pull
|
||||
|
||||
apt update
|
||||
apt install -y git curl jq file unzip
|
||||
|
||||
mkdir -p /mnt/server
|
||||
cd /mnt/server
|
||||
|
||||
if [ "${USER_UPLOAD}" == "true" ] || [ "${USER_UPLOAD}" == "1" ]; then
|
||||
echo -e "assuming user knows what they are doing have a good day."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
## add git ending if it's not on the address
|
||||
if [[ ${GIT_ADDRESS} != *.git ]]; then
|
||||
GIT_ADDRESS=${GIT_ADDRESS}.git
|
||||
fi
|
||||
|
||||
if [ -z "${USERNAME}" ] && [ -z "${ACCESS_TOKEN}" ]; then
|
||||
echo -e "using anon api call"
|
||||
else
|
||||
GIT_ADDRESS="https://${USERNAME}:${ACCESS_TOKEN}@$(echo -e ${GIT_ADDRESS} | cut -d/ -f3-)"
|
||||
fi
|
||||
|
||||
## pull git js bot repo
|
||||
if [ "$(ls -A /mnt/server)" ]; then
|
||||
echo -e "/mnt/server directory is not empty."
|
||||
if [ -d .git ]; then
|
||||
echo -e ".git directory exists"
|
||||
if [ -f .git/config ]; then
|
||||
echo -e "loading info from git config"
|
||||
ORIGIN=$(git config --get remote.origin.url)
|
||||
else
|
||||
echo -e "files found with no git config"
|
||||
echo -e "closing out without touching things to not break anything"
|
||||
exit 10
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${ORIGIN}" == "${GIT_ADDRESS}" ]; then
|
||||
echo "pulling latest from github"
|
||||
git pull
|
||||
fi
|
||||
else
|
||||
echo -e "/mnt/server is empty.\ncloning files into repo"
|
||||
if [ -z ${BRANCH} ]; then
|
||||
echo -e "cloning default branch"
|
||||
git clone ${GIT_ADDRESS} .
|
||||
else
|
||||
echo -e "cloning ${BRANCH}'"
|
||||
git clone --single-branch --branch ${BRANCH} ${GIT_ADDRESS} .
|
||||
fi
|
||||
fi
|
||||
@@ -0,0 +1,29 @@
|
||||
## this is a simple script to use the github API for release versions.
|
||||
## this requires the egg has a variable for GITHUB_PACKAGE, VERSION and MATCH (match is to match the filename in some way)
|
||||
## 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.
|
||||
apt update
|
||||
apt install -y curl jq
|
||||
|
||||
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} '
|
||||
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")
|
||||
|
||||
if [ -z "${VERSION}" ] || [ "${VERSION}" == "latest" ]; then
|
||||
DOWNLOAD_URL=$(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_URL=$(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_URL=$(echo ${LATEST_JSON} | jq .assets | jq -r .[].browser_download_url)
|
||||
fi
|
||||
fi
|
||||
@@ -0,0 +1,64 @@
|
||||
#!/bin/bash
|
||||
# steamcmd Base Installation Script
|
||||
#
|
||||
# Server Files: /mnt/server
|
||||
# Image to install with is 'ghcr.io/parkervcp/installers:debian'
|
||||
|
||||
##
|
||||
#
|
||||
# Variables
|
||||
# STEAM_USER, STEAM_PASS, STEAM_AUTH - Steam user setup. If a user has 2fa enabled it will most likely fail due to timeout. Leave blank for anon install.
|
||||
# WINDOWS_INSTALL - if it's a windows server you want to install set to 1
|
||||
# SRCDS_APPID - steam app id found here - https://developer.valvesoftware.com/wiki/Dedicated_Servers_List
|
||||
# SRCDS_BETAID - beta branch of a steam app. Leave blank to install normal branch
|
||||
# SRCDS_BETAPASS - password for a beta branch should one be required during private or closed testing phases.. Leave blank for no password.
|
||||
# INSTALL_FLAGS - Any additional SteamCMD flags to pass during install.. Keep in mind that steamcmd auto update process in the docker image might overwrite or ignore these when it performs update on server boot.
|
||||
# AUTO_UPDATE - Adding this variable to the egg allows disabling or enabling automated updates on boot. Boolean value. 0 to disable and 1 to enable.
|
||||
#
|
||||
##
|
||||
|
||||
# Install packages. Default packages below are not required if using our existing install image thus speeding up the install process.
|
||||
#apt -y update
|
||||
#apt -y --no-install-recommends install curl lib32gcc-s1 ca-certificates
|
||||
|
||||
## just in case someone removed the defaults.
|
||||
if [[ "${STEAM_USER}" == "" ]] || [[ "${STEAM_PASS}" == "" ]]; then
|
||||
echo -e "steam user is not set.\n"
|
||||
echo -e "Using anonymous user.\n"
|
||||
STEAM_USER=anonymous
|
||||
STEAM_PASS=""
|
||||
STEAM_AUTH=""
|
||||
else
|
||||
echo -e "user set to ${STEAM_USER}"
|
||||
fi
|
||||
|
||||
## download and install steamcmd
|
||||
cd /tmp
|
||||
mkdir -p /mnt/server/steamcmd
|
||||
curl -sSL -o steamcmd.tar.gz https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
|
||||
tar -xzvf steamcmd.tar.gz -C /mnt/server/steamcmd
|
||||
mkdir -p /mnt/server/steamapps # Fix steamcmd disk write error when this folder is missing
|
||||
cd /mnt/server/steamcmd
|
||||
|
||||
# SteamCMD fails otherwise for some reason, even running as root.
|
||||
# This is changed at the end of the install process anyways.
|
||||
chown -R root:root /mnt
|
||||
export HOME=/mnt/server
|
||||
|
||||
## install game using steamcmd
|
||||
./steamcmd.sh +force_install_dir /mnt/server +login ${STEAM_USER} ${STEAM_PASS} ${STEAM_AUTH} $( [[ "${WINDOWS_INSTALL}" == "1" ]] && printf %s '+@sSteamCmdForcePlatformType windows' ) +app_update ${SRCDS_APPID} $( [[ -z ${SRCDS_BETAID} ]] || printf %s "-beta ${SRCDS_BETAID}" ) $( [[ -z ${SRCDS_BETAPASS} ]] || printf %s "-betapassword ${SRCDS_BETAPASS}" ) ${INSTALL_FLAGS} validate +quit ## other flags may be needed depending on install. looking at you cs 1.6
|
||||
|
||||
## set up 32 bit libraries
|
||||
mkdir -p /mnt/server/.steam/sdk32
|
||||
cp -v linux32/steamclient.so ../.steam/sdk32/steamclient.so
|
||||
|
||||
## set up 64 bit libraries
|
||||
mkdir -p /mnt/server/.steam/sdk64
|
||||
cp -v linux64/steamclient.so ../.steam/sdk64/steamclient.so
|
||||
|
||||
## add below your custom commands if needed
|
||||
|
||||
## install end
|
||||
echo "-----------------------------------------"
|
||||
echo "Installation completed..."
|
||||
echo "-----------------------------------------"
|
||||
Reference in new issue
Block a user