From 5597f7fc410b9a99da737f77da9bca940144a587 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Slavi=C5=A1a=20Are=C5=BEina?= <58952836+tremor021@users.noreply.github.com> Date: Tue, 29 Jul 2025 14:53:08 +0200 Subject: [PATCH] Refactor (#6343) --- ct/inspircd.sh | 13 +++---------- install/inspircd-install.sh | 11 +++-------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/ct/inspircd.sh b/ct/inspircd.sh index c3f2028512..cecc192ee2 100644 --- a/ct/inspircd.sh +++ b/ct/inspircd.sh @@ -27,26 +27,19 @@ function update_script() { msg_error "No ${APP} Installation Found!" exit fi + RELEASE=$(curl -fsSL https://api.github.com/repos/inspircd/inspircd/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 [[ "${RELEASE}" != "$(cat ~/.inspircd 2>/dev/null)" ]] || [[ ! -f ~/.inspircd ]]; then msg_info "Stopping Service" systemctl stop inspircd msg_ok "Stopped Service" - msg_info "Updating ${APP} to v${RELEASE}" - cd /opt - curl -fsSL "https://github.com/inspircd/inspircd/releases/download/v${RELEASE}/inspircd_${RELEASE}.deb12u2_amd64.deb" -o $(basename "https://github.com/inspircd/inspircd/releases/download/v${RELEASE}/inspircd_${RELEASE}.deb12u2_amd64.deb") - $STD apt-get install "./inspircd_${RELEASE}.deb12u2_amd64.deb" -y - echo "${RELEASE}" >"/opt/${APP}_version.txt" - msg_ok "Updated ${APP} to v${RELEASE}" + fetch_and_deploy_gh_release "inspircd" "inspircd/inspircd" "binary" msg_info "Starting Service" systemctl start inspircd msg_ok "Started Service" - msg_info "Cleaning up" - rm -rf /opt/inspircd_${RELEASE}.deb12u2_amd64.deb - msg_ok "Cleaned" msg_ok "Updated Successfully" else msg_ok "No update required. ${APP} is already at v${RELEASE}." diff --git a/install/inspircd-install.sh b/install/inspircd-install.sh index 77620dcf1f..502f88e586 100644 --- a/install/inspircd-install.sh +++ b/install/inspircd-install.sh @@ -13,11 +13,9 @@ setting_up_container network_check update_os -msg_info "Installing InspIRCd" -RELEASE=$(curl -fsSL https://api.github.com/repos/inspircd/inspircd/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') -cd /opt -curl -fsSL "https://github.com/inspircd/inspircd/releases/download/v${RELEASE}/inspircd_${RELEASE}.deb12u2_amd64.deb" -o "inspircd_${RELEASE}.deb12u2_amd64.deb" -$STD apt-get install "./inspircd_${RELEASE}.deb12u2_amd64.deb" -y &>/dev/null +fetch_and_deploy_gh_release "inspircd" "inspircd/inspircd" "binary" + +msg_info "Configuring InspIRCd" cat </etc/inspircd/inspircd.conf @@ -32,15 +30,12 @@ cat </etc/inspircd/inspircd.conf email="irc@&networkDomain;"> EOF - -echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt" msg_ok "Installed InspIRCd" motd_ssh customize msg_info "Cleaning up" -rm -rf /opt/inspircd_${RELEASE}.deb12u2_amd64.deb $STD apt-get -y autoremove $STD apt-get -y autoclean msg_ok "Cleaned"