add cleanup before extracting the tar

This commit is contained in:
Th3Dilli 2024-01-19 15:32:33 +01:00
parent 12828ffd9b
commit ef353cc7ad
No known key found for this signature in database
GPG Key ID: D400D1952207633C

View File

@ -4,7 +4,7 @@
"version": "PTDL_v2",
"update_url": null
},
"exported_at": "2024-01-19T08:08:55-05:00",
"exported_at": "2024-01-19T09:12:16-05:00",
"name": "Vintage Story",
"author": "mail@wuffy.eu",
"description": "Vintage Story is an uncompromising wilderness survival sandbox game inspired by lovecraftian horror themes. Find yourself in a ruined world reclaimed by nature and permeated by unnerving temporal disturbances. Relive the advent of human civilization, or take your own path.",
@ -22,7 +22,7 @@
},
"scripts": {
"installation": {
"script": "#!\/bin\/bash\r\n# Vintage Story Installation Script\r\n#\r\n# Server Files: \/mnt\/server\r\napt update\r\napt -y install curl jq\r\n\r\ndeclare -A API_URLS=(\r\n [\"stable\"]=\"http:\/\/api.vintagestory.at\/stable.json\"\r\n [\"unstable\"]=\"http:\/\/api.vintagestory.at\/unstable.json\"\r\n [\"pre\"]=\"http:\/\/api.vintagestory.at\/pre.json\"\r\n)\r\n\r\ndeclare -A DOWNLOAD_URLS=(\r\n [\"stable\"]=\"https:\/\/cdn.vintagestory.at\/gamefiles\/stable\/vs_server_linux-x64_${RELEASE_VERSION}.tar.gz\"\r\n [\"unstable\"]=\"https:\/\/cdn.vintagestory.at\/gamefiles\/unstable\/vs_server_linux-x64_${RELEASE_VERSION}.tar.gz\"\r\n [\"pre\"]=\"https:\/\/cdn.vintagestory.at\/gamefiles\/pre\/vs_server_linux-x64_${RELEASE_VERSION}.tar.gz\"\r\n)\r\n\r\nBRANCH=\"${FILES_BRANCH}\"\r\n\r\nif [ -z \"${RELEASE_VERSION}\" ] || [ \"${RELEASE_VERSION}\" == \"latest\" ]; then\r\n API_URL=\"${API_URLS[$BRANCH]}\"\r\n DOWNLOAD_URL=$(curl -SsL \"$API_URL\" | jq -r 'if ([.[]] | .[0].linuxserver.urls.cdn) != null then [.[]] | .[0].linuxserver.urls.cdn else [.[]] | .[0].linuxserver.urls.local end')\r\nelse\r\n API_URL=\"${API_URLS[$BRANCH]}\"\r\n DOWNLOAD_URL=\"${DOWNLOAD_URLS[$BRANCH]}\"\r\nfi\r\n\r\necho \"API URL: $API_URL\"\r\necho \"Download URL: $DOWNLOAD_URL\"\r\n\r\ncd \/mnt\/server\/ || exit\r\n\r\ncurl -o vs_server.tar.gz \"${DOWNLOAD_URL}\"\r\ntar -xzf vs_server.tar.gz\r\n\r\nrm vs_server.tar.gz\r\nrm server.sh\r\n\r\necho \"-----------------------------------------\"\r\necho \"Installation completed...\"\r\necho \"-----------------------------------------\"",
"script": "#!\/bin\/bash\r\n# Vintage Story Installation Script\r\n#\r\n# Server Files: \/mnt\/server\r\napt update\r\napt -y install curl jq\r\n\r\ndeclare -A API_URLS=(\r\n [\"stable\"]=\"http:\/\/api.vintagestory.at\/stable.json\"\r\n [\"unstable\"]=\"http:\/\/api.vintagestory.at\/unstable.json\"\r\n [\"pre\"]=\"http:\/\/api.vintagestory.at\/pre.json\"\r\n)\r\n\r\ndeclare -A DOWNLOAD_URLS=(\r\n [\"stable\"]=\"https:\/\/cdn.vintagestory.at\/gamefiles\/stable\/vs_server_linux-x64_${RELEASE_VERSION}.tar.gz\"\r\n [\"unstable\"]=\"https:\/\/cdn.vintagestory.at\/gamefiles\/unstable\/vs_server_linux-x64_${RELEASE_VERSION}.tar.gz\"\r\n [\"pre\"]=\"https:\/\/cdn.vintagestory.at\/gamefiles\/pre\/vs_server_linux-x64_${RELEASE_VERSION}.tar.gz\"\r\n)\r\n\r\nBRANCH=\"${FILES_BRANCH}\"\r\n\r\nif [ -z \"${RELEASE_VERSION}\" ] || [ \"${RELEASE_VERSION}\" == \"latest\" ]; then\r\n API_URL=\"${API_URLS[$BRANCH]}\"\r\n DOWNLOAD_URL=$(curl -SsL \"$API_URL\" | jq -r 'if ([.[]] | .[0].linuxserver.urls.cdn) != null then [.[]] | .[0].linuxserver.urls.cdn else [.[]] | .[0].linuxserver.urls.local end')\r\nelse\r\n API_URL=\"${API_URLS[$BRANCH]}\"\r\n DOWNLOAD_URL=\"${DOWNLOAD_URLS[$BRANCH]}\"\r\nfi\r\n\r\necho \"API URL: $API_URL\"\r\necho \"Download URL: $DOWNLOAD_URL\"\r\n\r\ncd \/mnt\/server\/ || exit\r\n\r\n# make sure to cleanup the prior installation else this might cause issue with old asset files that do not exist in the new version\r\nif [ -d \"assets\" ]; then\r\n echo \"Removing old installation files\"\r\n rm -rf assets*\r\n rm -rf Lib*\r\nfi\r\ncurl -o vs_server.tar.gz \"${DOWNLOAD_URL}\"\r\ntar -xzf vs_server.tar.gz\r\n\r\nrm vs_server.tar.gz\r\nrm server.sh\r\n\r\necho \"-----------------------------------------\"\r\necho \"Installation completed...\"\r\necho \"-----------------------------------------\"",
"container": "debian:bullseye-slim",
"entrypoint": "bash"
}