trilium-install.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/usr/bin/env bash
  2. # Copyright (c) 2021-2023 tteck
  3. # Author: tteck (tteckster)
  4. # License: MIT
  5. # https://github.com/tteck/Proxmox/raw/main/LICENSE
  6. source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
  7. color
  8. verb_ip6
  9. catch_errors
  10. setting_up_container
  11. network_check
  12. update_os
  13. msg_info "Installing Dependencies"
  14. $STD apt-get install -y curl
  15. $STD apt-get install -y sudo
  16. $STD apt-get install -y mc
  17. msg_ok "Installed Dependencies"
  18. RELEASE=$(curl -s https://api.github.com/repos/zadam/trilium/releases/latest |
  19. grep "tag_name" |
  20. awk '{print substr($2, 3, length($2)-4) }')
  21. msg_info "Installing Trilium"
  22. wget -q https://github.com/zadam/trilium/releases/download/v$RELEASE/trilium-linux-x64-server-$RELEASE.tar.xz
  23. $STD tar -xvf trilium-linux-x64-server-$RELEASE.tar.xz
  24. mv trilium-linux-x64-server /opt/trilium
  25. msg_ok "Installed Trilium"
  26. msg_info "Creating Service"
  27. service_path="/etc/systemd/system/trilium.service"
  28. echo "[Unit]
  29. Description=Trilium Daemon
  30. After=syslog.target network.target
  31. [Service]
  32. User=root
  33. Type=simple
  34. ExecStart=/opt/trilium/trilium.sh
  35. WorkingDirectory=/opt/trilium/
  36. TimeoutStopSec=20
  37. Restart=always
  38. [Install]
  39. WantedBy=multi-user.target" >$service_path
  40. systemctl enable --now -q trilium
  41. msg_ok "Created Service"
  42. motd_ssh
  43. customize
  44. msg_info "Cleaning up"
  45. $STD apt-get autoremove
  46. $STD apt-get autoclean
  47. rm -rf /root/trilium-linux-x64-server-$RELEASE.tar.xz
  48. msg_ok "Cleaned"