1
0
mirror of https://github.com/community-scripts/ProxmoxVE.git synced 2025-04-19 16:28:07 +00:00

Fix TriliumNotes release handling (#3160)

This commit is contained in:
Slaviša Arežina 2025-03-17 23:34:01 +01:00 committed by GitHub
parent 58132fdb1d
commit 4aa8578b7d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 8 deletions

View File

@ -28,8 +28,8 @@ function update_script() {
exit exit
fi fi
if [[ ! -f /opt/${APP}_version.txt ]]; then touch /opt/${APP}_version.txt; fi if [[ ! -f /opt/${APP}_version.txt ]]; then touch /opt/${APP}_version.txt; fi
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, 3, length($2)-4) }')
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then if [[ "v${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
msg_info "Stopping ${APP}" msg_info "Stopping ${APP}"
systemctl stop trilium systemctl stop trilium
sleep 1 sleep 1
@ -40,11 +40,11 @@ function update_script() {
mv /opt/trilium/{db,dump-db} /opt/trilium_backup/ mv /opt/trilium/{db,dump-db} /opt/trilium_backup/
rm -rf /opt/trilium rm -rf /opt/trilium
cd /tmp cd /tmp
wget -q https://github.com/TriliumNext/Notes/releases/download/${RELEASE}/TriliumNextNotes-Server-${RELEASE}-linux-x64.tar.xz wget -q https://github.com/TriliumNext/Notes/releases/download/v${RELEASE}/TriliumNextNotes-Server-v${RELEASE}-linux-x64.tar.xz
tar -xf TriliumNextNotes-Server-${RELEASE}-linux-x64.tar.xz tar -xf TriliumNextNotes-Server-v${RELEASE}-linux-x64.tar.xz
mv TriliumNextNotes-Server-$RELEASE-linux-x64 /opt/trilium mv TriliumNextNotes-Server-$RELEASE-linux-x64 /opt/trilium
cp -r /opt/trilium_backup/{db,dump-db} /opt/trilium/ cp -r /opt/trilium_backup/{db,dump-db} /opt/trilium/
echo "${RELEASE}" >/opt/${APP}_version.txt echo "v${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated to ${RELEASE}" msg_ok "Updated to ${RELEASE}"
msg_info "Cleaning up" msg_info "Cleaning up"

View File

@ -22,9 +22,9 @@ msg_ok "Installed Dependencies"
msg_info "Setup TriliumNext" msg_info "Setup TriliumNext"
cd /opt cd /opt
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, 3, length($2)-4) }')
wget -q https://github.com/TriliumNext/Notes/releases/download/${RELEASE}/TriliumNextNotes-Server-${RELEASE}-linux-x64.tar.xz wget -q https://github.com/TriliumNext/Notes/releases/download/v${RELEASE}/TriliumNextNotes-Server-v${RELEASE}-linux-x64.tar.xz
tar -xf TriliumNextNotes-Server-${RELEASE}-linux-x64.tar.xz tar -xf TriliumNextNotes-Server-v${RELEASE}-linux-x64.tar.xz
mv TriliumNextNotes-Server-$RELEASE-linux-x64 /opt/trilium mv TriliumNextNotes-Server-$RELEASE-linux-x64 /opt/trilium
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt" echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
msg_ok "Setup TriliumNext" msg_ok "Setup TriliumNext"