trilium.sh 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #!/usr/bin/env bash
  2. source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func)
  3. # Copyright (c) 2021-2023 tteck
  4. # Author: tteck (tteckster)
  5. # License: MIT
  6. # https://github.com/tteck/Proxmox/raw/main/LICENSE
  7. function header_info {
  8. clear
  9. cat <<"EOF"
  10. ______ _ ___
  11. /_ __/____(_) (_)_ ______ ___
  12. / / / ___/ / / / / / / __ `__ \
  13. / / / / / / / / /_/ / / / / / /
  14. /_/ /_/ /_/_/_/\__,_/_/ /_/ /_/
  15. EOF
  16. }
  17. header_info
  18. echo -e "Loading..."
  19. APP="Trilium"
  20. var_disk="2"
  21. var_cpu="1"
  22. var_ram="512"
  23. var_os="debian"
  24. var_version="11"
  25. variables
  26. color
  27. catch_errors
  28. function default_settings() {
  29. CT_TYPE="1"
  30. PW=""
  31. CT_ID=$NEXTID
  32. HN=$NSAPP
  33. DISK_SIZE="$var_disk"
  34. CORE_COUNT="$var_cpu"
  35. RAM_SIZE="$var_ram"
  36. BRG="vmbr0"
  37. NET="dhcp"
  38. GATE=""
  39. DISABLEIP6="no"
  40. MTU=""
  41. SD=""
  42. NS=""
  43. MAC=""
  44. VLAN=""
  45. SSH="no"
  46. VERB="no"
  47. echo_default
  48. }
  49. function update_script() {
  50. header_info
  51. if [[ ! -d /opt/trilium ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
  52. RELEASE=$(curl -s https://api.github.com/repos/zadam/trilium/releases/latest |
  53. grep "tag_name" |
  54. awk '{print substr($2, 3, length($2)-4) }')
  55. msg_info "Stopping ${APP}"
  56. systemctl stop trilium.service
  57. sleep 1
  58. msg_ok "Stopped ${APP}"
  59. msg_info "Updating to v${RELEASE}"
  60. wget -q https://github.com/zadam/trilium/releases/download/v$RELEASE/trilium-linux-x64-server-$RELEASE.tar.xz
  61. tar -xvf trilium-linux-x64-server-$RELEASE.tar.xz &>/dev/null
  62. cp -r trilium-linux-x64-server/* /opt/trilium/
  63. msg_ok "Updated to v${RELEASE}"
  64. msg_info "Cleaning up"
  65. rm -rf trilium-linux-x64-server-$RELEASE.tar.xz trilium-linux-x64-server
  66. msg_ok "Cleaned"
  67. msg_info "Starting ${APP}"
  68. systemctl start trilium.service
  69. sleep 1
  70. msg_ok "Started ${APP}"
  71. msg_ok "Updated Successfully"
  72. exit
  73. }
  74. start
  75. build_container
  76. description
  77. msg_ok "Completed Successfully!\n"
  78. echo -e "${APP} should be reachable by going to the following URL.
  79. ${BL}http://${IP}:8080${CL} \n"