Updated rebuild.sh

This commit is contained in:
Toastie 2024-06-25 20:46:54 +12:00
parent 06f15908d4
commit bbf30665b9
Signed by: toastie_t0ast
GPG key ID: 27F3B6855AFD40A4

View file

@ -1 +1,56 @@
#!/bin/sh
#!/bin/sh
# Legend:
# (A) - Database related operations
# (B) - Aliases related operations
# (C) - Strings related operations
root=$(pwd)
cd elliebot
# build
export DOTNET_CLI_TELEMETRY_OPTOUT=1
dotnet restore -f --no-cache
dotnet build src/EllieBot/EllieBot.csproj -c Release -o output/
# go back
cd "$root"
# move creds from old to new
mv -f elliebot_old/output/creds.yml elliebot/output/creds.yml 1>/dev/null 2>&1
# also copy credentials.json for migration purposes
mv -f elliebot_old/output/credentials.json elliebot/output/credentials.json 1>/dev/null 2>&1
# on update, strings will be new version, user will have to manually re-add his strings after each update
# as updates may cause big number of strings to become obsolete, changed, etc
# however, old user's strings will be backed up to strings_old
# (C) backup new strings to reverse rewrite
rm -rf elliebot/output/data/strings_new 1>/dev/null 2>&1
mv -fT elliebot/output/data/strings elliebot/output/data/strings_new 1>/dev/null 2>&1
# (C) delete old strings backup
rm -rf elliebot_old/output/data/strings_old 1>/dev/null 2>&1
rm -rf elliebot_old/output/data/strings_new 1>/dev/null 2>&1
# (B) backup new aliases to reverse rewrite
mv -f elliebot/output/data/aliases.yml elliebot/output/data/aliases_new.yml 1>/dev/null 2>&1
# (A) move old database
mv -f elliebot_old/output/data/EllieBot.db elliebot/output/data/EllieBot.db 1>/dev/null 2>&1
# move old data folder contents (and overwrite)
cp -RT elliebot_old/output/data/ elliebot/output/data 1>/dev/null 2>&1
# (B) backup old aliases
mv -f elliebot/output/data/aliases.yml elliebot/output/data/aliases_old.yml 1>/dev/null 2>&1
# (B) restore new aliases
mv -f elliebot/output/data/aliases_new.yml elliebot/output/data/aliases.yml 1>/dev/null 2>&1
# (C) backup old strings
mv -f elliebot/output/data/strings elliebot/output/data/strings_old 1>/dev/null 2>&1
# (C) restore new strings
mv -f elliebot/output/data/strings_new elliebot/output/data/strings 1>/dev/null 2>&1
rm "$root/rebuild.sh"
exit 0