From 6d1a39e003236b1d06cab60339ce12b39fe1297a Mon Sep 17 00:00:00 2001 From: Paz Date: Sat, 23 Jan 2021 13:42:33 +0800 Subject: [PATCH 1/5] Update egg-alt--v.json --- gta/altv/egg-alt--v.json | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/gta/altv/egg-alt--v.json b/gta/altv/egg-alt--v.json index d305748c..a00d491f 100644 --- a/gta/altv/egg-alt--v.json +++ b/gta/altv/egg-alt--v.json @@ -1,23 +1,28 @@ { "_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO", "meta": { - "version": "PTDL_v1" + "version": "PTDL_v1", + "update_url": null }, - "exported_at": "2020-10-16T12:30:37+00:00", + "exported_at": "2021-01-23T05:41:04+00:00", "name": "alt:V", "author": "parker@parkervcp.com", "description": "alt:V Multiplayer a third-party multiplayer modification for Grand Theft Auto: V", - "image": "quay.io\/parkervcp\/pterodactyl-images:debian_dotnet", - "startup": "sleep 2 && .\/altv-server", + "features": null, + "images": [ + "quay.io\/paz\/game_altv:game_altv" + ], + "file_denylist": "", + "startup": ".\/update.sh && chmod +x .\/altv-server && .\/altv-server", "config": { - "files": "{\r\n \"server.cfg\": {\r\n \"parser\": \"file\",\r\n \"find\": {\r\n \"host:\": \"host: 0.0.0.0\",\r\n \"port:\": \"port: {{server.build.default.port}}\",\r\n \"password:\": \"password: {{server.build.env.PASSWORD}}\",\r\n \"description:\": \"description: {{server.build.env.SERVER_DESC}}\"\r\n }\r\n }\r\n}", + "files": "{\r\n \"server.cfg\": {\r\n \"parser\": \"file\",\r\n \"find\": {\r\n \"host:\": \"host: 0.0.0.0\",\r\n \"port:\": \"port: {{server.build.default.port}}\",\r\n \"password:\": \"password: {{server.build.env.PASSWORD}}\",\r\n \"description:\": \"description: {{server.build.env.SERVER_DESC}}\"\r\n }\r\n },\r\n \"update.cfg\": {\r\n \"parser\": \"file\",\r\n \"find\": {\r\n \"branch:\": \"branch: {{server.build.env.BUILD}}\"\r\n }\r\n }\r\n}", "startup": "{\r\n \"done\": \"Server started\"\r\n}", "logs": "{}", "stop": "^C" }, "scripts": { "installation": { - "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\"js-module\/${BUILD}\/x64_linux\/\",\"update.json\",\"modules\/js-module\/libnode.so.72\",\"libnode.so.72\",\/mnt\/server\/ \\\r\n\"js-module\/${BUILD}\/x64_linux\/\",\"update.json\",\"modules\/js-module\/libjs-module.so\",\"libjs-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]}\" \"${array[2]}\"; then\r\n echo -e \"file up to date\"\r\n else\r\n echo -e \"downloading most recent file\"\r\n fi\r\n ## make the directory if it doesn't exist.\r\n if [ ! -d ${array[4]} ]; then\r\n mkdir ${array[4]}\r\n fi\r\n download_files \"${BASE_URL}${array[0]}${array[2]}\" \"${array[4]}${array[3]}\"\r\n else\r\n ## make the directory if it doesn't exist.\r\n if [ ! -d ${array[4]} ]; then\r\n mkdir ${array[4]}\r\n fi\r\n download_files \"${BASE_URL}${array[0]}${array[2]}\" \"${array[4]}${array[3]}\"\r\n fi\r\n\r\n ## run extra commands if needed.\r\n case ${array[5]} in\r\n unzip)\r\n cd ${array[4]}\r\n unzip -o ${array[3]}\r\n rm ${array[3]}\r\n ;;\r\n execute)\r\n chmod +x ${array[4]}${array[3]}\r\n ;;\r\n esac\r\n\r\n# echo -e \"HashFile: ${BASE_URL}${array[0]}${array[1]}\"\r\n# echo -e \"Download URL ${BASE_URL}${array[0]}${array[2]}\"\r\n# echo -e \"Filename ${array[3]}\"\r\n# echo -e \"File Folder ${array[4]}\"\r\n# echo -e \"commands to run ${array[5]}\"\r\n# echo -e\r\ndone\r\n\r\necho -e \"install complete\"", + "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\napt update && apt install -y libatomic1 zip unzip jq curl wget libc-bin && cd \/mnt\/server && wget -O 'update.sh' 'https:\/\/raw.githubusercontent.com\/Lhoerion\/altv-serverupdater\/master\/update.sh' && chmod +x .\/update.sh && .\/update.sh && chmod +x .\/altv-server\r\necho -e \"install complete\"", "container": "debian:buster-slim", "entrypoint": "bash" } @@ -25,7 +30,7 @@ "variables": [ { "name": "ld lib path", - "description": "Needed to load modules correctly.", + "description": "Needed to load modules correctly. Best left at default.", "env_variable": "LD_LIBRARY_PATH", "default_value": ".", "user_viewable": false, @@ -33,8 +38,8 @@ "rules": "required|string|max:20" }, { - "name": "Which alt:V build to download", - "description": "The supported versions are release, rc, dev (default: release).\r\n\r\nIf you don't know what you are doing leave it on stable", + "name": "Release Branch", + "description": "The supported versions are release, rc, dev (default: release).\r\nIf you don't know what you are doing leave it on release", "env_variable": "BUILD", "default_value": "release", "user_viewable": true, @@ -60,4 +65,4 @@ "rules": "required|string" } ] -} \ No newline at end of file +} From 45ad54c0800f8056c9be932cdb8539266dd61aed Mon Sep 17 00:00:00 2001 From: Paz Date: Sat, 23 Jan 2021 13:48:33 +0800 Subject: [PATCH 2/5] Update egg-alt--v.json --- gta/altv/egg-alt--v.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gta/altv/egg-alt--v.json b/gta/altv/egg-alt--v.json index a00d491f..30350bb1 100644 --- a/gta/altv/egg-alt--v.json +++ b/gta/altv/egg-alt--v.json @@ -4,7 +4,7 @@ "version": "PTDL_v1", "update_url": null }, - "exported_at": "2021-01-23T05:41:04+00:00", + "exported_at": "2021-01-23T05:46:56+00:00", "name": "alt:V", "author": "parker@parkervcp.com", "description": "alt:V Multiplayer a third-party multiplayer modification for Grand Theft Auto: V", @@ -15,7 +15,7 @@ "file_denylist": "", "startup": ".\/update.sh && chmod +x .\/altv-server && .\/altv-server", "config": { - "files": "{\r\n \"server.cfg\": {\r\n \"parser\": \"file\",\r\n \"find\": {\r\n \"host:\": \"host: 0.0.0.0\",\r\n \"port:\": \"port: {{server.build.default.port}}\",\r\n \"password:\": \"password: {{server.build.env.PASSWORD}}\",\r\n \"description:\": \"description: {{server.build.env.SERVER_DESC}}\"\r\n }\r\n },\r\n \"update.cfg\": {\r\n \"parser\": \"file\",\r\n \"find\": {\r\n \"branch:\": \"branch: {{server.build.env.BUILD}}\"\r\n }\r\n }\r\n}", + "files": "{\r\n \"server.cfg\": {\r\n \"parser\": \"file\",\r\n \"find\": {\r\n \"host:\": \"host: 0.0.0.0\",\r\n \"port:\": \"port: {{server.build.default.port}}\",\r\n \"password:\": \"password: {{server.build.env.PASSWORD}}\",\r\n \"description:\": \"description: {{server.build.env.SERVER_DESC}}\"\r\n }\r\n },\r\n \"update.cfg\": {\r\n \"parser\": \"json\",\r\n \"find\": {\r\n \"branch\": \"{{server.build.env.BUILD}}\"\r\n }\r\n }\r\n}", "startup": "{\r\n \"done\": \"Server started\"\r\n}", "logs": "{}", "stop": "^C" From d21c80a5804e1b8e96da2553a1c8a297752162e0 Mon Sep 17 00:00:00 2001 From: Paz Date: Thu, 28 Jan 2021 19:44:34 +0800 Subject: [PATCH 3/5] Switch to parkervcp image --- gta/altv/egg-alt--v.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gta/altv/egg-alt--v.json b/gta/altv/egg-alt--v.json index 30350bb1..ac0b8162 100644 --- a/gta/altv/egg-alt--v.json +++ b/gta/altv/egg-alt--v.json @@ -4,13 +4,13 @@ "version": "PTDL_v1", "update_url": null }, - "exported_at": "2021-01-23T05:46:56+00:00", + "exported_at": "2021-01-28T05:46:56+00:00", "name": "alt:V", "author": "parker@parkervcp.com", "description": "alt:V Multiplayer a third-party multiplayer modification for Grand Theft Auto: V", "features": null, "images": [ - "quay.io\/paz\/game_altv:game_altv" + "quay.io\/parkervcp\/pterodactyl-images:game_altv" ], "file_denylist": "", "startup": ".\/update.sh && chmod +x .\/altv-server && .\/altv-server", From aaf6e70c8675cde986a4ef281f65dfa259105b8f Mon Sep 17 00:00:00 2001 From: Paz Date: Sun, 31 Jan 2021 21:28:18 +0800 Subject: [PATCH 4/5] Don't pull script from github --- gta/altv/egg-alt--v.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gta/altv/egg-alt--v.json b/gta/altv/egg-alt--v.json index ac0b8162..67671af1 100644 --- a/gta/altv/egg-alt--v.json +++ b/gta/altv/egg-alt--v.json @@ -4,7 +4,7 @@ "version": "PTDL_v1", "update_url": null }, - "exported_at": "2021-01-28T05:46:56+00:00", + "exported_at": "2021-01-31T13:27:52+00:00", "name": "alt:V", "author": "parker@parkervcp.com", "description": "alt:V Multiplayer a third-party multiplayer modification for Grand Theft Auto: V", @@ -22,7 +22,7 @@ }, "scripts": { "installation": { - "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\napt update && apt install -y libatomic1 zip unzip jq curl wget libc-bin && cd \/mnt\/server && wget -O 'update.sh' 'https:\/\/raw.githubusercontent.com\/Lhoerion\/altv-serverupdater\/master\/update.sh' && chmod +x .\/update.sh && .\/update.sh && chmod +x .\/altv-server\r\necho -e \"install complete\"", + "script": "#!\/bin\/bash\r\n#\r\n# Script Name: update.sh\r\n#\r\n# Author: Lhoerion\r\n#\r\n# Description: The following script compares SHA-1 hashes of remote and local alt:V files. If local file is missing or outdated, script automatically downloads it to script directory.\r\n# Old files are preserved as *.old. Script also keep track of current branch and build. Server start script gets created if missing.\r\n#\r\n# Run Information: This script is run manually.\r\n# Dependencies: coreutils, wget, >=jq_1.4, pcregrep\r\n#\r\n\r\napt update\r\napt install -y libatomic1 zip unzip jq curl wget libc-bin\r\ncd \/mnt\/server\r\n\r\nnoBackup=false\r\nnoLogFile=false\r\ndryRun=false\r\nsilent=false\r\nfor arg in \"$@\"\r\ndo\r\n if [ $arg = '--no-logfile' ]; then\r\n noLogFile=true\r\n elif [ $arg = '--no-backup' ]; then\r\n noBackup=true\r\n elif [ $arg = '--dry-run' ]; then\r\n dryRun=true\r\n elif [ $arg = '--silent' ]; then\r\n silent=true\r\n fi\r\ndone\r\nfiles=()\r\nprintAndLog() {\r\n if [[ \"$silent\" == false ]]; then\r\n outFd=1\r\n else\r\n exec {outFd}>\/dev\/null\r\n fi\r\n if [ \"$2\" = 'ERR' ]; then\r\n printf \"\\e[91m[$(date +%T)][Error] $1\\e[39m\" |& ([ $noLogFile != true ] && tee -a 'update.log' >& $outFd || cat)\r\n elif [ \"$2\" = 'WARN' ]; then\r\n printf \"\\e[93m[$(date +%T)][Warning] $1\\e[39m\" |& ([ $noLogFile != true ] && tee -a 'update.log' >& $outFd || cat)\r\n elif [ \"$2\" = 'APP' ]; then\r\n printf \"$1\" |& ([ $noLogFile != true ] && tee -a 'update.log' >& $outFd || cat)\r\n else\r\n printf \"[$(date +%T)] $1\" |& ([ $noLogFile != true ] && tee -a 'update.log' >& $outFd || cat)\r\n fi\r\n}\r\nsemVerCmp() {\r\n declare -r \"semVerRegex=^(0|[1-9]\\d*)(?:\\.(0|[1-9]\\d*))?\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$\"\r\n local matchA=(${1##v})\r\n local matchB=(${2##v})\r\n for i in {1..5}\r\n do\r\n matchA+=(`echo ${1##v} | pcregrep \"-o$i\" $semVerRegex`)\r\n matchB+=(`echo ${2##v} | pcregrep \"-o$i\" $semVerRegex`)\r\n done\r\n if [ ${1##v} == ${2##v} ]; then\r\n echo 0 && return 0\r\n fi\r\n if [ \\( -z $matchA[4] \\) -a \\( ! -z $matchB[4] \\) ]; then\r\n echo 1 && return 0\r\n elif [ \\( ! -z $matchA[4] \\) -a \\( -z $matchB[4] \\) ]; then\r\n echo -1 && return 0\r\n fi\r\n local i=0\r\n for a in ${matchA[@]}\r\n do\r\n local b=\"${matchB[$i]}\"\r\n if [ \\( $i -eq 2 \\) -a \\( \\( -z $a \\) -o \\( -z $b \\) \\) ]; then\r\n continue\r\n fi\r\n if [[ $a > $b ]]; then\r\n echo 1 && return 0\r\n elif [[ $a < $b ]]; then\r\n echo -1 && return 0\r\n fi\r\n i=$((i + 1))\r\n done\r\n echo 0 && return 0\r\n}\r\nfetchUpdateData() {\r\n updateData=$(curl -s \"https:\/\/cdn.altv.mp\/server\/$localBranch\/x64_linux\/update.json\" -A 'AltPublicAgent')\r\n echo $updateData | jq -e '.' >\/dev\/null 2>&1\r\n if [ $? -ne 0 ]; then\r\n printAndLog \"Failed to check for update, try again later\\n\" 'ERR'\r\n exit 1\r\n fi\r\n str='. | to_entries | map(if .key==\"hashList\" then {\"key\":.key} + {\"value\":(.value | to_entries | map(. + {\"value\":[.value, \"%s\"]}) | from_entries)} else . end) | from_entries'\r\n local updateTmp=($(mktemp '\/tmp\/update.sh.XXX'))\r\n echo '{}' > ${updateTmp[0]}\r\n echo $updateData | jq -c \"$(printf \"$str\" 'server')\" > ${updateTmp[0]}\r\n for (( i=0; i < ${#modules[@]}; i++ ))\r\n do\r\n if [[ \"${modules[$i]}\" == 'csharp-module' ]]; then\r\n modules[$i]='coreclr-module'\r\n fi\r\n local moduleName=${modules[$i]}\r\n updateData=$(curl -s \"https:\/\/cdn.altv.mp\/$moduleName\/$localBranch\/x64_linux\/update.json\" -A 'AltPublicAgent')\r\n echo $updateData | jq -e '.' >\/dev\/null 2>&1\r\n if [ $? -ne 0 ]; then\r\n printAndLog \"Failed to check for $moduleName update\\n\" 'WARN'\r\n else\r\n if [[ \"$moduleName\" == 'csharp-module' ]]; then\r\n if [[ $(echo $updateData | jq -c '.hashList | has(\"AltV.Net.Host.dll\")') == false ]]; then\r\n updateData=$(echo $updateData | jq '.hashList |= . + {\"AltV.Net.Host.dll\":\"'$(printf \"%0.s0\" {1..40})'\"}')\r\n updateData=$(echo $updateData | jq '.hashList |= . + {\"AltV.Net.Host.runtimeconfig.json\":\"'$(printf \"%0.s0\" {1..40})'\"}')\r\n fi\r\n if [[ $(echo $updateData | jq -c '.hashList | has(\"modules\/libcsharp-module.so\")') == false ]]; then\r\n updateData=$(echo $updateData | jq '.hashList |= . + {\"modules\/libcsharp-module.so\":\"'$(printf \"%0.s0\" {1..40})'\"}')\r\n fi\r\n fi\r\n updateTmp+=($(mktemp '\/tmp\/update.sh.XXX'))\r\n echo '{}' > \"${updateTmp[${#updateTmp[@]} - 1]}\"\r\n echo $updateData | jq -c \"$(printf \"$str\" \"$moduleName\")\" > \"${updateTmp[${#updateTmp[@]} - 1]}\"\r\n fi\r\n done\r\n updateData=$(jq -s '.[0].latestBuildNumber as $b | .[0].version as $c | reduce .[] as $x ({}; . * $x) | .latestBuildNumber=$b | .version=$c' ${updateTmp[@]})\r\n remoteBuild=\"$(echo \"$updateData\" | jq -r '.latestBuildNumber')\"\r\n [[ $remoteBuild -eq -1 ]] && remoteBuild=$(echo \"$updateData\" | jq -r '.version')\r\n}\r\nvalidateFiles() {\r\n files=()\r\n for file in $(echo $updateData | jq -r '.hashList | keys[]')\r\n do\r\n if [[ ! -e \"$file\" || $(sha1sum \"$file\" | awk '{print $1}') != \"$(echo \"$updateData\" | jq -r \".hashList.\\\"$file\\\"[0]\")\" ]]; then\r\n files+=(\"$file\")\r\n fi\r\n done\r\n if [ ! -e 'server.cfg' ]; then\r\n printAndLog \"Server file server.cfg not found, creating one . . . \"\r\n if [[ \"$dryRun\" == false ]]; then\r\n printf 'name: \"alt:V Server\"\\nhost: 0.0.0.0\\nport: 7788\\nplayers: 128\\n#password: ultra-password\\nannounce: false\\n#token: YOUR_TOKEN\\ngamemode: Freeroam\\nwebsite: example.com\\nlanguage: en\\ndescription: \"alt:V Sample Server\"\\nmodules: [\\n \\n]\\nresources: [\\n \\n]\\n' > 'server.cfg' && printAndLog 'done\\n' 'APP' || printAndLog 'failed\\n' 'APP'\r\n else\r\n printAndLog 'done\\n' 'APP'\r\n fi\r\n fi\r\n if [[ ! $localBuild =~ ^[0-9]+$ || $localBuild -ge 1232 ]]; then\r\n local nodeExist=$([ -e 'libnode.so.72' ] && echo true || echo false)\r\n local moduleExist=$([ -e 'modules\/libnode-module.so' ] && echo true || echo false)\r\n if [[ \"$nodeExist\" == true || \"$moduleExist\" == true ]]; then\r\n printAndLog \"Found old node-module files, removing . . . \"\r\n if [[ \"$dryRun\" == false ]]; then\r\n local result1=true\r\n local result2=true\r\n if [[ \"$nodeExist\" == true ]]; then\r\n rm -f 'libnode.so.72'\r\n result1=$([[ \"$?\" -eq 0 ]] && echo true || echo false)\r\n fi\r\n if [[ \"$moduleExist\" == true ]]; then\r\n rm -f 'modules\/libnode-module.so'\r\n result2=$([[ \"$?\" -eq 0 ]] && echo true || echo false)\r\n fi\r\n if [[ \"$result1\" == true && \"$result2\" == true ]]; then\r\n printAndLog 'done\\n' 'APP'\r\n else\r\n printAndLog 'failed\\n' 'APP'\r\n fi\r\n else\r\n printAndLog 'done\\n' 'APP'\r\n fi\r\n fi\r\n fi\r\n if [ $localBuild != $remoteBuild ]; then\r\n printAndLog \"Server files update is available\\n\"\r\n elif [ \"${#files[@]}\" -ne 0 ]; then\r\n printAndLog \"Server files are invalidated\/corrupted, ${#files[@]} in total\\n\"\r\n else\r\n printAndLog \"Server files are up-to-date, no action required\\n\"\r\n fi\r\n\r\n if [[ \"$dryRun\" == false ]]; then\r\n localBuild=$remoteBuild\r\n modulesTemp=\"\"\r\n for (( i=0; i < ${#modules[@]}; i++ ))\r\n do\r\n modulesTemp+=\"\\\"${modules[$i]}\\\"\"\r\n if [ $(($i + 1)) -ne ${#modules[@]} ]; then\r\n modulesTemp+=','\r\n fi\r\n done\r\n if [[ $localBuild =~ ^[0-9]+$ ]]; then\r\n printf '{\"branch\":\"%s\",\"build\":%d,\"modules\":[%s]}' $localBranch $localBuild $modulesTemp | jq '.' > 'update.cfg'\r\n else\r\n printf '{\"branch\":\"%s\",\"build\":\"%s\",\"modules\":[%s]}' $localBranch $localBuild $modulesTemp | jq '.' > 'update.cfg'\r\n fi\r\n fi\r\n }\r\n downloadFiles() {\r\n if [ \"${#files[@]}\" -eq 0 ]; then\r\n return\r\n fi\r\n for file in ${files[@]}\r\n do\r\n dlType=\"$(echo \"$updateData\" | jq -r \".hashList.\\\"$file\\\"[1]\")\"\r\n outDir=\"$(dirname $file)\"\r\n printAndLog \"Downloading file $file . . . \"\r\n if [[ \"$dryRun\" == false ]]; then\r\n if [[ \"$noBackup\" == false && -e \"$file\" ]]; then\r\n mv \"$file\" \"$file.old\"\r\n fi\r\n if [[ ! -e \"$outDir\/\" ]]; then\r\n mkdir -p \"$outDir\/\"\r\n fi\r\n wget \"https:\/\/cdn.altv.mp\/$dlType\/$localBranch\/x64_linux\/${file}?build=$localBuild\" -U 'AltPublicAgent' -O \"$file\" -N -q && printAndLog 'done\\n' 'APP' || printAndLog 'failed\\n' 'APP'\r\n if [ ! -e \"$file\" ]; then\r\n continue\r\n fi\r\n if [ -e \"$file.old\" ]; then\r\n chmod --reference=\"$file.old\" \"$file\" || printAndLog \"Failed to copy chmod to file $file\\n\" 'ERR'\r\n chmod -x \"$file.old\" || printAndLog \"Failed to remove execution permissions from file $file.old\\n\" 'ERR'\r\n else\r\n chmod +x \"$file\" || printAndLog \"Failed to add execution permissions to file $file\\n\" 'ERR'\r\n fi\r\n else\r\n printAndLog 'done\\n' 'APP'\r\n fi\r\n done\r\n validateFiles\r\n }\r\n\r\n if [ $noLogFile != true ]; then\r\n truncate -s 0 'update.log'\r\n fi\r\n if [[ ( \"$dryRun\" == false ) && ( ! -e 'update.cfg' ) ]]; then\r\n printf '{\"branch\":\"release\",\"modules\":[\"js-module\"]}' | jq '.' > 'update.cfg'\r\n fi\r\n updateCfg=$([[ -e 'update.cfg' ]] && cat 'update.cfg' || printf '{\"branch\":\"release\",\"modules\":[\"js-module\"]}' | jq '.')\r\n localBranch=$(echo \"$updateCfg\" | jq -r '.branch')\r\n [[ ! -n \"$localBranch\" || \"$localBranch\" != 'release' && \"$localBranch\" != 'rc' && \"$localBranch\" != 'dev' ]] && localBranch='release'\r\n modules=($(echo \"$updateCfg\" | jq -r '.modules \/\/ \"\"' | tr -d '[],\"'))\r\n [[ ! -n \"$modules\" ]] && modules=('js-module')\r\n fetchUpdateData\r\n localBuild=\"$(echo \"$updateCfg\" | jq -r 'if .build == null then empty else .build end')\"\r\n [[ -z $localBuild || $localBuild == \"-1\" ]] && localBuild=$remoteBuild\r\n printAndLog \"Current version: $localBuild\\n\"\r\n printAndLog \"Latest version: $remoteBuild\\n\"\r\n validateFiles\r\n downloadFiles\r\nchmod +x .\/altv-server\r\necho -e \"install complete\"", "container": "debian:buster-slim", "entrypoint": "bash" } From f074970215c2ecfe65699aef484606c16252adcb Mon Sep 17 00:00:00 2001 From: Paz Date: Sun, 31 Jan 2021 21:33:22 +0800 Subject: [PATCH 5/5] Update egg-alt--v.json --- gta/altv/egg-alt--v.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gta/altv/egg-alt--v.json b/gta/altv/egg-alt--v.json index 67671af1..cd2acfca 100644 --- a/gta/altv/egg-alt--v.json +++ b/gta/altv/egg-alt--v.json @@ -13,7 +13,7 @@ "quay.io\/parkervcp\/pterodactyl-images:game_altv" ], "file_denylist": "", - "startup": ".\/update.sh && chmod +x .\/altv-server && .\/altv-server", + "startup": "chmod +x .\/altv-server && .\/altv-server", "config": { "files": "{\r\n \"server.cfg\": {\r\n \"parser\": \"file\",\r\n \"find\": {\r\n \"host:\": \"host: 0.0.0.0\",\r\n \"port:\": \"port: {{server.build.default.port}}\",\r\n \"password:\": \"password: {{server.build.env.PASSWORD}}\",\r\n \"description:\": \"description: {{server.build.env.SERVER_DESC}}\"\r\n }\r\n },\r\n \"update.cfg\": {\r\n \"parser\": \"json\",\r\n \"find\": {\r\n \"branch\": \"{{server.build.env.BUILD}}\"\r\n }\r\n }\r\n}", "startup": "{\r\n \"done\": \"Server started\"\r\n}",