@@ -20,47 +20,47 @@ color
2020catch_errors
2121
2222function update_script() {
23- header_info
24- check_container_storage
25- check_container_resources
26- if [[ ! -d /opt/bytestash ]]; then
27- msg_error " No ${APP} Installation Found!"
28- exit
29- fi
30- RELEASE=$( curl -fsSL https://api.github.com/repos/jordan-dalby/ByteStash/releases/latest | grep " tag_name" | awk ' {print substr($2, 3, length($2)-4) }' )
31- if [[ ! -f /opt/${APP} _version.txt ]] || [[ " ${RELEASE} " != " $( cat /opt/${APP} _version.txt) " ]]; then
32- msg_info " Stopping Services"
33- systemctl stop bytestash-backend
34- systemctl stop bytestash-frontend
35- msg_ok " Services Stopped"
23+ header_info
24+ check_container_storage
25+ check_container_resources
26+
27+ if [[ ! -d /opt/bytestash ]]; then
28+ msg_error " No ${APP} Installation Found!"
29+ exit
30+ fi
31+ RELEASE=$( curl -fsSL https://api.github.com/repos/jordan-dalby/ByteStash/releases/latest | grep " tag_name" | awk ' {print substr($2, 3, length($2)-4) }' )
32+ if [[ " ${RELEASE} " != " $( cat ~ /.bytestash 2> /dev/null) " ]] || [[ ! -f ~ /.bytestash ]]; then
3633
37- msg_info " Updating ${APP} to ${RELEASE} "
38- temp_file=$( mktemp)
39- curl -fsSL " https://github.com/jordan-dalby/ByteStash/archive/refs/tags/v${RELEASE} .tar.gz" -o " $temp_file "
40- tar zxf $temp_file
41- rm -rf /opt/bytestash/server/node_modules
42- rm -rf /opt/bytestash/client/node_modules
43- cp -rf ByteStash-${RELEASE} /* /opt/bytestash
44- cd /opt/bytestash/server
45- $STD npm install
46- cd /opt/bytestash/client
47- $STD npm install
48- echo " ${RELEASE} " > /opt/${APP} _version.txt
49- msg_ok " Updated ${APP} "
34+ read -rp " ${TAB3} Did you make a backup via application WebUI? (y/n): " backuped
35+ if [[ " $backuped " =~ ^[Yy]$ ]]; then
36+ msg_info " Stopping Services"
37+ systemctl stop bytestash-backend
38+ systemctl stop bytestash-frontend
39+ msg_ok " Services Stopped"
5040
51- msg_info " Starting Services"
52- systemctl start bytestash-backend
53- systemctl start bytestash-frontend
54- msg_ok " Started Services"
41+ rm -rf /opt/bytestash
42+ fetch_and_deploy_gh_release " bytestash" " jordan-dalby/ByteStash"
5543
56- msg_info " Cleaning Up"
57- rm -f $temp_file
58- msg_ok " Cleaned"
59- msg_ok " Updated Successfully"
44+ msg_info " Configuring ByteStash"
45+ cd /opt/bytestash/server
46+ $STD npm install
47+ cd /opt/bytestash/client
48+ $STD npm install
49+ msg_ok " Updated ${APP} "
50+
51+ msg_info " Starting Services"
52+ systemctl start bytestash-backend
53+ systemctl start bytestash-frontend
54+ msg_ok " Started Services"
6055 else
61- msg_ok " No update required. ${APP} is already at ${RELEASE} "
56+ msg_error " PLEASE MAKE A BACKUP FIRST!"
57+ exit
6258 fi
63- exit
59+ msg_ok " Updated Successfully"
60+ else
61+ msg_ok " No update required. ${APP} is already at ${RELEASE} "
62+ fi
63+ exit
6464}
6565
6666start
@@ -70,4 +70,4 @@ description
7070msg_ok " Completed Successfully!\n"
7171echo -e " ${CREATING}${GN}${APP} setup has been successfully initialized!${CL} "
7272echo -e " ${INFO}${YW} Access it using the following URL:${CL} "
73- echo -e " ${TAB}${GATEWAY}${BGN} http://${IP} :3000${CL} "
73+ echo -e " ${TAB}${GATEWAY}${BGN} http://${IP} :3000${CL} "
0 commit comments