Update glances.sh

This commit is contained in:
CanbiZ 2025-08-19 12:44:16 +02:00
parent 28441cbcd5
commit e193748657

View File

@ -15,7 +15,6 @@ hostname="$(hostname)"
header_info "$APP" header_info "$APP"
catch_errors catch_errors
# install on Debian/Ubuntu
install_glances_debian() { install_glances_debian() {
msg_info "Installing dependencies" msg_info "Installing dependencies"
$STD apt-get update $STD apt-get update
@ -58,6 +57,21 @@ EOF
echo -e "\n$APP is now running at: http://$IP:61208\n" echo -e "\n$APP is now running at: http://$IP:61208\n"
} }
# update on Debian/Ubuntu
update_glances_debian() {
if [[ ! -d /opt/glances/.venv ]]; then
msg_error "$APP is not installed"
exit 1
fi
msg_info "Updating $APP"
cd /opt/glances
source .venv/bin/activate
uv pip install --upgrade "glances[web]"
deactivate
systemctl restart glances
msg_ok "Updated $APP"
}
# uninstall on Debian/Ubuntu # uninstall on Debian/Ubuntu
uninstall_glances_debian() { uninstall_glances_debian() {
msg_info "Uninstalling $APP" msg_info "Uninstalling $APP"
@ -107,6 +121,21 @@ EOF
echo -e "\n$APP is now running at: http://$IP:61208\n" echo -e "\n$APP is now running at: http://$IP:61208\n"
} }
# update on Alpine
update_glances_alpine() {
if [[ ! -d /opt/glances/.venv ]]; then
msg_error "$APP is not installed"
exit 1
fi
msg_info "Updating $APP"
cd /opt/glances
source .venv/bin/activate
uv pip install --upgrade "glances[web]"
deactivate
rc-service glances restart
msg_ok "Updated $APP"
}
# uninstall on Alpine # uninstall on Alpine
uninstall_glances_alpine() { uninstall_glances_alpine() {
msg_info "Uninstalling $APP" msg_info "Uninstalling $APP"
@ -119,21 +148,24 @@ uninstall_glances_alpine() {
# options menu # options menu
OPTIONS=(Install "Install $APP" OPTIONS=(Install "Install $APP"
Update "Update $APP"
Uninstall "Uninstall $APP") Uninstall "Uninstall $APP")
CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "$APP" --menu "Select an option:" 10 58 2 \ CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "$APP" --menu "Select an option:" 12 58 3 \
"${OPTIONS[@]}" 3>&1 1>&2 2>&3 || true) "${OPTIONS[@]}" 3>&1 1>&2 2>&3 || true)
# OS detection # OS detection
if grep -qi "alpine" /etc/os-release; then if grep -qi "alpine" /etc/os-release; then
case "$CHOICE" in case "$CHOICE" in
Install) install_glances_alpine ;; Install) install_glances_alpine ;;
Update) update_glances_alpine ;;
Uninstall) uninstall_glances_alpine ;; Uninstall) uninstall_glances_alpine ;;
*) exit 0 ;; *) exit 0 ;;
esac esac
else else
case "$CHOICE" in case "$CHOICE" in
Install) install_glances_debian ;; Install) install_glances_debian ;;
Update) update_glances_debian ;;
Uninstall) uninstall_glances_debian ;; Uninstall) uninstall_glances_debian ;;
*) exit 0 ;; *) exit 0 ;;
esac esac