@@ -29,27 +29,28 @@ function update_script() {
2929 check_container_storage
3030 check_container_resources
3131
32- if [[ ! -d /usr/share/nginx/html ]]; then
33- msg_error " No ${APP} Installation Found!"
34- exit
35- fi
36-
37- RELEASE=$( curl -s https://api.github.com/repos/CorentinTh/it-tools/releases/latest | grep ' "tag_name":' | cut -d ' "' -f4)
38- if [[ " ${RELEASE} " != " $( cat /opt/${APP} _version.txt) " ]] || [[ ! -f /opt/${APP} _version.txt ]]; then
39- DOWNLOAD_URL=" https://github.com/CorentinTh/it-tools/releases/download/${RELEASE} /it-tools-${RELEASE# v} .zip"
40- msg_info " Updating ${APP} LXC"
41- curl -fsSL -o it-tools.zip " $DOWNLOAD_URL "
42- mkdir -p /usr/share/nginx/html
43- rm -rf /usr/share/nginx/html/*
44- unzip -q it-tools.zip -d /tmp/it-tools
45- cp -r /tmp/it-tools/dist/* /usr/share/nginx/html
46- rm -rf /tmp/it-tools
47- rm -f it-tools.zip
48- msg_ok " Updated Successfully"
49- else
50- msg_ok " No update required. ${APP} is already at ${RELEASE} "
51- fi
52- exit
32+ if [ ! -d /usr/share/nginx/html ]; then
33+ msg_error " No ${APP} Installation Found!"
34+ exit 1
35+ fi
36+
37+ RELEASE=$( curl -s https://api.github.com/repos/CorentinTh/it-tools/releases/latest | grep ' "tag_name":' | cut -d ' "' -f4)
38+ if [ " ${RELEASE} " != " $( cat /opt/${APP} _version.txt 2> /dev/null) " ] || [ ! -f /opt/${APP} _version.txt ]; then
39+ DOWNLOAD_URL=" https://github.com/CorentinTh/it-tools/releases/download/${RELEASE} /it-tools-${RELEASE# v} .zip"
40+ msg_info " Updating ${APP} LXC"
41+ curl -fsSL -o it-tools.zip " $DOWNLOAD_URL "
42+ mkdir -p /usr/share/nginx/html
43+ rm -rf /usr/share/nginx/html/*
44+ unzip -q it-tools.zip -d /tmp/it-tools
45+ cp -r /tmp/it-tools/dist/* /usr/share/nginx/html
46+ rm -rf /tmp/it-tools
47+ rm -f it-tools.zip
48+ msg_ok " Updated Successfully"
49+ else
50+ msg_ok " No update required. ${APP} is already at ${RELEASE} "
51+ fi
52+
53+ exit 0
5354}
5455
5556start
0 commit comments