"script":"#!\/bin\/bash\r\n# AltV Install Script\r\n#\r\n# Server Files: \/mnt\/server\r\n# BUILD=stable ## this should be an egg variable.\r\nBASE_URL=\"https:\/\/cdn.altv.mp\/\" ## Where the files are stored.\r\n\r\n## install required dependancies.\r\nfunction install_deps () {\r\n apt update\r\n apt install -y libatomic1 zip unzip jq curl wget\r\n echo -e \"deps installed\"\r\n echo -e\r\n}\r\n\r\n## check the has on files and compare to a remote source.\r\n## usage 'check_hash \"file\" \"remote_hash_source\"'\r\nfunction check_hash () {\r\n echo -e \"Checking for file ${1}\"\r\n echo -e \"running: curl -sSL ${2} | jq -r --arg FILENAME \\\"${3}\\\" '.hashList | .[\\$FILENAME]'\"\r\n hash=$(curl -sSL ${2} | jq -r --arg FILENAME ${3} '.hashList | .[$FILENAME]')\r\n echo -e \"hash: $hash\"\r\n\r\n if [ -f ${2} ]; then\r\n\r\n echo -e \"hash is $(sha1sum ${1} | awk '{ print $1 }')\"\r\n echo -e \"current has is ${hash}\"\r\n\r\n if [ \"$(sha1sum ${2} | awk '{ print $1 }')\" == \"${hash}\" ]; then\r\n echo -e \"Hash matched\"\r\n echo -e \"No need to download new file.\"\r\n return 0\r\n else\r\n echo -e \"Hash didn't match\"\r\n echo -e \"Need to download the correct version\"\r\n return 1\r\n fi\r\n else\r\n echo \"No file found\"\r\n return 1\r\n fi\r\n}\r\n\r\n## makes sure a download link is valid.\r\nfunction validate_download () {\r\n DOWNLOAD_URL=${1}\r\n\r\n echo -e \"Download url is ${DOWNLOAD_URL}\"\r\n\r\n if [ ! -z \"${DOWNLOAD_URL}\" ]; then \r\n if curl --output \/dev\/null --silent --head --fail ${DOWNLOAD_URL}; then\r\n echo -e \"link is valid. setting download link to ${DOWNLOAD_URL}\"\r\n DOWNLOAD_LINK=${DOWNLOAD_URL}\r\n else \r\n echo -e \"link is invalid closing out\"\r\n exit 2\r\n fi\r\n fi\r\n\r\n}\r\n\r\nfunction download_files () {\r\n ## validate download link and get files\r\n validate_download ${1}\r\n echo -e \"running wget ${DOWNLOAD_URL} -O ${2}\"\r\n wget ${DOWNLOAD_URL} -O ${2}\r\n}\r\n\r\n## This is a file array for files to get downloaded.\r\n## They are all comma separated lists.\r\n## remote folder (0), json file with hashes (1), file name in json file (2), file name (3), file folder (4), extra commands (5)\r\nfile_array=( \\\r\n\"server\/${BUILD}\/x64_linux\/\",\"update.json\",\"altv-server\",\"altv-server\",\/mnt\/server\/,execute \\\r\n\"server\/${BUILD}\/x64_linux\/\",\"update.json\",\"data\/vehmodels.bin\",\"vehmodels.bin\",\/mnt\/server\/data\/ \\\r\n\"server\/${BUILD}\/x64_linux\/\",\"update.json\",\"data\/vehmods.bin\",\"vehmods.bin\",\/mnt\/server\/data\/ \\\r\n\"others\/\",,\"server.cfg\",server.cfg,\/mnt\/server\/ \\\r\n\"node-module\/${BUILD}\/x64_linux\/\",\"update.json\",\"libnode.so.72\",\"libnode.so.72\",\/mnt\/server\/ \\\r\n\"node-module\/${BUILD}\/x64_linux\/\",\"update.json\",\"modules\/libnode-module.so\",\"libnode-module.so\",\/mnt\/server\/modules\/ \\\r\n\"coreclr-module\/${BUILD}\/x64_linux\/\",,\"AltV.Net.Host.dll\",\"AltV.Net.Host.dll\",\/mnt\/server\/ \\\r\n\"coreclr-module\/${BUILD}\/x64_linux\/\",,\"AltV.Net.Host.runtimeconfig.json\",\"AltV.Net.Host.runtimeconfig.json\",\/mnt\/server\/ \\\r\n\"coreclr-module\/stable\/x64_linux\/\",\"update.json\",\"modules\/libcsharp-module.so\",\"libcsharp-module.so\",\/mnt\/server\/modules\/ \\\r\n\"samples\/\",,\"resources.zip\",\"resources.zip\",\/mnt\/server\/,unzip \\\r\n)\r\n\r\ninstall_deps\r\n\r\n## this goes through each value in the array and then checks the hash\r\nfor EACH in ${file_array[@]}\r\ndo\r\n ## this needs to be here to break apart the arrays.\r\n IFS=',' read -r -a array <<< \"$EACH\"\r\n\r\n if [ ! -z \"${array[1]}\" ]; then\r\n ## check hash on 'folder\/file' with 'remote file base url\/remote folder\/ json file' 'json file name' \r\n if check_hash \"${array[4]}${array[3]}\" \"${BASE_URL}${array[0]}${array[1]}\" \"${arr
"container":"debian:buster-slim",
"entrypoint":"bash"
}
},
"variables":[
{
"name":"ld lib path",
"description":"Needed to load modules correctly.",