ProxmoxHelperScripts/misc/trilium-update.sh

48 lines
1.3 KiB
Bash
Raw Normal View History

2022-09-11 21:48:35 +02:00
#!/usr/bin/env bash
2022-10-30 02:04:45 +01:00
RELEASE=$(curl -s https://api.github.com/repos/zadam/trilium/releases/latest |
grep "tag_name" |
awk '{print substr($2, 3, length($2)-4) }')
2022-09-11 21:48:35 +02:00
2022-10-30 02:04:45 +01:00
RD=$(echo "\033[01;31m")
BL=$(echo "\033[36m")
2022-09-11 21:48:35 +02:00
CM='\xE2\x9C\x94\033'
2022-10-30 02:04:45 +01:00
GN=$(echo "\033[1;92m")
CL=$(echo "\033[m")
2022-09-11 21:48:35 +02:00
function update_info {
2022-10-30 02:04:45 +01:00
cat <<"EOF"
2022-09-11 21:48:35 +02:00
______ _ ___
/_ __/____(_) (_)_ ______ ___
/ / / ___/ / / / / / / __ `__ \
/ / / / / / / / /_/ / / / / / /
/_/ /_/ /_/_/_/\__,_/_/ /_/ /_/
UPDATE
EOF
}
update_info
while true; do
2022-09-12 02:56:31 +02:00
read -p "This will Update Trilium to v$RELEASE. Proceed(y/n)?" yn
2022-09-11 21:48:35 +02:00
case $yn in
2022-10-30 02:04:45 +01:00
[Yy]*) break ;;
[Nn]*) exit ;;
*) echo "Please answer yes or no." ;;
2022-09-11 21:48:35 +02:00
esac
done
sleep 2
echo -e "${GN} Stopping Trilium... ${CL}"
systemctl stop trilium.service
sleep 1
2022-09-12 02:56:31 +02:00
echo -e "${GN} Updating to v${RELEASE}... ${CL}"
wget -q https://github.com/zadam/trilium/releases/download/v$RELEASE/trilium-linux-x64-server-$RELEASE.tar.xz
2022-09-11 21:48:35 +02:00
2022-09-22 18:14:59 +02:00
tar -xvf trilium-linux-x64-server-$RELEASE.tar.xz &>/dev/null
cp -r trilium-linux-x64-server/* /opt/trilium/
2022-09-11 21:48:35 +02:00
echo -e "${GN} Cleaning up... ${CL}"
2022-09-22 18:14:59 +02:00
rm -rf trilium-linux-x64-server-$RELEASE.tar.xz trilium-linux-x64-server
2022-09-11 21:48:35 +02:00
echo -e "${GN} Starting Trilium... ${CL}"
systemctl start trilium.service
sleep 1
echo -e "${GN} Finished Update ${CL}"