11#! /usr/bin/env bash
22source <( curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+ # Copyright (c) 2021-2025 community-scripts ORG
4+ # Author: cfurrow | Co-Author: Slaviša Arežina (tremor021)
5+ # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
36# Source: https://github.com/gristlabs/grist-core
47
58APP=" Grist"
@@ -26,57 +29,34 @@ function update_script() {
2629 exit
2730 fi
2831
29- RELEASE=$( curl -fsSL https://api.github.com/repos/gristlabs/grist-core/releases/latest | grep " tag_name" | awk ' {print substr($2, 3, length($2)-4) }' )
30- if [[ ! -f /opt/${APP} _version.txt ]] || [[ " ${RELEASE} " != " $( cat /opt/${APP} _version.txt) " ]]; then
31-
32+ if check_for_gh_release " grist" " gristlabs/grist-core" ; then
3233 msg_info " Stopping ${APP} Service"
3334 systemctl stop grist
3435 msg_ok " Stopped ${APP} Service"
3536
36- msg_info " Updating ${APP} to v${RELEASE} "
37-
38- cd /opt
39- rm -rf grist_bak
37+ msg_info " Creating backup"
38+ rm -rf /opt/grist_bak
4039 mv grist grist_bak
41- curl -fsSL " https://github.com/gristlabs/grist-core/archive/refs/tags/v${RELEASE} .zip" -o $( basename " https://github.com/gristlabs/grist-core/archive/refs/tags/v${RELEASE} .zip" )
42- $STD unzip v$RELEASE .zip
43- mv grist-core-${RELEASE} grist
40+ msg_ok " Backup created"
4441
45- mkdir -p grist/docs
42+ fetch_and_deploy_gh_release " grist" " gristlabs/grist-core " " tarball "
4643
47- cp -n grist_bak/.env grist/.env || true
48- cp -r grist_bak/docs/* grist/docs/ || true
49- cp grist_bak/grist-sessions.db grist/grist-sessions.db || true
50- cp grist_bak/landing.db grist/landing.db || true
51-
52- cd grist
53- msg_info " Installing Dependencies"
44+ msg_info " Updating ${APP} "
45+ mkdir -p grist/docs
46+ cp -n /opt/grist_bak/.env /opt/grist/.env
47+ cp -r /opt/grist_bak/docs/* /opt/grist/docs/
48+ cp /opt/grist_bak/grist-sessions.db /opt/grist/grist-sessions.db
49+ cp /opt/grist_bak/landing.db /opt/grist/landing.db
5450 $STD yarn install
55- msg_ok " Installed Dependencies"
56-
57- msg_info " Building"
5851 $STD yarn run build:prod
59- msg_ok " Done building"
60-
61- msg_info " Installing Python"
6252 $STD yarn run install:python
63- msg_ok " Installed Python"
64-
65- echo " ${RELEASE} " > /opt/${APP} _version.txt
66-
67- msg_ok " Updated ${APP} to v${RELEASE} "
53+ msg_ok " Updated ${APP} "
6854
6955 msg_info " Starting ${APP} Service"
7056 systemctl start grist
7157 msg_ok " Started ${APP} Service"
7258
73- msg_info " Cleaning up"
74- rm -rf /opt/v$RELEASE .zip
75- msg_ok " Cleaned"
76-
77- msg_ok " Updated Successfully!\n"
78- else
79- msg_ok " No update required. ${APP} is already at ${RELEASE} "
59+ msg_ok " Updated Successfully"
8060 fi
8161 exit
8262}
0 commit comments