ProxmoxVE/ct/thelounge.sh

102 lines
2.6 KiB
Bash
Raw Normal View History

2024-11-28 16:13:32 +00:00
#!/usr/bin/env bash
2024-11-28 20:01:17 +00:00
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
2024-11-28 20:14:07 +00:00
# Copyright (c) 2021-2024 community-scripts ORG
2024-11-28 20:01:17 +00:00
# Author: kristocopani
2024-11-28 16:13:32 +00:00
# License: MIT
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
2024-11-28 19:39:02 +00:00
2024-11-28 16:13:32 +00:00
function header_info {
2024-11-28 19:37:29 +00:00
clear
cat <<"EOF"
2024-11-28 19:47:26 +00:00
________ __
/_ __/ /_ ___ / / ____ __ ______ ____ ____
/ / / __ \/ _ \ / / / __ \/ / / / __ \/ __ `/ _ \
/ / / / / / __/ / /___/ /_/ / /_/ / / / / /_/ / __/
/_/ /_/ /_/\___/ /_____/\____/\__,_/_/ /_/\__, /\___/
2024-11-28 20:14:07 +00:00
/____/
2024-11-28 19:37:29 +00:00
EOF
2024-11-28 16:13:32 +00:00
}
header_info
echo -e "Loading..."
APP="The Lounge"
var_disk="4"
var_cpu="2"
var_ram="2048"
var_os="ubuntu"
var_version="24.04"
variables
color
catch_errors
function default_settings() {
CT_TYPE="1"
PW=""
CT_ID=$NEXTID
HN=$NSAPP
DISK_SIZE="$var_disk"
CORE_COUNT="$var_cpu"
RAM_SIZE="$var_ram"
BRG="vmbr0"
NET="dhcp"
GATE=""
APT_CACHER=""
APT_CACHER_IP=""
DISABLEIP6="no"
MTU=""
SD=""
NS=""
MAC=""
VLAN=""
SSH="no"
VERB="no"
echo_default
}
function update_script() {
header_info
check_container_storage
check_container_resources
2024-11-28 19:37:29 +00:00
if [[ ! -f /usr/lib/systemd/system/thelounge.service ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
2024-11-28 16:13:32 +00:00
RELEASE=$(curl -s https://api.github.com/repos/thelounge/thelounge-deb/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
2024-11-28 20:14:07 +00:00
f [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
msg_info "Stopping Service"
2024-11-28 16:13:32 +00:00
systemctl stop thelounge
2024-11-28 20:14:07 +00:00
msg_ok "Stopped Service"
2024-11-28 16:13:32 +00:00
msg_info "Updating ${APP} to ${RELEASE}"
apt-get install --only-upgrade \
nodejs
cd /opt
wget -q https://github.com/thelounge/thelounge-deb/releases/download/v${RELEASE}/thelounge_${RELEASE}_all.deb
2024-11-28 19:20:23 +00:00
dpkg -i ./thelounge_${RELEASE}_all.deb
2024-11-28 20:14:07 +00:00
msg_ok "Updated ${APP} to v${RELEASE}"
2024-11-28 16:13:32 +00:00
2024-11-28 20:14:07 +00:00
msg_info "Starting Service"
2024-11-28 16:13:32 +00:00
systemctl start thelounge
2024-11-28 20:14:07 +00:00
msg_ok "Started Service"
2024-11-28 16:13:32 +00:00
msg_info "Cleaning up"
rm -rf "/opt/thelounge_${RELEASE}_all.deb"
apt-get -y autoremove
apt-get -y autoclean
msg_ok "Cleaned"
msg_ok "Updated Successfully"
2024-11-28 19:37:29 +00:00
else
2024-11-28 20:14:07 +00:00
msg_ok "No update required. ${APP} is already at v${RELEASE}."
2024-11-28 19:37:29 +00:00
fi
exit
2024-11-28 16:13:32 +00:00
}
start
build_container
description
msg_ok "Completed Successfully!\n"
echo -e "${APP} should be reachable by going to the following URL.
${BL}http://${IP}:9000${CL} \n"