From d56d8dd369dc53c24cfa70e030d830fab178c683 Mon Sep 17 00:00:00 2001 From: Jesper Dramsch Date: Thu, 9 Jan 2025 15:53:47 +0100 Subject: [PATCH] Fix: AdventureLog - update script bug (#1334) * refactor: move installation for backup and maintain media and env files * fix: return to working directory * Workdir Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> * Workdir Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> * Avoid Workdir Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> * Avoid Workdir Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> * Remove old installation (at request of @michelroegl-brunner) Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> * rm newline * rm last version --------- Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> --- ct/adventurelog.sh | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/ct/adventurelog.sh b/ct/adventurelog.sh index 5c168ce4..a9c80542 100644 --- a/ct/adventurelog.sh +++ b/ct/adventurelog.sh @@ -40,19 +40,20 @@ function update_script() { msg_ok "Services Stopped" msg_info "Updating ${APP} to ${RELEASE}" - cp /opt/adventurelog/backend/server/.env /opt/server.env - cp /opt/adventurelog/frontend/.env /opt/frontend.env - wget -q "https://github.com/seanmorley15/AdventureLog/archive/refs/tags/v${RELEASE}.zip" - unzip -q v${RELEASE}.zip - mv AdventureLog-${RELEASE} /opt/adventurelog - mv /opt/server.env /opt/adventurelog/backend/server/.env + mv /opt/adventurelog/ /opt/adventurelog-backup/ + wget -qO /opt/v${RELEASE}.zip "https://github.com/seanmorley15/AdventureLog/archive/refs/tags/v${RELEASE}.zip" + unzip -q /opt/v${RELEASE}.zip + mv /opt/AdventureLog-${RELEASE} /opt/adventurelog + + mv /opt/adventurelog-backup/backend/server/.env /opt/adventurelog/backend/server/.env + mv /opt/adventurelog-backup/backend/server/media /opt/adventurelog/backend/server/media cd /opt/adventurelog/backend/server pip install --upgrade pip &>/dev/null pip install -r requirements.txt &>/dev/null python3 manage.py collectstatic --noinput &>/dev/null python3 manage.py migrate &>/dev/null - mv /opt/frontend.env /opt/adventurelog/frontend/.env + mv /opt/adventurelog-backup/frontend/.env /opt/adventurelog/frontend/.env cd /opt/adventurelog/frontend pnpm install &>/dev/null pnpm run build &>/dev/null @@ -65,7 +66,8 @@ function update_script() { msg_ok "Started Services" msg_info "Cleaning Up" - rm -rf v${RELEASE}.zip + rm -rf /opt/v${RELEASE}.zip + rm -rf /opt/adventurelog-backup msg_ok "Cleaned" msg_ok "Updated Successfully" else @@ -81,4 +83,4 @@ description msg_ok "Completed Successfully!\n" echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" echo -e "${INFO}${YW} Access it using the following URL:${CL}" -echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}" \ No newline at end of file +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}"