Refactor (#6958)
This commit is contained in:
parent
fd85e71fcf
commit
01fe1b1f62
@ -27,33 +27,15 @@ function update_script() {
|
|||||||
msg_error "No ${APP} Installation Found!"
|
msg_error "No ${APP} Installation Found!"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
if ! dpkg -l build-essential >/dev/null 2>&1; then
|
|
||||||
$STD apt-get update
|
|
||||||
$STD apt-get install -y build-essential
|
|
||||||
fi
|
|
||||||
if ! npm list -g node-gyp >/dev/null 2>&1; then
|
|
||||||
$STD npm install -g node-gyp
|
|
||||||
fi
|
|
||||||
RELEASE=$(curl -fsSL https://api.github.com/repos/thelounge/thelounge-deb/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
RELEASE=$(curl -fsSL https://api.github.com/repos/thelounge/thelounge-deb/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||||
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
|
if [[ ! -f ~/.thelounge ]] || [[ "${RELEASE}" != "$(cat ~/.thelounge)" ]]; then
|
||||||
msg_info "Stopping Service"
|
msg_info "Stopping Service"
|
||||||
systemctl stop thelounge
|
systemctl stop thelounge
|
||||||
msg_ok "Stopped Service"
|
msg_ok "Stopped Service"
|
||||||
|
|
||||||
msg_info "Updating ${APP} to v${RELEASE}"
|
fetch_and_deploy_gh_release "thelounge" "thelounge/thelounge-deb" "binary"
|
||||||
$STD apt-get install --only-upgrade nodejs
|
|
||||||
cd /opt
|
|
||||||
curl -fsSL "https://github.com/thelounge/thelounge-deb/releases/download/v${RELEASE}/thelounge_${RELEASE}_all.deb" -o $(basename "https://github.com/thelounge/thelounge-deb/releases/download/v${RELEASE}/thelounge_${RELEASE}_all.deb")
|
|
||||||
dpkg -i ./thelounge_${RELEASE}_all.deb
|
|
||||||
msg_ok "Updated ${APP} to v${RELEASE}"
|
|
||||||
|
|
||||||
msg_info "Starting Service"
|
|
||||||
systemctl start thelounge
|
|
||||||
msg_ok "Started Service"
|
|
||||||
|
|
||||||
msg_info "Cleaning up"
|
|
||||||
rm -rf "/opt/thelounge_${RELEASE}_all.deb"
|
|
||||||
msg_ok "Cleaned"
|
|
||||||
msg_ok "Updated Successfully"
|
msg_ok "Updated Successfully"
|
||||||
else
|
else
|
||||||
msg_ok "No update required. ${APP} is already at v${RELEASE}."
|
msg_ok "No update required. ${APP} is already at v${RELEASE}."
|
||||||
|
@ -13,26 +13,12 @@ setting_up_container
|
|||||||
network_check
|
network_check
|
||||||
update_os
|
update_os
|
||||||
|
|
||||||
msg_info "Installing Dependencies"
|
fetch_and_deploy_gh_release "thelounge" "thelounge/thelounge-deb" "binary"
|
||||||
$STD apt-get install -y \
|
|
||||||
build-essential
|
|
||||||
msg_ok "Installed Dependencies"
|
|
||||||
|
|
||||||
NODE_VERSION="22" NODE_MODULE="yarn@latest,node-gyp" setup_nodejs
|
|
||||||
|
|
||||||
msg_info "Installing The Lounge"
|
|
||||||
cd /opt
|
|
||||||
RELEASE=$(curl -fsSL https://api.github.com/repos/thelounge/thelounge-deb/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
|
||||||
curl -fsSL "https://github.com/thelounge/thelounge-deb/releases/download/v${RELEASE}/thelounge_${RELEASE}_all.deb" -o "./thelounge_${RELEASE}_all.deb"
|
|
||||||
$STD dpkg -i ./thelounge_${RELEASE}_all.deb
|
|
||||||
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
|
|
||||||
msg_ok "Installed The Lounge"
|
|
||||||
|
|
||||||
motd_ssh
|
motd_ssh
|
||||||
customize
|
customize
|
||||||
|
|
||||||
msg_info "Cleaning up"
|
msg_info "Cleaning up"
|
||||||
rm -rf /opt/thelounge_${RELEASE}_all.deb
|
|
||||||
$STD apt-get -y autoremove
|
$STD apt-get -y autoremove
|
||||||
$STD apt-get -y autoclean
|
$STD apt-get -y autoclean
|
||||||
msg_ok "Cleaned"
|
msg_ok "Cleaned"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user