@@ -27,22 +27,29 @@ function update_script() {
2727 msg_error " No ${APP} Installation Found!"
2828 exit
2929 fi
30- RELEASE=$( curl -fsSL https://api.github.com/repos/Ombi-app/Ombi/releases/latest | grep ' "tag_name":' | cut -d' "' -f4)
31- if [[ " ${RELEASE} " != " $( cat /opt/${APP} _version.txt) " ]] || [[ ! -f /opt/${APP} _version.txt ]]; then
32- msg_info " Stopping ${APP} "
30+
31+ RELEASE=$( curl -fsSL https://api.github.com/repos/Ombi-app/Ombi/releases/latest | grep " tag_name" | awk ' {print substr($2, 3, length($2)-4) }' )
32+ if [[ " ${RELEASE} " != " $( cat ~ /.ombi) " ]] || [[ ! -f ~ /.ombi ]]; then
33+ msg_info " Stopping ${APP} service"
3334 systemctl stop ombi
34- msg_ok " Stopped ${APP} "
35+ msg_ok " Stopped ${APP} service"
36+
37+ msg_info " Creating backup"
38+ [[ -f /opt/ombi/Ombi.db ]] && mv /opt/ombi/Ombi.db /opt
39+ [[ -f /opt/ombi/OmbiExternal.db ]] && mv /opt/ombi/OmbiExternal.db /opt
40+ [[ -f /opt/ombi/OmbiSettings.db ]] && mv /opt/ombi/OmbiSettings.db /opt
41+ msg_ok " Backup created"
3542
36- msg_info " Updating ${APP} to ${RELEASE} "
37- curl -fsSL " https://github.com/Ombi-app/Ombi/releases/download/${RELEASE} /linux-x64.tar.gz" -o $( basename " https://github.com/Ombi-app/Ombi/releases/download/${RELEASE} /linux-x64.tar.gz" )
38- tar -xzf linux-x64.tar.gz -C /opt/ombi
39- rm -rf linux-x64.tar.gz
40- echo " ${RELEASE} " > /opt/${APP} _version.txt
41- msg_ok " Updated ${APP} to ${RELEASE} "
43+ rm -rf /opt/ombi
44+ fetch_and_deploy_gh_release " ombi" " Ombi-app/Ombi" " prebuild" " latest" " /opt/ombi" " linux-x64.tar.gz"
45+ [[ -f /opt/Ombi.db ]] && mv /opt/Ombi.db /opt/ombi
46+ [[ -f /opt/OmbiExternal.db ]] && mv /opt/OmbiExternal.db /opt/ombi
47+ [[ -f /opt/OmbiSettings.db ]] && mv /opt/OmbiSettings.db /opt/ombi
4248
43- msg_info " Starting ${APP} "
49+ msg_info " Starting ${APP} service "
4450 systemctl start ombi
45- msg_ok " Started ${APP} "
51+ msg_ok " Started ${APP} service"
52+
4653 msg_ok " Updated Successfully"
4754 else
4855 msg_ok " No update required. ${APP} ia already at ${RELEASE} ."
0 commit comments