mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-11-03 20:14:31 +01:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a5e2a50cd6 |
@@ -5,7 +5,7 @@
|
||||
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
|
||||
function header_info() {
|
||||
clear
|
||||
clear 2>/dev/null || printf '\033[H\033[2J\033[3J'
|
||||
cat <<"EOF"
|
||||
________ __ _ ________
|
||||
/ ____/ /__ ____ _____ / / | |/ / ____/
|
||||
|
||||
@@ -19,7 +19,7 @@ CONF_FILE="/etc/update-lxcs.conf"
|
||||
LOG_FILE="/var/log/update-lxcs-cron.log"
|
||||
CRON_ENTRY="0 0 * * 0 ${LOCAL_SCRIPT} >>${LOG_FILE} 2>&1"
|
||||
|
||||
clear
|
||||
clear 2>/dev/null || printf '\033[H\033[2J\033[3J'
|
||||
cat <<"EOF"
|
||||
______ __ __ __ __ __ _ ________
|
||||
/ ____/________ ____ / / / /___ ____/ /___ _/ /____ / / | |/ / ____/____
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
|
||||
function header_info() {
|
||||
clear
|
||||
clear 2>/dev/null || printf '\033[H\033[2J\033[3J'
|
||||
cat <<"EOF"
|
||||
______ __ __ _ ________
|
||||
/ ____/ _____ _______ __/ /____ / / | |/ / ____/
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
set -eEuo pipefail
|
||||
|
||||
function header_info() {
|
||||
clear
|
||||
clear 2>/dev/null || printf '\033[H\033[2J\033[3J'
|
||||
cat <<"EOF"
|
||||
_______ __ __ ______ _
|
||||
/ ____(_) /__ _______ _______/ /____ ____ ___ /_ __/____(_)___ ___
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
|
||||
function header_info {
|
||||
clear
|
||||
clear 2>/dev/null || printf '\033[H\033[2J\033[3J'
|
||||
cat <<"EOF"
|
||||
____ ______ __ ____ __ __
|
||||
/ __ \_________ _ ______ ___ ____ _ __ / ____/_ _____ _____/ /_ / __ \___ / /__ / /____
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
set -e
|
||||
function header_info {
|
||||
clear
|
||||
clear 2>/dev/null || printf '\033[H\033[2J\033[3J'
|
||||
cat <<"EOF"
|
||||
|
||||
__ ___ __ ___ __ __ _
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
|
||||
header_info() {
|
||||
clear
|
||||
clear 2>/dev/null || printf '\033[H\033[2J\033[3J'
|
||||
cat <<"EOF"
|
||||
____ ____ __________ __ ______ __________ ___ ____ ______
|
||||
/ __ \/ __ ) ___/__ / / / / / __ \/ ____/ __ \/ | / __ \/ ____/
|
||||
@@ -168,7 +168,7 @@ while true; do
|
||||
case $yn in
|
||||
[Yy]*) break ;;
|
||||
[Nn]*)
|
||||
clear
|
||||
clear 2>/dev/null || printf '\033[H\033[2J\033[3J'
|
||||
exit
|
||||
;;
|
||||
*) echo "Please answer yes or no." ;;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
|
||||
header_info() {
|
||||
clear
|
||||
clear 2>/dev/null || printf '\033[H\033[2J\033[3J'
|
||||
cat <<"EOF"
|
||||
____ ____ _____ __ __ __ __ __
|
||||
/ __ \/ __ ) ___// // / / / / /___ ____ __________ _____/ /__
|
||||
@@ -192,7 +192,7 @@ while true; do
|
||||
case $yn in
|
||||
[Yy]*) break ;;
|
||||
[Nn]*)
|
||||
clear
|
||||
clear 2>/dev/null || printf '\033[H\033[2J\033[3J'
|
||||
exit
|
||||
;;
|
||||
*) echo "Please answer yes or no." ;;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
|
||||
header_info() {
|
||||
clear
|
||||
clear 2>/dev/null || printf '\033[H\033[2J\033[3J'
|
||||
cat <<"EOF"
|
||||
____ ____ _____ ____ __ ____ __ ____
|
||||
/ __ \/ __ ) ___/ / __ \____ _____/ /_ / _/___ _____/ /_____ _/ / /
|
||||
@@ -89,7 +89,7 @@ main() {
|
||||
case $yn in
|
||||
[Yy]*) break ;;
|
||||
[Nn]*)
|
||||
clear
|
||||
clear 2>/dev/null || printf '\033[H\033[2J\033[3J'
|
||||
exit
|
||||
;;
|
||||
*) echo "Please answer yes or no." ;;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
|
||||
header_info() {
|
||||
clear
|
||||
clear 2>/dev/null || printf '\033[H\033[2J\033[3J'
|
||||
cat <<"EOF"
|
||||
____ ____ __ ___ ____ __ ____ __ ____
|
||||
/ __ \/ __ \/ |/ / / __ \____ _____/ /_ / _/___ _____/ /_____ _/ / /
|
||||
@@ -412,7 +412,7 @@ while true; do
|
||||
case $yn in
|
||||
[Yy]*) break ;;
|
||||
[Nn]*)
|
||||
clear
|
||||
clear 2>/dev/null || printf '\033[H\033[2J\033[3J'
|
||||
exit
|
||||
;;
|
||||
*) echo "Please answer yes or no." ;;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
|
||||
header_info() {
|
||||
clear
|
||||
clear 2>/dev/null || printf '\033[H\033[2J\033[3J'
|
||||
cat <<"EOF"
|
||||
____ __ _________ ____ __ ____ __ ____
|
||||
/ __ \/ |/ / ____/ / __ \____ _____/ /_ / _/___ _____/ /_____ _/ / /
|
||||
@@ -410,7 +410,7 @@ while true; do
|
||||
case $yn in
|
||||
[Yy]*) break ;;
|
||||
[Nn]*)
|
||||
clear
|
||||
clear 2>/dev/null || printf '\033[H\033[2J\033[3J'
|
||||
exit
|
||||
;;
|
||||
*) echo "Please answer yes or no." ;;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
|
||||
header_info() {
|
||||
clear
|
||||
clear 2>/dev/null || printf '\033[H\033[2J\033[3J'
|
||||
cat <<"EOF"
|
||||
____ _ ________ ____ __ ____ __ ____
|
||||
/ __ \ | / / ____/ / __ \____ _____/ /_ / _/___ _____/ /_____ _/ / /
|
||||
@@ -81,7 +81,7 @@ main() {
|
||||
case $yn in
|
||||
[Yy]*) break ;;
|
||||
[Nn]*)
|
||||
clear
|
||||
clear 2>/dev/null || printf '\033[H\033[2J\033[3J'
|
||||
exit
|
||||
;;
|
||||
*) echo "Please answer yes or no." ;;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
|
||||
header_info() {
|
||||
clear
|
||||
clear 2>/dev/null || printf '\033[H\033[2J\033[3J'
|
||||
cat <<"EOF"
|
||||
____ _ ____________ __ ______ __________ ___ ____ ______
|
||||
/ __ \ | / / ____( __ ) / / / / __ \/ ____/ __ \/ | / __ \/ ____/
|
||||
@@ -118,7 +118,7 @@ while true; do
|
||||
case $yn in
|
||||
[Yy]*) break ;;
|
||||
[Nn]*)
|
||||
clear
|
||||
clear 2>/dev/null || printf '\033[H\033[2J\033[3J'
|
||||
exit
|
||||
;;
|
||||
*) echo "Please answer yes or no." ;;
|
||||
|
||||
@@ -11,7 +11,7 @@ source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent
|
||||
declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "scaling-governor" "pve"
|
||||
|
||||
header_info() {
|
||||
clear
|
||||
clear 2>/dev/null || printf '\033[H\033[2J\033[3J'
|
||||
cat <<EOF
|
||||
________ __ __ _____
|
||||
/ ___/ _ \/ / / / / ___/__ _ _____ _______ ___ _______
|
||||
@@ -26,7 +26,7 @@ GOV_BASE="/sys/devices/system/cpu/cpu0/cpufreq"
|
||||
if [[ ! -r "$GOV_BASE/scaling_governor" || ! -r "$GOV_BASE/scaling_available_governors" ]]; then
|
||||
whiptail --backtitle "Proxmox VE Helper Scripts" --title "CPU Scaling Not Available" \
|
||||
--msgbox "CPU frequency scaling is not available on this system.\n\nThis is normal when no cpufreq driver is active (e.g. CPU power management handled by the BIOS, or certain virtualized hosts)." 12 70
|
||||
clear
|
||||
clear 2>/dev/null || printf '\033[H\033[2J\033[3J'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@@ -42,7 +42,7 @@ done < <(tr ' ' '\n' <"$GOV_BASE/scaling_available_governors" | sed '/^$/d' | gr
|
||||
scaling_governor=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Current CPU Scaling Governor is set to $current_governor" --radiolist "\nSelect the Scaling Governor to use:\n" 16 $((MSG_MAX_LENGTH + 58)) 6 "${GOVERNORS_MENU[@]}" 3>&1 1>&2 2>&3 | tr -d '"')
|
||||
[ -z "$scaling_governor" ] && {
|
||||
whiptail --backtitle "Proxmox VE Helper Scripts" --title "No CPU Scaling Governor Selected" --msgbox "It appears that no CPU Scaling Governor was selected" 10 68
|
||||
clear
|
||||
clear 2>/dev/null || printf '\033[H\033[2J\033[3J'
|
||||
exit
|
||||
}
|
||||
echo "${scaling_governor}" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor >/dev/null
|
||||
|
||||
@@ -11,7 +11,7 @@ declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "storage-share
|
||||
set -eEuo pipefail
|
||||
|
||||
function header_info() {
|
||||
clear
|
||||
clear 2>/dev/null || printf '\033[H\033[2J\033[3J'
|
||||
cat <<"EOF"
|
||||
_____ __ ___ _________
|
||||
/ ___// /_____ _________ _____ ____ / | / _/ __ \
|
||||
|
||||
+13
-20
@@ -271,22 +271,15 @@ function dry_run_container() {
|
||||
fi
|
||||
}
|
||||
|
||||
# The line of vzdump or pct restore output that says why it failed.
|
||||
function failure_reason() {
|
||||
local reason
|
||||
reason=$(grep -m1 '^ERROR:' <<<"$1" | sed 's/^ERROR: //')
|
||||
[[ -n "$reason" ]] || reason=$(grep -v '^[[:space:]]*$' <<<"$1" | tail -n1)
|
||||
printf '%s' "$reason"
|
||||
}
|
||||
|
||||
function backup_container() {
|
||||
msg_info "Creating backup for container $1"
|
||||
local output
|
||||
if output=$(vzdump $1 --compress zstd --storage $STORAGE_CHOICE -notes-template "{{guestname}} - community-scripts backup updater" 2>&1); then
|
||||
vzdump $1 --compress zstd --storage $STORAGE_CHOICE -notes-template "{{guestname}} - community-scripts backup updater" >/dev/null 2>&1
|
||||
status=$?
|
||||
|
||||
if [ $status -eq 0 ]; then
|
||||
msg_ok "Backup created"
|
||||
else
|
||||
log_write "Container $1: vzdump failed:"$'\n'"$output"
|
||||
msg_error "Backup failed for container $1: $(failure_reason "$output")"
|
||||
msg_error "Backup failed for container $1"
|
||||
exit 235
|
||||
fi
|
||||
}
|
||||
@@ -344,7 +337,7 @@ function log_write() {
|
||||
|
||||
# Skip confirmation if var_skip_confirm is set to yes
|
||||
if [[ "$var_skip_confirm" != "yes" ]]; then
|
||||
whiptail --backtitle "Proxmox VE Helper Scripts" --title "LXC App Update" --yesno "This will update apps in LXCs installed by Helper-Scripts. Proceed?" 10 58 || exit 0
|
||||
whiptail --backtitle "Proxmox VE Helper Scripts" --title "LXC App Update" --yesno "This will update apps in LXCs installed by Helper-Scripts. Proceed?" 10 58 || exit
|
||||
fi
|
||||
|
||||
tags_formatted="${var_tags//|/, }"
|
||||
@@ -467,11 +460,12 @@ if [ "$BACKUP_CHOICE" == "yes" ]; then
|
||||
# Determine storage based on var_backup_storage
|
||||
if [[ -n "$var_backup_storage" ]]; then
|
||||
# Validate that the specified storage exists and supports backups
|
||||
if grep -qxF -- "$var_backup_storage" <<<"$STORAGES"; then
|
||||
if echo "$STORAGES" | grep -qw "$var_backup_storage"; then
|
||||
STORAGE_CHOICE="$var_backup_storage"
|
||||
msg_ok "Using backup storage: $STORAGE_CHOICE"
|
||||
else
|
||||
msg_error "Specified backup storage '$var_backup_storage' not found or doesn't support backups! Available: $(echo $STORAGES)"
|
||||
msg_error "Specified backup storage '$var_backup_storage' not found or doesn't support backups!"
|
||||
msg_info "Available storages: $(echo $STORAGES | tr '\n' ' ')"
|
||||
exit 119
|
||||
fi
|
||||
else
|
||||
@@ -648,7 +642,7 @@ for container in $CHOICE; do
|
||||
log_result "$container" "$service" "SKIPPED" "Storage critically low on /boot (>80%)"
|
||||
log_write "Container $container ($service): SKIPPED — storage critically low on /boot"
|
||||
elif [ "$BACKUP_CHOICE" == "yes" ]; then
|
||||
msg_error "Update failed for container $container ($service, exit code: $exit_code) — attempting restore"
|
||||
msg_error "Update failed for container $container (exit code: $exit_code) — attempting restore"
|
||||
log_write "Container $container ($service): FAILED (exit $exit_code) — attempting restore"
|
||||
msg_info "Restoring LXC $container from backup ($STORAGE_CHOICE)"
|
||||
pct stop $container
|
||||
@@ -660,7 +654,7 @@ for container in $CHOICE; do
|
||||
log_write "Container $container ($service): FAILED — no backup found for restore"
|
||||
exit 235
|
||||
fi
|
||||
restore_output=$(pct restore $container "$BACKUP_ENTRY" --storage $LXC_STORAGE --force 2>&1)
|
||||
pct restore $container "$BACKUP_ENTRY" --storage $LXC_STORAGE --force >/dev/null 2>&1
|
||||
restorestatus=$?
|
||||
if [ $restorestatus -eq 0 ]; then
|
||||
pct start $container
|
||||
@@ -668,14 +662,13 @@ for container in $CHOICE; do
|
||||
log_result "$container" "$service" "RESTORED" "Update failed (exit $exit_code) — restored from backup"
|
||||
log_write "Container $container ($service): RESTORED from $BACKUP_ENTRY"
|
||||
else
|
||||
log_write "Container $container: pct restore failed:"$'\n'"$restore_output"
|
||||
msg_error "Restore failed for container $container: $(failure_reason "$restore_output")"
|
||||
msg_error "Restore failed for container $container"
|
||||
log_result "$container" "$service" "FAILED" "Update failed (exit $exit_code) — restore also failed"
|
||||
log_write "Container $container ($service): FAILED — restore also failed"
|
||||
exit 235
|
||||
fi
|
||||
else
|
||||
msg_error "Update failed for container $container ($service, exit code: $exit_code)"
|
||||
msg_error "Update failed for container $container (exit code: $exit_code)"
|
||||
log_result "$container" "$service" "FAILED" "Exit code $exit_code"
|
||||
log_write "Container $container ($service): FAILED (exit $exit_code)"
|
||||
if [[ "$var_continue_on_error" == "yes" ]]; then
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
|
||||
function header_info() {
|
||||
clear
|
||||
clear 2>/dev/null || printf '\033[H\033[2J\033[3J'
|
||||
cat <<"EOF"
|
||||
__ __ __ __ __ _ ________
|
||||
/ / / /___ ____/ /___ _/ /____ / / | |/ / ____/
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
|
||||
function header_info {
|
||||
clear
|
||||
clear 2>/dev/null || printf '\033[H\033[2J\033[3J'
|
||||
cat <<"EOF"
|
||||
__ __ __ __ ____
|
||||
/ / / /___ ____/ /___ _/ /____ / __ \___ ____ ____
|
||||
|
||||
Reference in New Issue
Block a user