Update bunkerweb.sh

tweak `function update_script()`
This commit is contained in:
tteckster 2024-07-03 09:06:30 -04:00 committed by GitHub
parent 5fcae037c2
commit ef27851d31
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 4 deletions

View File

@ -55,10 +55,18 @@ function default_settings() {
function update_script() { function update_script() {
header_info header_info
if [[ ! -d /etc/bunkerweb ]]; then msg_error "No ${APP} Installation Found!"; exit; fi if [[ ! -d /etc/bunkerweb ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
msg_info "Updating $APP" RELEASE=$(curl -s https://api.github.com/repos/bunkerity/bunkerweb/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
apt-get update &>/dev/null if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
apt-get -y upgrade &>/dev/null
msg_ok "Updated $APP" 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 exit
} }