Update thelounge.sh

This commit is contained in:
Kristo Copani 2024-11-28 22:14:07 +02:00 committed by GitHub
parent cfe4a546d7
commit 672ab77941
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
# Copyright (c) 2021-2024 tteck # Copyright (c) 2021-2024 community-scripts ORG
# Author: kristocopani # Author: kristocopani
# License: MIT # License: MIT
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
@ -14,6 +14,7 @@ cat <<"EOF"
/ / / / / / __/ / /___/ /_/ / /_/ / / / / /_/ / __/ / / / / / / __/ / /___/ /_/ / /_/ / / / / /_/ / __/
/_/ /_/ /_/\___/ /_____/\____/\__,_/_/ /_/\__, /\___/ /_/ /_/ /_/\___/ /_____/\____/\__,_/_/ /_/\__, /\___/
/____/ /____/
EOF EOF
} }
header_info header_info
@ -62,10 +63,10 @@ function update_script() {
exit exit
fi fi
RELEASE=$(curl -s https://api.github.com/repos/thelounge/thelounge-deb/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') RELEASE=$(curl -s https://api.github.com/repos/thelounge/thelounge-deb/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
if [[ "v${RELEASE}" != "$(sudo -u thelounge thelounge -v)" ]]; then f [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
msg_info "Stopping ${APP} Services" msg_info "Stopping Service"
systemctl stop thelounge systemctl stop thelounge
msg_ok "Stopped ${APP} Services" msg_ok "Stopped Service"
msg_info "Updating ${APP} to ${RELEASE}" msg_info "Updating ${APP} to ${RELEASE}"
apt-get install --only-upgrade \ apt-get install --only-upgrade \
@ -73,12 +74,11 @@ function update_script() {
cd /opt cd /opt
wget -q https://github.com/thelounge/thelounge-deb/releases/download/v${RELEASE}/thelounge_${RELEASE}_all.deb wget -q https://github.com/thelounge/thelounge-deb/releases/download/v${RELEASE}/thelounge_${RELEASE}_all.deb
dpkg -i ./thelounge_${RELEASE}_all.deb dpkg -i ./thelounge_${RELEASE}_all.deb
msg_ok "Updated ${APP} to ${RELEASE}" msg_ok "Updated ${APP} to v${RELEASE}"
msg_info "Starting ${APP} Services" msg_info "Starting Service"
systemctl daemon-reload
systemctl start thelounge systemctl start thelounge
msg_ok "Started ${APP}" msg_ok "Started Service"
msg_info "Cleaning up" msg_info "Cleaning up"
rm -rf "/opt/thelounge_${RELEASE}_all.deb" rm -rf "/opt/thelounge_${RELEASE}_all.deb"
@ -87,7 +87,7 @@ function update_script() {
msg_ok "Cleaned" msg_ok "Cleaned"
msg_ok "Updated Successfully" msg_ok "Updated Successfully"
else else
msg_ok "No update required. ${APP} is already at ${RELEASE}." msg_ok "No update required. ${APP} is already at v${RELEASE}."
fi fi
exit exit
} }