Update proxmox_update.sh

This commit is contained in:
MacRimi 2025-08-07 18:08:37 +02:00
parent 97994f7632
commit fe86396b21

View File

@ -53,84 +53,79 @@ apt_upgrade() {
fi fi
if [[ "$pve_version" -ge 9 ]]; then if [[ "$pve_version" -ge 9 ]]; then
show_proxmenux_logo
msg_title "$(translate "Proxmox system update")"
bash <(curl -fsSL "$REPO_URL/scripts/global/update-pve.sh") bash <(curl -fsSL "$REPO_URL/scripts/global/update-pve.sh")
show_proxmenux_logo
msg_title "$(translate "Proxmox system update")"
else
bash <(curl -fsSL "$REPO_URL/scripts/global/update-pve8.sh") else
show_proxmenux_logo show_proxmenux_logo
msg_title "$(translate "Proxmox system update")" msg_title "$(translate "Proxmox system update")"
bash <(curl -fsSL "$REPO_URL/scripts/global/update-pve8.sh")
fi fi
} }
apt_upgrade
check_reboot() {
NECESSARY_REBOOT=0
if [ -f /var/run/reboot-required ]; then
NECESSARY_REBOOT=1
fi
if grep -q "linux-image" "$log_file" 2>/dev/null; then
NECESSARY_REBOOT=1
fi
if [[ "$NECESSARY_REBOOT" -eq 1 ]]; then if [[ "$NECESSARY_REBOOT" -eq 1 ]]; then
if command -v whiptail >/dev/null 2>&1; then if whiptail --title "$(translate "Reboot Required")" \
if whiptail --title "$(translate "Reboot Required")" \ --yesno "$(translate "Some changes require a reboot to take effect. Do you want to restart now?")" 10 60; then
--yesno "$(translate "Some changes require a reboot to take effect. Do you want to restart now?")" 10 60; then
msg_info "$(translate "Removing no longer required packages and purging old cached updates...")"
msg_info "$(translate "Removing no longer required packages and purging old cached updates...")" apt-get -y autoremove >/dev/null 2>&1
apt-get -y autoremove >/dev/null 2>&1 apt-get -y autoclean >/dev/null 2>&1
apt-get -y autoclean >/dev/null 2>&1 msg_ok "$(translate "Cleanup finished")"
msg_ok "$(translate "Cleanup finished")" echo -e
msg_success "$(translate "Press Enter to continue...")"
msg_success "$(translate "Press Enter to continue...")" read -r
read -r
msg_warn "$(translate "Rebooting the system...")"
msg_warn "$(translate "Rebooting the system...")" reboot
reboot
else
msg_info "$(translate "Removing no longer required packages and purging old cached updates...")"
apt-get -y autoremove >/dev/null 2>&1
apt-get -y autoclean >/dev/null 2>&1
msg_ok "$(translate "Cleanup finished")"
msg_info2 "$(translate "You can reboot later manually.")"
msg_success "$(translate "Press Enter to continue...")"
read -r
return 0
fi
else else
# Fallback without whiptail msg_info "$(translate "Removing no longer required packages and purging old cached updates...")"
echo "$(translate "Reboot now? (y/N): ")" apt-get -y autoremove >/dev/null 2>&1
read -r -t 30 response apt-get -y autoclean >/dev/null 2>&1
if [[ "$response" =~ ^[Yy]$ ]]; then msg_ok "$(translate "Cleanup finished")"
msg_info "$(translate "Removing no longer required packages and purging old cached updates...")" echo -e
apt-get -y autoremove >/dev/null 2>&1 msg_info2 "$(translate "You can reboot later manually.")"
apt-get -y autoclean >/dev/null 2>&1 echo -e
msg_ok "$(translate "Cleanup finished")" msg_success "$(translate "Press Enter to continue...")"
read -r
msg_warn "$(translate "Rebooting the system...")" return 0
sleep 3
reboot
else
msg_info "$(translate "Removing no longer required packages and purging old cached updates...")"
apt-get -y autoremove >/dev/null 2>&1
apt-get -y autoclean >/dev/null 2>&1
msg_ok "$(translate "Cleanup finished")"
msg_info2 "$(translate "You can reboot later manually.")"
return 0
fi
fi fi
else else
msg_info "$(translate "Removing no longer required packages and purging old cached updates...")" msg_info "$(translate "Removing no longer required packages and purging old cached updates...")"
apt-get -y autoremove >/dev/null 2>&1 apt-get -y autoremove >/dev/null 2>&1
apt-get -y autoclean >/dev/null 2>&1 apt-get -y autoclean >/dev/null 2>&1
msg_ok "$(translate "Cleanup finished")" msg_ok "$(translate "Cleanup finished")"
msg_success "$(translate "All changes applied. No reboot required.")" msg_ok "$(translate "All changes applied. No reboot required.")"
echo -e
msg_success "$(translate "Press Enter to return to menu...")" msg_success "$(translate "Press Enter to return to menu...")"
read -r read -r
fi fi
} }
apt_upgrade
check_reboot