mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-07-10 07:57:37 +00:00
Refactor (#5874)
This commit is contained in:
15
ct/glance.sh
15
ct/glance.sh
@ -28,28 +28,19 @@ function update_script() {
|
|||||||
msg_error "No ${APP} Installation Found!"
|
msg_error "No ${APP} Installation Found!"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
RELEASE=$(curl -fsSL https://api.github.com/repos/glanceapp/glance/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
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"
|
msg_info "Stopping Service"
|
||||||
systemctl stop glance
|
systemctl stop glance
|
||||||
msg_ok "Stopped Service"
|
msg_ok "Stopped Service"
|
||||||
|
|
||||||
msg_info "Updating ${APP} to v${RELEASE}"
|
rm -f /opt/glance/glance
|
||||||
cd /opt
|
fetch_and_deploy_gh_release "glance" "glanceapp/glance" "prebuild" "latest" "/opt/glance" "glance-linux-amd64.tar.gz"
|
||||||
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}"
|
|
||||||
|
|
||||||
msg_info "Starting Service"
|
msg_info "Starting Service"
|
||||||
systemctl start glance
|
systemctl start glance
|
||||||
msg_ok "Started Service"
|
msg_ok "Started Service"
|
||||||
|
|
||||||
msg_info "Cleaning up"
|
|
||||||
rm -rf /opt/glance-linux-amd64.tar.gz
|
|
||||||
msg_ok "Cleaned"
|
|
||||||
msg_ok "Updated Successfully"
|
msg_ok "Updated Successfully"
|
||||||
else
|
else
|
||||||
msg_ok "No update required. ${APP} is already at v${RELEASE}."
|
msg_ok "No update required. ${APP} is already at v${RELEASE}."
|
||||||
|
@ -13,12 +13,9 @@ setting_up_container
|
|||||||
network_check
|
network_check
|
||||||
update_os
|
update_os
|
||||||
|
|
||||||
msg_info "Installing Glance"
|
fetch_and_deploy_gh_release "glance" "glanceapp/glance" "prebuild" "latest" "/opt/glance" "glance-linux-amd64.tar.gz"
|
||||||
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
|
msg_info "Configuring Glance"
|
||||||
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
|
|
||||||
cat <<EOF >/opt/glance/glance.yml
|
cat <<EOF >/opt/glance/glance.yml
|
||||||
pages:
|
pages:
|
||||||
- name: Startpage
|
- name: Startpage
|
||||||
@ -39,9 +36,7 @@ pages:
|
|||||||
- title: Helper Scripts
|
- title: Helper Scripts
|
||||||
url: https://github.com/community-scripts/ProxmoxVE
|
url: https://github.com/community-scripts/ProxmoxVE
|
||||||
EOF
|
EOF
|
||||||
|
msg_ok "Configured Glance"
|
||||||
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
|
|
||||||
msg_ok "Installed Glance"
|
|
||||||
|
|
||||||
msg_info "Creating Service"
|
msg_info "Creating Service"
|
||||||
service_path="/etc/systemd/system/glance.service"
|
service_path="/etc/systemd/system/glance.service"
|
||||||
@ -67,7 +62,6 @@ motd_ssh
|
|||||||
customize
|
customize
|
||||||
|
|
||||||
msg_info "Cleaning up"
|
msg_info "Cleaning up"
|
||||||
rm -rf /opt/glance-linux-amd64.tar.gz
|
|
||||||
$STD apt-get -y autoremove
|
$STD apt-get -y autoremove
|
||||||
$STD apt-get -y autoclean
|
$STD apt-get -y autoclean
|
||||||
msg_ok "Cleaned"
|
msg_ok "Cleaned"
|
||||||
|
Reference in New Issue
Block a user