Keep Lubelogger data after update to a new version (#1200)

This commit is contained in:
Jc Miñarro 2025-01-03 18:55:06 +01:00 committed by GitHub
parent 385b36d29e
commit 487f36fec6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -42,11 +42,19 @@ function update_script() {
msg_info "Updating ${APP} to v${RELEASE}"
cd /opt
wget -q https://github.com/hargata/lubelog/releases/download/v${RELEASE}/LubeLogger_v${RELEASE_TRIMMED}_linux_x64.zip
cp /opt/lubelogger/appsettings.json /opt/appsettings.json
mkdir -p /tmp/lubeloggerData/wwwroot
cp /opt/lubelogger/appsettings.json /tmp/lubeloggerData/appsettings.json
cp -r /opt/lubelogger/config /tmp/lubeloggerData/
cp -r /opt/lubelogger/data /tmp/lubeloggerData/
[[ -e /opt/lubelogger/wwwroot/translations ]] && cp -r /opt/lubelogger/wwwroot/translations /tmp/lubeloggerData/wwwroot/
[[ -e /opt/lubelogger/wwwroot/documents ]] && cp -r /opt/lubelogger/wwwroot/documents /tmp/lubeloggerData/wwwroot/
[[ -e /opt/lubelogger/wwwroot/images ]] && cp -r /opt/lubelogger/wwwroot/images /tmp/lubeloggerData/wwwroot/
[[ -e /opt/lubelogger/wwwroot/temp ]] && cp -r /opt/lubelogger/wwwroot/temp /tmp/lubeloggerData/wwwroot/
[[ -e /opt/lubelogger/log ]] && cp -r /opt/lubelogger/log /tmp/lubeloggerData/
rm -rf /opt/lubelogger
unzip -qq LubeLogger_v${RELEASE_TRIMMED}_linux_x64.zip -d lubelogger
chmod 700 /opt/lubelogger/CarCareTracker
mv -f /opt/appsettings.json /opt/lubelogger/appsettings.json
cp -rf /tmp/lubeloggerData/* /opt/lubelogger/
echo "${RELEASE}" >"/opt/${APP}_version.txt"
msg_ok "Updated ${APP} to v${RELEASE}"
@ -56,6 +64,7 @@ function update_script() {
msg_info "Cleaning up"
rm -rf /opt/LubeLogger_v${RELEASE_TRIMMED}_linux_x64.zip
rm -rf /tmp/lubeloggerData
msg_ok "Cleaned"
msg_ok "Updated Successfully"
else
@ -71,4 +80,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}:5000${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:5000${CL}"