@@ -27,34 +27,27 @@ function update_script() {
2727 msg_error " No ${APP} Installation Found!"
2828 exit
2929 fi
30+
3031 RELEASE=$( curl -fsSL https://api.github.com/repos/thomiceli/opengist/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+ if [[ ! -f ~ /.opengist ]] || [[ " ${RELEASE} " != " $( cat ~ /.opengist ) " ]]; then
3233 msg_info " Stopping Service"
33- systemctl stop opengist.service
34+ systemctl stop opengist
3435 msg_ok " Stopped Service"
3536
36- msg_info " Updating ${APP} to v${RELEASE} "
37- $STD apt-get update
38- $STD apt-get -y upgrade
39- cd /opt
37+ msg_info " Creating backup"
4038 mv /opt/opengist /opt/opengist-backup
41- curl -fsSL " https://github.com/thomiceli/opengist/releases/download/v${RELEASE} /opengist${RELEASE} -linux-amd64.tar.gz" -o $( basename " https://github.com/thomiceli/opengist/releases/download/v${RELEASE} /opengist${RELEASE} -linux-amd64.tar.gz" )
42- tar -xzf opengist${RELEASE} -linux-amd64.tar.gz
39+ msg_ok " Backup created"
40+
41+ fetch_and_deploy_gh_release " opengist" " thomiceli/opengist" " prebuild" " latest" " /opt/opengist" " opengist*linux-amd64.tar.gz"
42+
43+ msg_info " Configuring ${APP} "
4344 mv /opt/opengist-backup/config.yml /opt/opengist/config.yml
44- chmod +x /opt/opengist/opengist
45- echo " ${RELEASE} " > " /opt/${APP} _version.txt"
46- msg_ok " Updated ${APP} LXC"
45+ msg_ok " Configured ${APP} "
4746
4847 msg_info " Starting Service"
49- systemctl start opengist.service
48+ systemctl start opengist
5049 msg_ok " Started Service"
5150
52- msg_info " Cleaning up"
53- rm -rf /opt/opengist${RELEASE} -linux-amd64.tar.gz
54- rm -rf /opt/opengist-backup
55- $STD apt-get -y autoremove
56- $STD apt-get -y autoclean
57- msg_ok " Cleaned"
5851 msg_ok " Updated Successfully"
5952 else
6053 msg_ok " No update required. ${APP} is already at v${RELEASE} ."
0 commit comments