mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-02-11 10:19:16 +00:00
Fix Trillium Update Function
This commit is contained in:
parent
9f5f5f54a0
commit
680e9fd0f1
@ -32,21 +32,30 @@ function update_script() {
|
|||||||
msg_error "No ${APP} Installation Found!"
|
msg_error "No ${APP} Installation Found!"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
if [[ ! -f /opt/${APP}_version.txt ]]; then touch /opt/${APP}_version.txt
|
||||||
|
fi
|
||||||
|
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
|
||||||
RELEASE=$(curl -s https://api.github.com/repos/TriliumNext/Notes/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
RELEASE=$(curl -s https://api.github.com/repos/TriliumNext/Notes/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||||
|
|
||||||
msg_info "Stopping ${APP}"
|
msg_info "Stopping ${APP}"
|
||||||
systemctl stop trilium
|
systemctl stop trilium
|
||||||
sleep 1
|
sleep 1
|
||||||
msg_ok "Stopped ${APP}"
|
msg_ok "Stopped ${APP}"
|
||||||
|
|
||||||
msg_info "Updating to ${RELEASE}"
|
msg_info "Updating to ${RELEASE}"
|
||||||
|
mkdir -p /opt/trilium_backup
|
||||||
|
mv /opt/trilium/{db,dump-db} /opt/trilium_backup/
|
||||||
|
rm -rf /opt/trilium
|
||||||
|
cd /tmp
|
||||||
wget -q https://github.com/TriliumNext/Notes/releases/download/${RELEASE}/TriliumNextNotes-linux-x64-${RELEASE}.tar.xz
|
wget -q https://github.com/TriliumNext/Notes/releases/download/${RELEASE}/TriliumNextNotes-linux-x64-${RELEASE}.tar.xz
|
||||||
tar -xf TriliumNextNotes-linux-x64-${RELEASE}.tar.xz
|
tar -xf TriliumNextNotes-linux-x64-${RELEASE}.tar.xz
|
||||||
cp -r trilium-linux-x64-server/* /opt/trilium/
|
mv trilium-linux-x64-server /opt/trilium
|
||||||
|
cp -r /opt/trilium_backup/{db,dump-db} /opt/trilium/
|
||||||
|
echo "${RELEASE}" >/opt/${APP}_version.txt
|
||||||
msg_ok "Updated to ${RELEASE}"
|
msg_ok "Updated to ${RELEASE}"
|
||||||
|
|
||||||
msg_info "Cleaning up"
|
msg_info "Cleaning up"
|
||||||
rm -rf TriliumNextNotes-linux-x64-${RELEASE}.tar.xz trilium-linux-x64-server
|
rm -rf /tmp/TriliumNextNotes-linux-x64-${RELEASE}.tar.xz
|
||||||
|
rm -rf /opt/trilium_backup
|
||||||
msg_ok "Cleaned"
|
msg_ok "Cleaned"
|
||||||
|
|
||||||
msg_info "Starting ${APP}"
|
msg_info "Starting ${APP}"
|
||||||
@ -54,6 +63,9 @@ function update_script() {
|
|||||||
sleep 1
|
sleep 1
|
||||||
msg_ok "Started ${APP}"
|
msg_ok "Started ${APP}"
|
||||||
msg_ok "Updated Successfully"
|
msg_ok "Updated Successfully"
|
||||||
|
else
|
||||||
|
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
||||||
|
fi
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user