@@ -32,29 +32,35 @@ function update_script() {
3232 msg_error " No ${APP} Installation Found!"
3333 exit
3434 fi
35- msg_info " Stopping Service"
36- systemctl stop opengist.service
37- msg_ok " Stopped Service"
38- apt-get update & > /dev/null
39- apt-get upgrade & > /dev/null
4035 RELEASE=$( curl -s https://api.github.com/repos/thomiceli/opengist/releases/latest | grep " tag_name" | awk ' {print substr($2, 3, length($2)-4) }' )
4136 if [[ ! -f /opt/${APP} _version.txt ]] || [[ " ${RELEASE} " != " $( cat /opt/${APP} _version.txt) " ]]; then
37+ msg_info " Stopping Service"
38+ systemctl stop opengist.service
39+ msg_ok " Stopped Service"
40+
4241 msg_info " Updating ${APP} to v${RELEASE} "
42+ apt-get update & > /dev/null
43+ apt-get -y upgrade & > /dev/null
4344 cd /opt
44- wget -qO " https://github.com/thomiceli/ opengist/releases/download/v ${RELEASE} / opengist${RELEASE} -linux-amd64.tar.gz "
45- rm -rf /opt/ opengist
45+ mv /opt/ opengist /opt/ opengist-backup
46+ wget -q " https://github.com/thomiceli/ opengist/releases/download/v ${RELEASE} /opengist ${RELEASE} -linux-amd64.tar.gz "
4647 tar -xzf opengist${RELEASE} -linux-amd64.tar.gz
48+ mv /opt/opengist-backup/config.yml /opt/opengist/config.yml
4749 chmod +x /opt/opengist/opengist
4850 echo " ${RELEASE} " > " /opt/${APP} _version.txt"
49- rm -rf /opt/opengist${RELEASE} -linux-amd64.tar.gz
50- apt-get -y autoremove & > /dev/null
51- apt-get -y autoclean & > /dev/null
5251 msg_ok " Updated ${APP} LXC"
5352
5453 msg_info " Starting Service"
5554 systemctl start opengist.service
5655 msg_ok " Started Service"
57-
56+
57+ msg_info " Cleaning up"
58+ rm -rf /opt/opengist${RELEASE} -linux-amd64.tar.gz
59+ rm -rf /opt/opengist-backup
60+ apt-get -y autoremove & > /dev/null
61+ apt-get -y autoclean & > /dev/null
62+ msg_ok " Cleaned"
63+ msg_ok " Updated Successfully"
5864 else
5965 msg_ok " No update required. ${APP} is already at v${RELEASE} ."
6066 fi
0 commit comments