diff --git a/ct/glance.sh b/ct/glance.sh index eb237c82d..41bb6f5a6 100644 --- a/ct/glance.sh +++ b/ct/glance.sh @@ -28,28 +28,19 @@ function update_script() { msg_error "No ${APP} Installation Found!" exit fi - RELEASE=$(curl -fsSL https://api.github.com/repos/glanceapp/glance/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 ~/.glance 2>/dev/null)" ]] || [[ ! -f ~/.glance ]]; then msg_info "Stopping Service" systemctl stop glance msg_ok "Stopped Service" - msg_info "Updating ${APP} to v${RELEASE}" - cd /opt - curl -fsSL "https://github.com/glanceapp/glance/releases/download/v${RELEASE}/glance-linux-amd64.tar.gz" -o $(basename "https://github.com/glanceapp/glance/releases/download/v${RELEASE}/glance-linux-amd64.tar.gz") - rm -rf /opt/glance/glance - tar -xzf glance-linux-amd64.tar.gz -C /opt/glance - echo "${RELEASE}" >"/opt/${APP}_version.txt" - msg_ok "Updated ${APP} to v${RELEASE}" + rm -f /opt/glance/glance + fetch_and_deploy_gh_release "glance" "glanceapp/glance" "prebuild" "latest" "/opt/glance" "glance-linux-amd64.tar.gz" msg_info "Starting Service" systemctl start glance msg_ok "Started Service" - msg_info "Cleaning up" - rm -rf /opt/glance-linux-amd64.tar.gz - msg_ok "Cleaned" msg_ok "Updated Successfully" else msg_ok "No update required. ${APP} is already at v${RELEASE}." diff --git a/install/glance-install.sh b/install/glance-install.sh index 84f65908c..23850e784 100644 --- a/install/glance-install.sh +++ b/install/glance-install.sh @@ -13,12 +13,9 @@ setting_up_container network_check update_os -msg_info "Installing Glance" -RELEASE=$(curl -fsSL https://api.github.com/repos/glanceapp/glance/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') -cd /opt -curl -fsSL "https://github.com/glanceapp/glance/releases/download/v${RELEASE}/glance-linux-amd64.tar.gz" -o "glance-linux-amd64.tar.gz" -mkdir -p /opt/glance -tar -xzf glance-linux-amd64.tar.gz -C /opt/glance +fetch_and_deploy_gh_release "glance" "glanceapp/glance" "prebuild" "latest" "/opt/glance" "glance-linux-amd64.tar.gz" + +msg_info "Configuring Glance" cat </opt/glance/glance.yml pages: - name: Startpage @@ -39,9 +36,7 @@ pages: - title: Helper Scripts url: https://github.com/community-scripts/ProxmoxVE EOF - -echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt" -msg_ok "Installed Glance" +msg_ok "Configured Glance" msg_info "Creating Service" service_path="/etc/systemd/system/glance.service" @@ -67,7 +62,6 @@ motd_ssh customize msg_info "Cleaning up" -rm -rf /opt/glance-linux-amd64.tar.gz $STD apt-get -y autoremove $STD apt-get -y autoclean msg_ok "Cleaned"