1+ #! /usr/bin/env bash
2+ source <( curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+ # Copyright (c) 2021-2024 community-scripts ORG
4+ # Author: kristocopani
5+ # License: MIT
6+ # https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
7+
8+ function header_info {
9+ clear
10+ cat << "EOF "
11+ ________
12+ / ____/ /___ _____ ________
13+ / / __/ / __ `/ __ \/ ___/ _ \
14+ / /_/ / / /_/ / / / / /__/ __/
15+ \____/_/\__,_/_/ /_/\___/\___/
16+
17+ EOF
18+ }
19+ header_info
20+ echo -e " Loading..."
21+ APP=" Glance"
22+ var_disk=" 2"
23+ var_cpu=" 1"
24+ var_ram=" 512"
25+ var_os=" debian"
26+ var_version=" 12"
27+ variables
28+ color
29+ catch_errors
30+
31+ function default_settings() {
32+ CT_TYPE=" 1"
33+ PW=" "
34+ CT_ID=$NEXTID
35+ HN=$NSAPP
36+ DISK_SIZE=" $var_disk "
37+ CORE_COUNT=" $var_cpu "
38+ RAM_SIZE=" $var_ram "
39+ BRG=" vmbr0"
40+ NET=" dhcp"
41+ GATE=" "
42+ APT_CACHER=" "
43+ APT_CACHER_IP=" "
44+ DISABLEIP6=" no"
45+ MTU=" "
46+ SD=" "
47+ NS=" "
48+ MAC=" "
49+ VLAN=" "
50+ SSH=" no"
51+ VERB=" no"
52+ echo_default
53+ }
54+
55+ function update_script() {
56+ header_info
57+ check_container_storage
58+ check_container_resources
59+
60+ if [[ ! -f /etc/systemd/system/glance.service ]]; then
61+ msg_error " No ${APP} Installation Found!"
62+ exit
63+ fi
64+
65+ RELEASE=$( curl -s https://api.github.com/repos/glanceapp/glance/releases/latest | grep " tag_name" | awk ' {print substr($2, 3, length($2)-4) }' )
66+ if [[ ! -f /opt/${APP} _version.txt ]] || [[ " ${RELEASE} " != " $( cat /opt/${APP} _version.txt) " ]]; then
67+ msg_info " Stopping Service"
68+ systemctl stop glance
69+ msg_ok " Stopped Service"
70+
71+ msg_info " Updating ${APP} to v${RELEASE} "
72+ cd /opt
73+ wget -q https://github.com/glanceapp/glance/releases/download/v${RELEASE} /glance-linux-amd64.tar.gz
74+ rm -rf /opt/glance/glance
75+ tar -xzf glance-linux-amd64.tar.gz -C /opt/glance
76+ echo " ${RELEASE} " > " /opt/${APP} _version.txt"
77+ msg_ok " Updated ${APP} to v${RELEASE} "
78+
79+ msg_info " Starting Service"
80+ systemctl start glance
81+ msg_ok " Started Service"
82+
83+ msg_info " Cleaning up"
84+ rm -rf /opt/glance-linux-amd64.tar.gz
85+ msg_ok " Cleaned"
86+ msg_ok " Updated Successfully"
87+ else
88+ msg_ok " No update required. ${APP} is already at v${RELEASE} ."
89+ fi
90+ exit
91+ }
92+
93+ start
94+ build_container
95+ description
96+
97+ msg_ok " Completed Successfully!\n"
98+ echo -e " ${APP} should be reachable by going to the following URL.
99+ ${BL} http://${IP} :8080${CL} \n"
0 commit comments