From ef27851d31944d10995b3cf75f508c2dfbbf11b6 Mon Sep 17 00:00:00 2001 From: tteckster Date: Wed, 3 Jul 2024 09:06:30 -0400 Subject: [PATCH] Update bunkerweb.sh tweak `function update_script()` --- ct/bunkerweb.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/ct/bunkerweb.sh b/ct/bunkerweb.sh index 701d6d83..3873484f 100644 --- a/ct/bunkerweb.sh +++ b/ct/bunkerweb.sh @@ -55,10 +55,18 @@ function default_settings() { function update_script() { header_info if [[ ! -d /etc/bunkerweb ]]; then msg_error "No ${APP} Installation Found!"; exit; fi -msg_info "Updating $APP" -apt-get update &>/dev/null -apt-get -y upgrade &>/dev/null -msg_ok "Updated $APP" +RELEASE=$(curl -s https://api.github.com/repos/bunkerity/bunkerweb/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 + + msg_info "Updating ${APP} to ${RELEASE}" + apt-get install nginx -y + apt-get install -y bunkerweb=${RELEASE} + echo "${RELEASE}" >/opt/${APP}_version.txt + msg_ok "Updated ${APP} to ${RELEASE}" + +else + msg_ok "No update required. ${APP} is already at ${RELEASE}" +fi exit }