@@ -23,35 +23,35 @@ function update_script() {
2323 header_info
2424 check_container_storage
2525 check_container_resources
26+
2627 if [[ ! -d /opt/barcodebuddy ]]; then
2728 msg_error " No ${APP} Installation Found!"
2829 exit
2930 fi
3031 RELEASE=$( curl -fsSL https://api.github.com/repos/Forceu/barcodebuddy/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 [[ " ${RELEASE} " != " $( cat ~ /.barcodebuddy 2> /dev/null ) " ]] || [[ ! -f ~ /.barcodebuddy ]]; then
3233 msg_info " Stopping Service"
3334 systemctl stop apache2
3435 systemctl stop barcodebuddy
3536 msg_ok " Stopped Service"
3637
37- msg_info " Updating ${APP} to v${RELEASE} "
38- cd /opt
38+ msg_info " Backing up data"
3939 mv /opt/barcodebuddy/ /opt/barcodebuddy-backup
40- curl -fsSL " https://github.com/Forceu/barcodebuddy/archive/refs/tags/v${RELEASE} .zip" -o $( basename " https://github.com/Forceu/barcodebuddy/archive/refs/tags/v${RELEASE} .zip" )
41- $STD unzip " v${RELEASE} .zip"
42- mv " /opt/barcodebuddy-${RELEASE} " /opt/barcodebuddy
40+ msg_ok " Backed up data"
41+
42+ fetch_and_deploy_gh_release " barcodebuddy" " Forceu/barcodebuddy"
43+
44+ msg_info " Configuring ${APP} "
4345 cp -r /opt/barcodebuddy-backup/data/. /opt/barcodebuddy/data
4446 chown -R www-data:www-data /opt/barcodebuddy/data
45- echo " ${RELEASE} " > /opt/${APP} _version.txt
46- msg_ok " Updated $APP to v${RELEASE} "
47+ msg_ok " Configured ${APP} "
4748
4849 msg_info " Starting Service"
4950 systemctl start apache2
5051 systemctl start barcodebuddy
5152 msg_ok " Started Service"
5253
5354 msg_info " Cleaning up"
54- rm -r " /opt/v${RELEASE} .zip"
5555 rm -r /opt/barcodebuddy-backup
5656 msg_ok " Cleaned"
5757 msg_ok " Updated Successfully"
0 commit comments