From c576673f88a2f2edd28beb10fae1651c0b639041 Mon Sep 17 00:00:00 2001 From: Torsten Widmann Date: Tue, 14 Dec 2021 17:15:45 +0100 Subject: [PATCH] clean sogeBot update process (#1449) Backup database and clean up folders on reinstall to minimize unwanted errors for npm modules --- bots/twitch/sogebot/egg-soge-bot.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bots/twitch/sogebot/egg-soge-bot.json b/bots/twitch/sogebot/egg-soge-bot.json index a80e9212..8a989269 100644 --- a/bots/twitch/sogebot/egg-soge-bot.json +++ b/bots/twitch/sogebot/egg-soge-bot.json @@ -4,7 +4,7 @@ "version": "PTDL_v1", "update_url": null }, - "exported_at": "2021-12-07T12:36:17+00:00", + "exported_at": "2021-12-13T15:19:16+01:00", "name": "SogeBot", "author": "info@goover.de", "description": "sogeBot - Free Twitch Bot built on Node.js https:\/\/sogebot.xyz\/", @@ -22,8 +22,8 @@ }, "scripts": { "installation": { - "script": "#\/bin\/bash\r\napt -y update\r\napt install -y curl unzip sqlite jq wget python3 build-essential\r\nexport NODE_OPTIONS=--max-old-space-size=8192\r\nMATCH=sogeBot\r\ncd \/mnt\/server\r\n\r\nrm -fR dest\r\nrm -fR public\r\n\r\n## get release info and download links\r\nLATEST_JSON=$(curl --silent \"https:\/\/api.github.com\/repos\/sogebot\/sogeBot\/releases\/latest\")\r\nRELEASES=$(curl --silent \"https:\/\/api.github.com\/repos\/sogebot\/sogeBot\/releases\")\r\n\r\nif [ -z \"${VERSION}\" ] || [ \"${VERSION}\" == \"latest\" ]; then\r\n DOWNLOAD_LINK=$(echo ${LATEST_JSON} | jq .assets | jq -r .[].browser_download_url | grep -i ${MATCH})\r\nelse\r\n VERSION_CHECK=$(echo ${RELEASES} | jq -r --arg VERSION \"${VERSION}\" '.[] | select(.tag_name==$VERSION) | .tag_name')\r\n if [ \"${VERSION}\" == \"${VERSION_CHECK}\" ]; then\r\n DOWNLOAD_LINK=$(echo ${RELEASES} | jq -r --arg VERSION \"${VERSION}\" '.[] | select(.tag_name==$VERSION) | .assets[].browser_download_url' | grep -i ${MATCH})\r\n else\r\n echo -e \"defaulting to latest release\"\r\n DOWNLOAD_LINK=$(echo ${LATEST_JSON} | jq .assets | jq -r .[].browser_download_url)\r\n fi\r\nfi\r\n\r\necho -e \"Downloading from $DOWNLOAD_LINK\"\r\nwget -N $DOWNLOAD_LINK\r\nunzip -o $MATCH-*.zip\r\nrm -fR $MATCH-*.zip\r\n\r\necho \"Installing dependencies, this will take some time so sit back and relax...\"\r\n\/usr\/local\/bin\/npm ci 2>&1 | tee npmlog.txt\r\n\r\necho -e \"install completed\"\r\nexit 0", - "container": "node:16-buster-slim", + "script": "#\/bin\/bash\r\n# Installscript for sogeBot | Author: info@goover.de\r\n\r\nexport DEBIAN_FRONTEND=noninteractive\r\n\r\napt -y update\r\napt install -y curl unzip sqlite3 jq wget python3 build-essential ca-certificates\r\n\r\nexport NODE_OPTIONS=--max-old-space-size=8192\r\nchown -R root:root \/mnt\r\nMATCH=sogeBot\r\ncd \/mnt\/server\r\n\r\n#Backup database & config\r\nmkdir -p .backup\r\ncp -f .env \/mnt\/server\/.backup\r\ncp -f sogebot.db \/mnt\/server\/.backup\r\n\r\n#delete old dir's to prevent errors on update\r\nrm -fR dest\r\nrm -fR public\r\nrm -fR node-modules\r\nrm -fR tools\r\n\r\n## get release info and download links\r\nLATEST_JSON=$(curl --silent \"https:\/\/api.github.com\/repos\/sogebot\/sogeBot\/releases\/latest\")\r\nRELEASES=$(curl --silent \"https:\/\/api.github.com\/repos\/sogebot\/sogeBot\/releases\")\r\n\r\nif [ -z \"${VERSION}\" ] || [ \"${VERSION}\" == \"latest\" ]; then\r\n DOWNLOAD_LINK=$(echo ${LATEST_JSON} | jq .assets | jq -r .[].browser_download_url | grep -i ${MATCH})\r\nelse\r\n VERSION_CHECK=$(echo ${RELEASES} | jq -r --arg VERSION \"${VERSION}\" '.[] | select(.tag_name==$VERSION) | .tag_name')\r\n if [ \"${VERSION}\" == \"${VERSION_CHECK}\" ]; then\r\n DOWNLOAD_LINK=$(echo ${RELEASES} | jq -r --arg VERSION \"${VERSION}\" '.[] | select(.tag_name==$VERSION) | .assets[].browser_download_url' | grep -i ${MATCH})\r\n else\r\n echo -e \"defaulting to latest release\"\r\n DOWNLOAD_LINK=$(echo ${LATEST_JSON} | jq .assets | jq -r .[].browser_download_url)\r\n fi\r\nfi\r\n\r\necho -e \"Downloading from $DOWNLOAD_LINK\"\r\nwget -N $DOWNLOAD_LINK\r\nunzip -o $MATCH-*.zip\r\nrm -fR $MATCH-*.zip\r\n\r\necho \"--------------------------------------------------------------------------\"\r\necho \"Installing dependencies, this will take some time so sit back and relax...\"\r\necho \"IGNORE WARNINGS. THESE ARE NOT ERRORS !!!\"\r\necho \"--------------------------------------------------------------------------\"\r\n\r\nnpm ci 2>&1 | tee npmlog.txt\r\n\r\necho -e \"install completed\"\r\nexit 0", + "container": "node:16-bullseye-slim", "entrypoint": "bash" } }, @@ -38,4 +38,4 @@ "rules": "required|string|max:20" } ] -} +} \ No newline at end of file