From dbe2c553fe340c61ec21a691bae9679425b650de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Slavi=C5=A1a=20Are=C5=BEina?= <58952836+tremor021@users.noreply.github.com> Date: Sun, 4 Jan 2026 20:50:43 +0100 Subject: [PATCH] Refactor (#10517) --- ct/pelican-wings.sh | 13 +++---------- install/pelican-wings-install.sh | 11 +++-------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/ct/pelican-wings.sh b/ct/pelican-wings.sh index 2e1df598e..1f42dc912 100644 --- a/ct/pelican-wings.sh +++ b/ct/pelican-wings.sh @@ -27,25 +27,18 @@ function update_script() { msg_error "No ${APP} Installation Found!" exit fi - RELEASE=$(curl -fsSL https://api.github.com/repos/pelican-dev/wings/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 check_for_gh_release "wings" "pelican-dev/wings"; then msg_info "Stopping Service" systemctl stop wings msg_ok "Stopped Service" - msg_info "Updating ${APP} to v${RELEASE}" - rm /usr/local/bin/wings - curl -fsSL "https://github.com/pelican-dev/wings/releases/download/v${RELEASE}/wings_linux_amd64" -o "/usr/local/bin/wings" - chmod u+x /usr/local/bin/wings - echo "${RELEASE}" >/opt/${APP}_version.txt - msg_ok "Updated $APP to v${RELEASE}" + fetch_and_deploy_gh_release "wings" "pelican-dev/wings" "singlefile" "latest" "/usr/local/bin" "wings_linux_amd64" msg_info "Starting Service" systemctl start wings msg_ok "Started Service" msg_ok "Updated successfully!" - else - msg_ok "No update required. ${APP} is already at v${RELEASE}" fi exit } diff --git a/install/pelican-wings-install.sh b/install/pelican-wings-install.sh index cb848381a..797f130c5 100644 --- a/install/pelican-wings-install.sh +++ b/install/pelican-wings-install.sh @@ -15,19 +15,14 @@ update_os msg_info "Installing Docker" DOCKER_CONFIG_PATH='/etc/docker/daemon.json' -mkdir -p $(dirname $DOCKER_CONFIG_PATH) -echo -e '{\n "log-driver": "journald"\n}' >/etc/docker/daemon.json +mkdir -p "$(dirname $DOCKER_CONFIG_PATH)" +echo -e '{\n "log-driver": "journald"\n}' >"$DOCKER_CONFIG_PATH" $STD sh <(curl -fsSL https://get.docker.com) systemctl enable -q --now docker msg_ok "Installed Docker" -msg_info "Installing Pelican Wings" -RELEASE=$(curl -fsSL https://api.github.com/repos/pelican-dev/wings/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') -curl -fsSL "https://github.com/pelican-dev/wings/releases/download/v${RELEASE}/wings_linux_amd64" -o "/usr/local/bin/wings" -chmod u+x /usr/local/bin/wings +fetch_and_deploy_gh_release "wings" "pelican-dev/wings" "singlefile" "latest" "/usr/local/bin" "wings_linux_amd64" mkdir -p /etc/pelican /var/run/wings -echo "${RELEASE}" >/opt/${APPLICATION}_version.txt -msg_ok "Installed Pelican Wings" msg_info "Creating Service" cat </etc/systemd/system/wings.service