diff --git a/ct/trilium.sh b/ct/trilium.sh index 076448089..84103e515 100644 --- a/ct/trilium.sh +++ b/ct/trilium.sh @@ -28,8 +28,8 @@ function update_script() { exit 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) }') - 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, 3, length($2)-4) }') + if [[ "v${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then msg_info "Stopping ${APP}" systemctl stop trilium sleep 1 @@ -40,11 +40,11 @@ function update_script() { 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-Server-${RELEASE}-linux-x64.tar.xz - tar -xf 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-v${RELEASE}-linux-x64.tar.xz mv TriliumNextNotes-Server-$RELEASE-linux-x64 /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_info "Cleaning up" diff --git a/install/trilium-install.sh b/install/trilium-install.sh index 953a509bf..61adc4d34 100644 --- a/install/trilium-install.sh +++ b/install/trilium-install.sh @@ -22,9 +22,9 @@ msg_ok "Installed Dependencies" msg_info "Setup TriliumNext" 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) }') -wget -q https://github.com/TriliumNext/Notes/releases/download/${RELEASE}/TriliumNextNotes-Server-${RELEASE}-linux-x64.tar.xz -tar -xf TriliumNextNotes-Server-${RELEASE}-linux-x64.tar.xz +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/v${RELEASE}/TriliumNextNotes-Server-v${RELEASE}-linux-x64.tar.xz +tar -xf TriliumNextNotes-Server-v${RELEASE}-linux-x64.tar.xz mv TriliumNextNotes-Server-$RELEASE-linux-x64 /opt/trilium echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt" msg_ok "Setup TriliumNext"