mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-09-29 18:16:43 +00:00
feat(oci): run official container images as native LXC containers
Adds the OCI manager: an engine that turns a Docker Compose file into an LXC definition, a catalog of 365 applications drawn from LinuxServer.io and other container image sources, and a per-instance registry recording what each container was built from. Reachable from the main menu. Catalog text is translated like every other string in the project: the taglines go through translate() and land in lang/*.json, so the entries read in all eight languages instead of only English. Translation cache builder: - a failed translation leaves the key absent rather than writing English, which previously made the string count as translated forever - a result identical to a 3+ word source is rejected, catching a provider that silently returns the text it was given - strings that are nothing but glossary terms keep their source spelling instead of being discarded as failures - no backoff between attempts when the provider is deterministic - application names are protected so "HAOS One" survives translation - argos joins the provider list, and the workflow reads the OCI sources Audit & Report: - findings that moved in the wrong direction between runs are reported alongside the ones that improved - an accepted risk can carry a review date and is flagged when it falls due - backup checks explain in plain language what they looked at and what to do next Monitor: - disks can be excluded from periodic reads, and an idle disk says so instead of showing a stale temperature - per-disk identity survives a controller or enclosure change - scheduled Borg backups resolve their SSH key from the repository entry - PVE upgrades log the package list and the resulting dpkg changes The web build no longer copies scripts/ into public/: the documentation links to GitHub, so nothing read that folder. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -50,7 +50,7 @@ fi
|
||||
root_fs="$(findmnt -no FSTYPE / 2>/dev/null || echo ext4)"
|
||||
|
||||
# ── CPU model / arch ──
|
||||
cpu_model="$(lscpu 2>/dev/null | awk -F: '/^Model name/{sub(/^[ \t]+/, "", $2); print $2; exit}')"
|
||||
cpu_model="$(LC_ALL=C lscpu 2>/dev/null | awk -F: '/^Model name/{sub(/^[ \t]+/, "", $2); print $2; exit}')"
|
||||
cpu_arch="$(uname -m)"
|
||||
# Normalize to schema enum
|
||||
case "$cpu_arch" in
|
||||
|
||||
@@ -2672,7 +2672,7 @@ hb_configure_borg_manual() {
|
||||
|
||||
_borg_repo_ref_new="$repo"
|
||||
if [[ -n "$ssh_key" ]]; then
|
||||
local rsh_cmd="ssh -i $ssh_key -o StrictHostKeyChecking=accept-new"
|
||||
local rsh_cmd="ssh -i $ssh_key -o IdentitiesOnly=yes -o StrictHostKeyChecking=accept-new"
|
||||
[[ -n "${port:-}" && "$port" != "22" ]] && rsh_cmd="$rsh_cmd -p $port"
|
||||
export BORG_RSH="$rsh_cmd"
|
||||
elif [[ -n "${port:-}" && "$port" != "22" ]]; then
|
||||
@@ -2779,7 +2779,7 @@ hb_select_borg_repo() {
|
||||
_borg_repo_ref="${HB_BORG_REPOS[$sel]}"
|
||||
local key="${HB_BORG_KEYS[$sel]}"
|
||||
if [[ -n "$key" && -f "$key" ]]; then
|
||||
export BORG_RSH="ssh -i $key -o StrictHostKeyChecking=accept-new"
|
||||
export BORG_RSH="ssh -i $key -o IdentitiesOnly=yes -o StrictHostKeyChecking=accept-new"
|
||||
else
|
||||
unset BORG_RSH
|
||||
fi
|
||||
|
||||
@@ -124,6 +124,24 @@ _sb_borg_resolve_password() {
|
||||
cat "$pf"
|
||||
}
|
||||
|
||||
# Same lookup for the SSH key, which lives on the 3rd field of
|
||||
# `borg-targets.txt`. Job .env files carry the repository but not the
|
||||
# key, so a remote repo has to read it back from the destination here.
|
||||
_sb_borg_resolve_ssh_key() {
|
||||
local repo="$1"
|
||||
local cfg="${HB_STATE_DIR:-/usr/local/share/proxmenux}/borg-targets.txt"
|
||||
[[ -f "$cfg" && -n "$repo" ]] || return 1
|
||||
local name target_repo key
|
||||
while IFS='|' read -r name target_repo key _; do
|
||||
[[ -z "$name" || -z "$target_repo" ]] && continue
|
||||
if [[ "$target_repo" == "$repo" ]]; then
|
||||
[[ -n "$key" ]] && printf '%s\n' "$key"
|
||||
return 0
|
||||
fi
|
||||
done < "$cfg"
|
||||
return 1
|
||||
}
|
||||
|
||||
_sb_run_borg() {
|
||||
local stage_root="$1"
|
||||
local archive_name="$2"
|
||||
@@ -156,6 +174,21 @@ _sb_run_borg() {
|
||||
# an explicit re-export, child `borg` calls drop back to ssh defaults
|
||||
# and a remote repo silently auth-fails with no log trail.
|
||||
export BORG_PASSPHRASE="$passphrase"
|
||||
# A remote repo needs the destination's SSH key. Without BORG_RSH ssh
|
||||
# falls back to the default identities and a key-only server answers
|
||||
# `Permission denied (publickey)`. borg appends `-p <port>` itself
|
||||
# from the ssh:// URL, so the port does not belong here.
|
||||
if [[ -z "${BORG_RSH:-}" && "$repo" == ssh://* ]]; then
|
||||
local ssh_key
|
||||
ssh_key=$(_sb_borg_resolve_ssh_key "$repo" 2>/dev/null || true)
|
||||
if [[ -n "$ssh_key" && -r "$ssh_key" ]]; then
|
||||
BORG_RSH="ssh -i $ssh_key -o IdentitiesOnly=yes -o StrictHostKeyChecking=accept-new"
|
||||
elif [[ -n "$ssh_key" ]]; then
|
||||
echo "SSH key ${ssh_key} saved on this destination is missing or unreadable."
|
||||
echo " → generate it again from the destination, or point it at an existing key."
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
[[ -n "${BORG_RSH:-}" ]] && export BORG_RSH
|
||||
export BORG_RELOCATED_REPO_ACCESS_IS_OK=yes
|
||||
export BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=yes
|
||||
|
||||
@@ -424,3 +424,40 @@ cleanup_duplicate_repos() {
|
||||
cleanup_duplicate_repos_pve8
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# ==========================================================
|
||||
# Update log helpers
|
||||
# ==========================================================
|
||||
# An update log is what is left once the terminal is gone: the Monitor
|
||||
# runs the same update from a systemd unit with no terminal at all, and
|
||||
# an operator reads the log days later to find out what moved.
|
||||
|
||||
# Reads `apt list --upgradable` on stdin and writes one aligned
|
||||
# `name old → new` line per package. Lines that do not carry the
|
||||
# "[upgradable from: …]" part are passed through as they came.
|
||||
pmx_format_upgradable() {
|
||||
awk 'NF == 0 { next }
|
||||
$0 ~ /\[upgradable from: / {
|
||||
name = $1; sub(/\/.*/, "", name)
|
||||
from = $6; sub(/\]$/, "", from)
|
||||
printf " %-30s %s → %s\n", name, from, $2
|
||||
next
|
||||
}
|
||||
{ print " " $0 }'
|
||||
}
|
||||
|
||||
# Writes what dpkg actually did since `$1` (a "YYYY-MM-DD HH:MM:SS"
|
||||
# stamp taken before the upgrade). dpkg's own log is the authoritative
|
||||
# record of the transaction — it carries both versions of every package
|
||||
# replaced, which apt's console output does not spell out.
|
||||
pmx_dpkg_changes_since() {
|
||||
local since="$1"
|
||||
[[ -n "$since" && -r /var/log/dpkg.log ]] || return 0
|
||||
awk -v since="$since" '
|
||||
($1 " " $2) < since { next }
|
||||
$3 == "upgrade" { pkg = $4; sub(/:.*/, "", pkg); printf " %-30s %s → %s\n", pkg, $5, $6; next }
|
||||
$3 == "install" { pkg = $4; sub(/:.*/, "", pkg); printf " %-30s installed %s\n", pkg, $6; next }
|
||||
$3 == "remove" || $3 == "purge" { pkg = $4; sub(/:.*/, "", pkg); printf " %-30s %sd %s\n", pkg, $3, $5 }
|
||||
' /var/log/dpkg.log
|
||||
}
|
||||
|
||||
@@ -80,6 +80,12 @@ update_pve_safe() {
|
||||
local start_time
|
||||
start_time=$(date +%s)
|
||||
local log_file="/var/log/proxmox-update-$(date +%Y%m%d-%H%M%S).log"
|
||||
{
|
||||
echo "=== ProxMenux — Proxmox VE update ==="
|
||||
echo "Started: $(date -Iseconds)"
|
||||
echo "Host: $(hostname)"
|
||||
echo "Running: $(pveversion 2>/dev/null | head -1)"
|
||||
} > "$log_file"
|
||||
# Screen capture: replay the pre-upgrade context lines after `clear`
|
||||
# so the operator keeps the visual history around the noisy apt run.
|
||||
local screen_capture="/tmp/proxmenux_screen_capture_$$.txt"
|
||||
@@ -141,6 +147,11 @@ update_pve_safe() {
|
||||
local update_output update_exit_code
|
||||
update_output=$(apt-get update 2>&1)
|
||||
update_exit_code=$?
|
||||
{
|
||||
echo
|
||||
echo "--- apt-get update (exit $update_exit_code) ---"
|
||||
printf '%s\n' "$update_output"
|
||||
} >> "$log_file"
|
||||
|
||||
if [ $update_exit_code -eq 0 ]; then
|
||||
msg_ok "$(translate "Package lists updated successfully")" | tee -a "$screen_capture"
|
||||
@@ -163,7 +174,7 @@ update_pve_safe() {
|
||||
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys "$key" >/dev/null 2>&1 || true
|
||||
fi
|
||||
fi
|
||||
if apt-get update > "$log_file" 2>&1; then
|
||||
if apt-get update >> "$log_file" 2>&1; then
|
||||
msg_ok "$(translate "Package lists updated after GPG fix")" | tee -a "$screen_capture"
|
||||
else
|
||||
msg_error "$(translate "Failed to update package lists. Check log: $log_file")"
|
||||
@@ -188,10 +199,19 @@ update_pve_safe() {
|
||||
|
||||
# ── 5-6. Detect + confirm ──
|
||||
local current_pve_version available_pve_version upgradable security_updates
|
||||
local upgradable_raw upgradable_list
|
||||
current_pve_version=$(pveversion 2>/dev/null | grep -oP 'pve-manager/\K[0-9]+\.[0-9]+\.[0-9]+' | head -1)
|
||||
available_pve_version=$(apt-cache policy pve-manager 2>/dev/null | grep -oP 'Candidate: \K[0-9]+\.[0-9]+\.[0-9]+' | head -1)
|
||||
upgradable=$($APT_ENV apt list --upgradable 2>/dev/null | sed '1d' | sed '/^\s*$/d' | wc -l)
|
||||
security_updates=$($APT_ENV apt list --upgradable 2>/dev/null | sed '1d' | grep -ci '\-security')
|
||||
upgradable_raw=$($APT_ENV apt list --upgradable 2>/dev/null | sed '1d' | sed '/^\s*$/d')
|
||||
upgradable=$(printf '%s' "$upgradable_raw" | grep -c . )
|
||||
security_updates=$(printf '%s\n' "$upgradable_raw" | grep -ci '\-security')
|
||||
upgradable_list=$(printf '%s\n' "$upgradable_raw" | pmx_format_upgradable)
|
||||
|
||||
{
|
||||
echo
|
||||
echo "--- Packages to upgrade ($upgradable) ---"
|
||||
[ "$upgradable" -gt 0 ] && printf '%s\n' "$upgradable_list"
|
||||
} >> "$log_file"
|
||||
|
||||
local menu_text
|
||||
menu_text="$(translate "System Update Information")\n\n"
|
||||
@@ -207,12 +227,17 @@ update_pve_safe() {
|
||||
whiptail --title "$(translate "Update Status")" --msgbox "$menu_text" 15 70
|
||||
apt-get -y autoremove >/dev/null 2>&1 || true
|
||||
apt-get -y autoclean >/dev/null 2>&1 || true
|
||||
echo -e "\nSystem is already up to date." >> "$log_file"
|
||||
rm -f "$screen_capture"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# The package list rides in the same dialog as the summary, so the
|
||||
# decision is taken knowing what is about to be replaced. --scrolltext
|
||||
# keeps the buttons reachable however long the list is.
|
||||
menu_text+="$(translate "Packages to be upgraded"):\n$upgradable_list\n\n"
|
||||
menu_text+="$(translate "Do you want to proceed with the system update?")"
|
||||
if ! whiptail --title "$(translate "Proxmox Update")" --yesno "$menu_text" 18 70; then
|
||||
if ! whiptail --title "$(translate "Proxmox Update")" --scrolltext --yesno "$menu_text" 24 78; then
|
||||
msg_info2 "$(translate "Update cancelled by user")"
|
||||
apt-get -y autoremove >/dev/null 2>&1 || true
|
||||
apt-get -y autoclean >/dev/null 2>&1 || true
|
||||
@@ -228,6 +253,12 @@ update_pve_safe() {
|
||||
msg_title "$(translate "$SCRIPT_TITLE")"
|
||||
cat "$screen_capture"
|
||||
|
||||
# dpkg's log is read back from here on, so the transaction can be
|
||||
# reported package by package without holding apt's output.
|
||||
local dpkg_mark
|
||||
dpkg_mark=$(date '+%Y-%m-%d %H:%M:%S')
|
||||
echo -e "\n--- apt full-upgrade ---" >> "$log_file"
|
||||
|
||||
# apt's own progress bar (Progress: [ %]) prints on stderr and only
|
||||
# when stdout is a TTY. We pipe stderr through tee to keep a log copy
|
||||
# while letting apt keep its interactive stdout, so the native bar
|
||||
@@ -239,6 +270,12 @@ update_pve_safe() {
|
||||
local upgrade_exit_code=$?
|
||||
echo -e
|
||||
|
||||
{
|
||||
echo
|
||||
echo "--- Packages changed (exit $upgrade_exit_code) ---"
|
||||
pmx_dpkg_changes_since "$dpkg_mark"
|
||||
} >> "$log_file"
|
||||
|
||||
# Redraw once more so the wrap-up (LVM check, cleanup, summary) reads
|
||||
# cleanly instead of scrolling under half-a-screen of apt noise.
|
||||
clear
|
||||
@@ -248,6 +285,7 @@ update_pve_safe() {
|
||||
|
||||
if [ $upgrade_exit_code -ne 0 ]; then
|
||||
msg_error "$(translate "System upgrade failed. Check log: $log_file")"
|
||||
echo "Finished: $(date -Iseconds) — upgrade failed (exit $upgrade_exit_code)" >> "$log_file"
|
||||
rm -f "$screen_capture"
|
||||
return 1
|
||||
fi
|
||||
@@ -282,6 +320,12 @@ update_pve_safe() {
|
||||
echo -e "${TAB}${GN}📦 $(translate "Packages upgraded")${CL}: ${BL}$upgradable${CL}"
|
||||
echo -e "${TAB}${GN}🖥️ $(translate "Proxmox VE")${CL}: ${BL}${available_pve_version:-$current_pve_version}${CL}"
|
||||
|
||||
{
|
||||
echo
|
||||
echo "Finished: $(date -Iseconds) — ${minutes}m ${seconds}s"
|
||||
echo "Running: $(pveversion 2>/dev/null | head -1)"
|
||||
} >> "$log_file"
|
||||
|
||||
msg_ok "$(translate "Proxmox VE safe update completed")"
|
||||
rm -f "$screen_capture"
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@ fi
|
||||
load_language
|
||||
initialize_cache
|
||||
|
||||
APT_ENV="env DEBIAN_FRONTEND=noninteractive LC_ALL=C LANG=C"
|
||||
|
||||
ensure_tools_json() {
|
||||
[ -f "$TOOLS_JSON" ] || echo "{}" > "$TOOLS_JSON"
|
||||
}
|
||||
@@ -41,6 +43,12 @@ update_pve8() {
|
||||
pmx_journal_context "update_pve8" "$FUNC_VERSION"
|
||||
local start_time=$(date +%s)
|
||||
local log_file="/var/log/proxmox-update-$(date +%Y%m%d-%H%M%S).log"
|
||||
{
|
||||
echo "=== ProxMenux — Proxmox VE update ==="
|
||||
echo "Started: $(date -Iseconds)"
|
||||
echo "Host: $(hostname)"
|
||||
echo "Running: $(pveversion 2>/dev/null | head -1)"
|
||||
} > "$log_file"
|
||||
local changes_made=false
|
||||
local OS_CODENAME="$(grep "VERSION_CODENAME=" /etc/os-release | cut -d"=" -f 2 | xargs)"
|
||||
|
||||
@@ -120,7 +128,7 @@ EOF
|
||||
cleanup_duplicate_repos
|
||||
|
||||
msg_info "$(translate "Updating package lists...")"
|
||||
if apt-get update > "$log_file" 2>&1; then
|
||||
if apt-get update >> "$log_file" 2>&1; then
|
||||
msg_ok "$(translate "Package lists updated successfully")"
|
||||
else
|
||||
msg_error "$(translate "Failed to update package lists. Check log: $log_file")"
|
||||
@@ -129,8 +137,16 @@ EOF
|
||||
|
||||
local current_pve_version=$(pveversion 2>/dev/null | grep -oP 'pve-manager/\K[0-9]+\.[0-9]+\.[0-9]+' | head -1)
|
||||
local available_pve_version=$(apt-cache policy pve-manager 2>/dev/null | grep -oP 'Candidate: \K[0-9]+\.[0-9]+\.[0-9]+' | head -1)
|
||||
local upgradable=$(apt list --upgradable 2>/dev/null | grep -c "upgradable")
|
||||
local security_updates=$(apt list --upgradable 2>/dev/null | grep -c "security")
|
||||
local upgradable_raw=$($APT_ENV apt list --upgradable 2>/dev/null | sed '1d' | sed '/^\s*$/d')
|
||||
local upgradable=$(printf '%s' "$upgradable_raw" | grep -c . )
|
||||
local security_updates=$(printf '%s\n' "$upgradable_raw" | grep -ci '\-security')
|
||||
local upgradable_list=$(printf '%s\n' "$upgradable_raw" | pmx_format_upgradable)
|
||||
|
||||
{
|
||||
echo
|
||||
echo "--- Packages to upgrade ($upgradable) ---"
|
||||
[ "$upgradable" -gt 0 ] && printf '%s\n' "$upgradable_list"
|
||||
} >> "$log_file"
|
||||
|
||||
show_update_menu() {
|
||||
local current_version="$1"
|
||||
@@ -151,8 +167,12 @@ EOF
|
||||
whiptail --title "$(translate "Update Status")" --msgbox "$menu_text" 15 70
|
||||
return 2
|
||||
else
|
||||
# The package list rides in the same dialog as the summary, so
|
||||
# the decision is taken knowing what is about to be replaced.
|
||||
# --scrolltext keeps the buttons reachable however long it is.
|
||||
menu_text+="$(translate "Packages to be upgraded"):\n$upgradable_list\n\n"
|
||||
menu_text+="$(translate "Do you want to proceed with the system update?")"
|
||||
if whiptail --title "$(translate "Proxmox Update")" --yesno "$menu_text" 18 70; then
|
||||
if whiptail --title "$(translate "Proxmox Update")" --scrolltext --yesno "$menu_text" 24 78; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
@@ -171,6 +191,7 @@ EOF
|
||||
return 0
|
||||
elif [[ $MENU_RESULT -eq 2 ]]; then
|
||||
msg_ok "$(translate "System is already up to date. No update needed.")"
|
||||
echo -e "\nSystem is already up to date." >> "$log_file"
|
||||
pmx_record_execution "Remove unused packages" "apt-get -y autoremove"
|
||||
apt-get -y autoremove > /dev/null 2>&1 || true
|
||||
apt-get -y autoclean > /dev/null 2>&1 || true
|
||||
@@ -205,6 +226,12 @@ EOF
|
||||
tput civis
|
||||
tput sc
|
||||
|
||||
# dpkg's log is read back from here on, so the transaction can be
|
||||
# reported package by package.
|
||||
local dpkg_mark
|
||||
dpkg_mark=$(date '+%Y-%m-%d %H:%M:%S')
|
||||
echo -e "\n--- apt-get dist-upgrade ---" >> "$log_file"
|
||||
|
||||
pmx_record_execution "Upgrade Proxmox VE 8 packages" "apt-get -y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold dist-upgrade"
|
||||
(
|
||||
/usr/bin/env \
|
||||
@@ -216,6 +243,7 @@ EOF
|
||||
-o Dpkg::Options::="--force-confdef" \
|
||||
-o Dpkg::Options::="--force-confold" \
|
||||
dist-upgrade 2>&1 | \
|
||||
tee -a "$log_file" | \
|
||||
while IFS= read -r line; do
|
||||
if [[ "$line" =~ ^(Setting\ up|Unpacking|Preparing\ to\ unpack|Processing\ triggers\ for) ]]; then
|
||||
package_name=$(echo "$line" | sed -E 's/.*(Setting up|Unpacking|Preparing to unpack|Processing triggers for) ([^ ]+).*/\2/')
|
||||
@@ -240,7 +268,14 @@ EOF
|
||||
done
|
||||
)
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
local upgrade_exit_code=$?
|
||||
{
|
||||
echo
|
||||
echo "--- Packages changed (exit $upgrade_exit_code) ---"
|
||||
pmx_dpkg_changes_since "$dpkg_mark"
|
||||
} >> "$log_file"
|
||||
|
||||
if [ $upgrade_exit_code -eq 0 ]; then
|
||||
tput rc
|
||||
tput ed
|
||||
tput cnorm
|
||||
@@ -286,6 +321,12 @@ EOF
|
||||
|
||||
|
||||
|
||||
{
|
||||
echo
|
||||
echo "Finished: $(date -Iseconds) — ${minutes}m ${seconds}s"
|
||||
echo "Running: $(pveversion 2>/dev/null | head -1)"
|
||||
} >> "$log_file"
|
||||
|
||||
msg_ok "$(translate "Proxmox VE 8 system update completed successfully")"
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,12 @@ update_pve9() {
|
||||
local start_time
|
||||
start_time=$(date +%s)
|
||||
local log_file="/var/log/proxmox-update-$(date +%Y%m%d-%H%M%S).log"
|
||||
{
|
||||
echo "=== ProxMenux — Proxmox VE update ==="
|
||||
echo "Started: $(date -Iseconds)"
|
||||
echo "Host: $(hostname)"
|
||||
echo "Running: $(pveversion 2>/dev/null | head -1)"
|
||||
} > "$log_file"
|
||||
local changes_made=false
|
||||
local OS_CODENAME
|
||||
OS_CODENAME="$(grep "VERSION_CODENAME=" /etc/os-release | cut -d"=" -f 2 | xargs)"
|
||||
@@ -166,6 +172,11 @@ EOF
|
||||
# UPDATE: no progress bar here (dpkg is not involved); capture output to parse errors
|
||||
update_output=$(apt-get update 2>&1)
|
||||
update_exit_code=$?
|
||||
{
|
||||
echo
|
||||
echo "--- apt-get update (exit $update_exit_code) ---"
|
||||
printf '%s\n' "$update_output"
|
||||
} >> "$log_file"
|
||||
|
||||
if [ $update_exit_code -eq 0 ]; then
|
||||
msg_ok "$(translate "Package lists updated successfully")" | tee -a "$screen_capture"
|
||||
@@ -196,7 +207,7 @@ EOF
|
||||
fi
|
||||
|
||||
# Retry update after importing the key
|
||||
if apt-get update > "$log_file" 2>&1; then
|
||||
if apt-get update >> "$log_file" 2>&1; then
|
||||
msg_ok "$(translate "Package lists updated after GPG fix")" | tee -a "$screen_capture"
|
||||
else
|
||||
msg_error "$(translate "Failed to update package lists. Check log: $log_file")"
|
||||
@@ -224,16 +235,19 @@ EOF
|
||||
available_pve_version=$(apt-cache policy pve-manager 2>/dev/null | grep -oP 'Candidate: \K[0-9]+\.[0-9]+\.[0-9]+' | head -1)
|
||||
|
||||
|
||||
local upgradable
|
||||
upgradable=$($APT_ENV apt list --upgradable 2>/dev/null \
|
||||
local upgradable upgradable_raw upgradable_list security_updates
|
||||
upgradable_raw=$($APT_ENV apt list --upgradable 2>/dev/null \
|
||||
| sed '1d' \
|
||||
| sed '/^\s*$/d' \
|
||||
| wc -l)
|
||||
| sed '/^\s*$/d')
|
||||
upgradable=$(printf '%s' "$upgradable_raw" | grep -c . )
|
||||
security_updates=$(printf '%s\n' "$upgradable_raw" | grep -ci '\-security')
|
||||
upgradable_list=$(printf '%s\n' "$upgradable_raw" | pmx_format_upgradable)
|
||||
|
||||
local security_updates
|
||||
security_updates=$($APT_ENV apt list --upgradable 2>/dev/null \
|
||||
| sed '1d' \
|
||||
| grep -ci '\-security')
|
||||
{
|
||||
echo
|
||||
echo "--- Packages to upgrade ($upgradable) ---"
|
||||
[ "$upgradable" -gt 0 ] && printf '%s\n' "$upgradable_list"
|
||||
} >> "$log_file"
|
||||
|
||||
|
||||
show_update_menu() {
|
||||
@@ -256,8 +270,12 @@ EOF
|
||||
whiptail --title "$(translate "Update Status")" --msgbox "$menu_text" 15 70
|
||||
return 2
|
||||
else
|
||||
# The package list rides in the same dialog as the summary, so
|
||||
# the decision is taken knowing what is about to be replaced.
|
||||
# --scrolltext keeps the buttons reachable however long it is.
|
||||
menu_text+="$(translate "Packages to be upgraded"):\n$upgradable_list\n\n"
|
||||
menu_text+="$(translate "Do you want to proceed with the system update?")"
|
||||
if whiptail --title "$(translate "Proxmox Update")" --yesno "$menu_text" 18 70; then
|
||||
if whiptail --title "$(translate "Proxmox Update")" --scrolltext --yesno "$menu_text" 24 78; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
@@ -282,6 +300,7 @@ EOF
|
||||
return 0
|
||||
elif [[ $MENU_RESULT -eq 2 ]]; then
|
||||
msg_ok "$(translate "System is already up to date. No update needed.")"
|
||||
echo -e "\nSystem is already up to date." >> "$log_file"
|
||||
pmx_record_execution "Remove unused packages" "apt-get -y autoremove"
|
||||
apt-get -y autoremove > /dev/null 2>&1 || true
|
||||
apt-get -y autoclean > /dev/null 2>&1 || true
|
||||
@@ -301,6 +320,13 @@ EOF
|
||||
|
||||
|
||||
pmx_record_execution "Upgrade Proxmox VE 9 packages" "apt -y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold full-upgrade"
|
||||
|
||||
# dpkg's log is read back from here on, so the transaction can be
|
||||
# reported package by package without holding apt's output.
|
||||
local dpkg_mark
|
||||
dpkg_mark=$(date '+%Y-%m-%d %H:%M:%S')
|
||||
echo -e "\n--- apt full-upgrade ---" >> "$log_file"
|
||||
|
||||
DEBIAN_FRONTEND=noninteractive apt -y \
|
||||
-o Dpkg::Options::='--force-confdef' \
|
||||
-o Dpkg::Options::='--force-confold' \
|
||||
@@ -309,6 +335,12 @@ EOF
|
||||
upgrade_exit_code=$?
|
||||
echo -e
|
||||
|
||||
{
|
||||
echo
|
||||
echo "--- Packages changed (exit $upgrade_exit_code) ---"
|
||||
pmx_dpkg_changes_since "$dpkg_mark"
|
||||
} >> "$log_file"
|
||||
|
||||
clear
|
||||
show_proxmenux_logo
|
||||
msg_title "$(translate "$SCRIPT_TITLE")"
|
||||
@@ -316,6 +348,7 @@ EOF
|
||||
|
||||
if [ $upgrade_exit_code -ne 0 ]; then
|
||||
msg_error "$(translate "System upgrade failed. Check log: $log_file")"
|
||||
echo "Finished: $(date -Iseconds) — upgrade failed (exit $upgrade_exit_code)" >> "$log_file"
|
||||
rm -f "$screen_capture"
|
||||
return 1
|
||||
fi
|
||||
@@ -349,8 +382,14 @@ EOF
|
||||
echo -e "${TAB}${GN}📦 $(translate "Packages upgraded")${CL}: ${BL}$upgradable${CL}"
|
||||
echo -e "${TAB}${GN}🖥️ $(translate "Proxmox VE")${CL}: ${BL}$available_pve_version (Debian $OS_CODENAME)${CL}"
|
||||
|
||||
{
|
||||
echo
|
||||
echo "Finished: $(date -Iseconds) — ${minutes}m ${seconds}s"
|
||||
echo "Running: $(pveversion 2>/dev/null | head -1)"
|
||||
} >> "$log_file"
|
||||
|
||||
msg_ok "$(translate "Proxmox VE configuration completed.")"
|
||||
|
||||
|
||||
rm -f "$screen_capture"
|
||||
}
|
||||
|
||||
|
||||
@@ -57,13 +57,14 @@ show_menu() {
|
||||
dialog --clear \
|
||||
--backtitle "ProxMenux" \
|
||||
--title "$(translate "$menu_title")" \
|
||||
--menu "\n$(translate "Select an option:")" 21 70 12 \
|
||||
--menu "\n$(translate "Select an option:")" 22 70 14 \
|
||||
1 "$(translate "Settings post-install Proxmox")" \
|
||||
2 "$(translate "Hardware: GPUs and Coral-TPU")" \
|
||||
3 "$(translate "Create VM from template or script")" \
|
||||
4 "$(translate "Disk Manager")" \
|
||||
5 "$(translate "Storage & Share Manager")" \
|
||||
6 "$(translate "Proxmox VE Helper Scripts")" \
|
||||
o "$(translate "OCI manager Apps (beta)")" \
|
||||
7 "$(translate "Network Management")" \
|
||||
8 "$(translate "Security")" \
|
||||
9 "$(translate "Utilities and Tools")" \
|
||||
@@ -90,6 +91,7 @@ show_menu() {
|
||||
4) exec bash "$LOCAL_SCRIPTS/menus/storage_menu.sh" ;;
|
||||
5) exec bash "$LOCAL_SCRIPTS/menus/share_menu.sh" ;;
|
||||
6) exec bash "$LOCAL_SCRIPTS/menus/menu_Helper_Scripts.sh" ;;
|
||||
o) exec bash "$LOCAL_SCRIPTS/oci/oci_manager_apps.sh" ;;
|
||||
7) exec bash "$LOCAL_SCRIPTS/menus/network_menu.sh" ;;
|
||||
8) exec bash "$LOCAL_SCRIPTS/menus/security_menu.sh" ;;
|
||||
9) exec bash "$LOCAL_SCRIPTS/menus/utilities_menu.sh" ;;
|
||||
|
||||
Executable
+70
@@ -0,0 +1,70 @@
|
||||
#!/bin/bash
|
||||
# ==========================================================
|
||||
# ProxMenux - OCI manager Apps (beta)
|
||||
# ==========================================================
|
||||
# Author : MacRimi
|
||||
# Copyright : (c) 2024 MacRimi
|
||||
# License : GPL-3.0
|
||||
# https://github.com/MacRimi/ProxMenux/blob/main/LICENSE
|
||||
# Version : 1.0
|
||||
# ==========================================================
|
||||
# Description:
|
||||
# Installs official container images as native Proxmox OCI
|
||||
# LXC containers from the ProxMenux catalog, and manages the
|
||||
# instances it created. The catalog and the installer live in
|
||||
# the OCI engine ($BASE_DIR/oci/engine).
|
||||
# ==========================================================
|
||||
|
||||
LOCAL_SCRIPTS="/usr/local/share/proxmenux/scripts"
|
||||
BASE_DIR="/usr/local/share/proxmenux"
|
||||
UTILS_FILE="$BASE_DIR/utils.sh"
|
||||
OCI_ENGINE_DIR="$BASE_DIR/oci/engine"
|
||||
|
||||
if [[ -f "$UTILS_FILE" ]]; then
|
||||
source "$UTILS_FILE"
|
||||
fi
|
||||
if [[ -f "$LOCAL_SCRIPTS/global/pmx_journal.sh" ]]; then
|
||||
source "$LOCAL_SCRIPTS/global/pmx_journal.sh"
|
||||
fi
|
||||
|
||||
load_language
|
||||
initialize_cache
|
||||
|
||||
ensure_oci_dependencies() {
|
||||
local -a missing=()
|
||||
python3 -c 'import yaml' >/dev/null 2>&1 || missing+=("python3-yaml")
|
||||
command -v skopeo >/dev/null 2>&1 || missing+=("skopeo")
|
||||
[[ ${#missing[@]} -eq 0 ]] && return 0
|
||||
|
||||
show_proxmenux_logo
|
||||
msg_title "$(translate "OCI manager Apps (beta)")"
|
||||
msg_info "$(translate "Installing required packages...")"
|
||||
apt-get update >/dev/null 2>&1
|
||||
local status
|
||||
if declare -F pmx_install_pkg >/dev/null; then
|
||||
pmx_journal_context "ensure_oci_dependencies" "1.0" "oci_manager_apps.sh"
|
||||
pmx_install_pkg "${missing[@]}"
|
||||
status=$?
|
||||
else
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y "${missing[@]}" >/dev/null 2>&1
|
||||
status=$?
|
||||
fi
|
||||
if [[ $status -ne 0 ]]; then
|
||||
msg_error "$(translate "Could not install the required packages:") ${missing[*]}"
|
||||
return 1
|
||||
fi
|
||||
stop_spinner
|
||||
}
|
||||
|
||||
if [[ ! -f "$OCI_ENGINE_DIR/src/proxmenux_oci/__main__.py" ]]; then
|
||||
msg_error "$(translate "The OCI engine is not installed. Update ProxMenux and try again.")"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ensure_oci_dependencies || exit 1
|
||||
|
||||
if [[ $# -gt 0 ]]; then
|
||||
PYTHONPATH="$OCI_ENGINE_DIR/src" exec python3 -m proxmenux_oci "$@"
|
||||
fi
|
||||
PYTHONPATH="$OCI_ENGINE_DIR/src" python3 -m proxmenux_oci
|
||||
exec bash "$LOCAL_SCRIPTS/menus/main_menu.sh"
|
||||
@@ -59,7 +59,7 @@ initialize_cache
|
||||
|
||||
# Global variables
|
||||
OS_CODENAME="$(grep "VERSION_CODENAME=" /etc/os-release | cut -d"=" -f 2 | xargs)"
|
||||
RAM_SIZE_GB=$(( $(vmstat -s | grep -i "total memory" | xargs | cut -d" " -f 1) / 1024 / 1000))
|
||||
RAM_SIZE_GB=$(awk '/^MemTotal:/{print int($2/1024/1024)}' /proc/meminfo)
|
||||
NECESSARY_REBOOT=0
|
||||
export SCRIPT_TITLE="ProxMenux Optimization Post-Installation"
|
||||
|
||||
@@ -995,7 +995,7 @@ EOF
|
||||
|
||||
|
||||
install_log2ram_auto() {
|
||||
local FUNC_VERSION="1.5"
|
||||
local FUNC_VERSION="1.6"
|
||||
local existing_log2ram_bin=""
|
||||
pmx_journal_context "install_log2ram_auto" "$FUNC_VERSION"
|
||||
|
||||
@@ -1153,7 +1153,7 @@ EOF
|
||||
return 1
|
||||
fi
|
||||
|
||||
RAM_SIZE_GB=$(free -g | awk '/^Mem:/{print $2}')
|
||||
RAM_SIZE_GB=$(awk '/^MemTotal:/{print int($2/1024/1024)}' /proc/meminfo)
|
||||
[[ -z "$RAM_SIZE_GB" || "$RAM_SIZE_GB" -eq 0 ]] && RAM_SIZE_GB=4
|
||||
|
||||
if (( RAM_SIZE_GB <= 8 )); then
|
||||
|
||||
@@ -67,7 +67,7 @@ fi
|
||||
|
||||
|
||||
OS_CODENAME="$(grep "VERSION_CODENAME=" /etc/os-release | cut -d"=" -f 2 | xargs )"
|
||||
RAM_SIZE_GB=$(( $(vmstat -s | grep -i "total memory" | xargs | cut -d" " -f 1) / 1024 / 1000))
|
||||
RAM_SIZE_GB=$(awk '/^MemTotal:/{print int($2/1024/1024)}' /proc/meminfo)
|
||||
NECESSARY_REBOOT=0
|
||||
SCRIPT_TITLE="Customizable post-installation optimization script"
|
||||
|
||||
@@ -3075,7 +3075,7 @@ EOF
|
||||
|
||||
|
||||
configure_log2ram() {
|
||||
local FUNC_VERSION="1.5"
|
||||
local FUNC_VERSION="1.6"
|
||||
local existing_log2ram_bin=""
|
||||
pmx_journal_context "configure_log2ram" "$FUNC_VERSION"
|
||||
# description: Install Log2RAM with user-chosen RAM size; prompts for size and SSD/M.2 awareness before applying.
|
||||
@@ -3092,7 +3092,7 @@ configure_log2ram() {
|
||||
sleep 1
|
||||
|
||||
|
||||
RAM_SIZE_GB=$(free -g | awk '/^Mem:/{print $2}')
|
||||
RAM_SIZE_GB=$(awk '/^MemTotal:/{print int($2/1024/1024)}' /proc/meminfo)
|
||||
[[ -z "$RAM_SIZE_GB" || "$RAM_SIZE_GB" -eq 0 ]] && RAM_SIZE_GB=4
|
||||
|
||||
if (( RAM_SIZE_GB <= 8 )); then
|
||||
|
||||
Reference in New Issue
Block a user