Skip to content

Commit 5ac4818

Browse files
Refactor: Trilium (#5665)
* Refactor: Trilium * change name & description of trilium * finalize * Change Logo to new selfhst * Update trilium.sh --------- Co-authored-by: Tobias <[email protected]>
1 parent c293b05 commit 5ac4818

File tree

3 files changed

+47
-60
lines changed

3 files changed

+47
-60
lines changed

ct/trilium.sh

Lines changed: 41 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV
33
# Copyright (c) 2021-2025 tteck
44
# Author: tteck (tteckster)
55
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6-
# Source: https://triliumnext.github.io/Docs/
6+
# Source: https://github.com/TriliumNext/Trilium
77

8-
APP="Trilium"
8+
APP="Trilium Notes"
99
var_tags="${var_tags:-notes}"
1010
var_cpu="${var_cpu:-1}"
1111
var_ram="${var_ram:-512}"
@@ -27,57 +27,52 @@ function update_script() {
2727
msg_error "No ${APP} Installation Found!"
2828
exit
2929
fi
30-
if [[ ! -f /opt/${APP}_version.txt ]]; then touch /opt/${APP}_version.txt; fi
31-
RELEASE=$(curl -fsSL https://api.github.com/repos/TriliumNext/Notes/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
32-
if [[ "v${RELEASE}" != "$(cat /opt/${APP}_version.txt 2>/dev/null)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
33-
34-
if [[ -d /opt/trilium/db ]]; then
35-
DB_PATH="/opt/trilium/db"
36-
DB_RESTORE_PATH="/opt/trilium/db"
37-
elif [[ -d /opt/trilium/assets/db ]]; then
38-
DB_PATH="/opt/trilium/assets/db"
39-
DB_RESTORE_PATH="/opt/trilium/assets/db"
40-
else
41-
msg_error "Database not found in either /opt/trilium/db or /opt/trilium/assets/db"
42-
exit 1
43-
fi
30+
RELEASE=$(curl -fsSL https://api.github.com/repos/TriliumNext/Trilium/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
31+
if [[ "${RELEASE}" != "$(cat ~/.Trilium 2>/dev/null)" ]] || [[ ! -f ~/.Trilium ]]; then
32+
33+
if [[ -d /opt/trilium/db ]]; then
34+
DB_PATH="/opt/trilium/db"
35+
DB_RESTORE_PATH="/opt/trilium/db"
36+
elif [[ -d /opt/trilium/assets/db ]]; then
37+
DB_PATH="/opt/trilium/assets/db"
38+
DB_RESTORE_PATH="/opt/trilium/assets/db"
39+
else
40+
msg_error "Database not found in either /opt/trilium/db or /opt/trilium/assets/db"
41+
exit 1
42+
fi
4443

45-
msg_info "Stopping ${APP}"
46-
systemctl stop trilium
47-
sleep 1
48-
msg_ok "Stopped ${APP}"
44+
msg_info "Stopping ${APP}"
45+
systemctl stop trilium
46+
sleep 1
47+
msg_ok "Stopped ${APP}"
4948

50-
msg_info "Updating to ${RELEASE}"
51-
mkdir -p /opt/trilium_backup
52-
cp -r "${DB_PATH}" /opt/trilium_backup/
53-
rm -rf /opt/trilium
54-
cd /tmp
55-
curl -fsSL "https://github.com/TriliumNext/trilium/releases/download/v${RELEASE}/TriliumNextNotes-Server-v${RELEASE}-linux-x64.tar.xz" -o "TriliumNextNotes-Server-v${RELEASE}-linux-x64.tar.xz"
56-
tar -xf "TriliumNextNotes-Server-v${RELEASE}-linux-x64.tar.xz"
57-
mv "TriliumNextNotes-Server-${RELEASE}-linux-x64" /opt/trilium
49+
msg_info "Backing up Database"
50+
mkdir -p /opt/trilium_backup
51+
cp -r "${DB_PATH}" /opt/trilium_backup/
52+
rm -rf /opt/trilium
53+
msg_ok "Backed up Database"
5854

59-
# Restore database
60-
mkdir -p "$(dirname "${DB_RESTORE_PATH}")"
61-
cp -r /opt/trilium_backup/$(basename "${DB_PATH}") "${DB_RESTORE_PATH}"
55+
fetch_and_deploy_gh_release "Trilium" "TriliumNext/Trilium" "prebuild" "latest" "/opt/trilium" "TriliumNotes-Server-*linux-x64.tar.xz"
6256

63-
echo "v${RELEASE}" >/opt/${APP}_version.txt
64-
msg_ok "Updated to ${RELEASE}"
57+
msg_info "Restoring Database"
58+
mkdir -p "$(dirname "${DB_RESTORE_PATH}")"
59+
cp -r /opt/trilium_backup/$(basename "${DB_PATH}") "${DB_RESTORE_PATH}"
60+
msg_ok "Restored Database"
6561

66-
msg_info "Cleaning up"
67-
rm -rf "/tmp/TriliumNextNotes-Server-${RELEASE}-linux-x64.tar.xz"
68-
rm -rf /opt/trilium_backup
69-
msg_ok "Cleaned"
62+
msg_info "Cleaning up"
63+
rm -rf /opt/trilium_backup
64+
msg_ok "Cleaned"
7065

71-
msg_info "Starting ${APP}"
72-
systemctl start trilium
73-
sleep 1
74-
msg_ok "Started ${APP}"
75-
msg_ok "Updated Successfully"
76-
else
77-
msg_ok "No update required. ${APP} is already at ${RELEASE}"
78-
fi
66+
msg_info "Starting ${APP}"
67+
systemctl start trilium
68+
sleep 1
69+
msg_ok "Started ${APP}"
70+
msg_ok "Updated Successfully"
71+
else
72+
msg_ok "No update required. ${APP} is already at ${RELEASE}"
73+
fi
7974

80-
exit
75+
exit
8176
}
8277

8378
start

frontend/public/json/trilium.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

install/trilium-install.sh

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Copyright (c) 2021-2025 tteck
44
# Author: tteck (tteckster)
55
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6-
# Source: https://triliumnext.github.io/Docs/
6+
# Source: https://github.com/TriliumNext/Trilium
77

88
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
99
color
@@ -13,14 +13,7 @@ setting_up_container
1313
network_check
1414
update_os
1515

16-
msg_info "Setup TriliumNext"
17-
cd /opt
18-
RELEASE=$(curl -fsSL https://api.github.com/repos/TriliumNext/trilium/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
19-
curl -fsSL "https://github.com/TriliumNext/trilium/releases/download/v${RELEASE}/TriliumNextNotes-Server-v${RELEASE}-linux-x64.tar.xz" -o "TriliumNextNotes-Server-v${RELEASE}-linux-x64.tar.xz"
20-
tar -xf TriliumNextNotes-Server-v${RELEASE}-linux-x64.tar.xz
21-
mv TriliumNextNotes-Server-$RELEASE-linux-x64 /opt/trilium
22-
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
23-
msg_ok "Setup TriliumNext"
16+
fetch_and_deploy_gh_release "Trilium" "TriliumNext/Trilium" "prebuild" "latest" "/opt/trilium" "TriliumNotes-Server-*linux-x64.tar.xz"
2417

2518
msg_info "Creating Service"
2619
cat <<EOF >/etc/systemd/system/trilium.service
@@ -46,7 +39,6 @@ motd_ssh
4639
customize
4740

4841
msg_info "Cleaning up"
49-
rm -rf /opt/TriliumNextNotes-Server-${RELEASE}-linux-x64.tar.xz
5042
$STD apt-get -y autoremove
5143
$STD apt-get -y autoclean
5244
msg_ok "Cleaned"

0 commit comments

Comments
 (0)