This commit is contained in:
Slaviša Arežina
2025-08-04 15:43:07 +02:00
committed by GitHub
parent b5b6048697
commit 4dc458c605
2 changed files with 26 additions and 19 deletions

View File

@@ -27,18 +27,26 @@ function update_script() {
msg_error "No ${APP} Installation Found!"
exit
fi
msg_info "Stopping ${APP}"
systemctl stop pocketbase
msg_ok "Stopped ${APP}"
msg_info "Updating ${APP}"
/opt/pocketbase/pocketbase update
msg_ok "Updated ${APP}"
RELEASE=$(curl -s https://api.github.com/repos/pocketbase/pocketbase/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
if [[ "${RELEASE}" != "$(cat ~/.pocketbase 2>/dev/null)" ]] || [[ ! -f ~/.pocketbase ]]; then
msg_info "Stopping ${APP}"
systemctl stop pocketbase
msg_ok "Stopped ${APP}"
msg_info "Starting ${APP}"
systemctl start pocketbase
msg_ok "Started ${APP}"
msg_ok "Updated Successfully"
msg_info "Updating ${APP}"
/opt/pocketbase/pocketbase update
echo "${RELEASE}" > ~/.pocketbase
msg_ok "Updated ${APP}"
msg_info "Starting ${APP}"
systemctl start pocketbase
msg_ok "Started ${APP}"
msg_ok "Update Successful"
else
msg_ok "No update required. ${APP} is already at ${RELEASE}"
fi
exit
}
@@ -49,4 +57,4 @@ description
msg_ok "Completed Successfully!\n"
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8080/_/${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8080/_/${CL}"