mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-11-01 18:32:13 +00:00
- OCI manager Apps carries the Technology Preview label that Proxmox VE gives to application containers from OCI images, in the main menu, the engine windows, the menu search, the message at the end of each installation, the release notes and the documentation. - The documentation explains that the label refers to the Proxmox VE support it runs on, not to the ProxMenux engine, and stays until Proxmox VE marks it as stable. - Spanish for the new message; the other languages are left to the translation bot.
105 lines
3.6 KiB
Bash
Executable File
105 lines
3.6 KiB
Bash
Executable File
#!/bin/bash
|
|
# ==========================================================
|
|
# ProxMenux - OCI manager Apps (Technology Preview)
|
|
# ==========================================================
|
|
# 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 (Technology Preview)")"
|
|
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
|
|
}
|
|
|
|
# Proxmox VE runs OCI images as LXC containers from 9.1 on.
|
|
pve_supports_oci() {
|
|
local version major minor
|
|
version=$(pveversion 2>/dev/null | grep -oP 'pve-manager/\K[0-9]+\.[0-9]+' | head -1)
|
|
major=${version%%.*}
|
|
minor=${version#*.}
|
|
[[ $major =~ ^[0-9]+$ && $minor =~ ^[0-9]+$ ]] || return 1
|
|
(( major > 9 || (major == 9 && minor >= 1) ))
|
|
}
|
|
|
|
if ! pve_supports_oci; then
|
|
show_proxmenux_logo
|
|
msg_title "$(translate "OCI manager Apps (Technology Preview)")"
|
|
msg_error "$(translate "OCI containers require Proxmox VE 9.1 or later.")"
|
|
PVE_VERSION=$(pveversion 2>/dev/null | grep -oP 'pve-manager/\K[0-9.]+' | head -1)
|
|
[[ -n $PVE_VERSION ]] && msg_info2 "$(translate "Current version:") $PVE_VERSION"
|
|
if [[ -t 0 ]]; then
|
|
echo
|
|
msg_success "$(translate "Press Enter to return to the menu...")"
|
|
read -r
|
|
[[ $# -eq 0 ]] && exec bash "$LOCAL_SCRIPTS/menus/main_menu.sh"
|
|
fi
|
|
exit 1
|
|
fi
|
|
|
|
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
|
|
OCI_STATUS=$?
|
|
|
|
# Do not replace an OCI engine traceback with the main menu. Returning to the
|
|
# menu is correct after a normal cancellation, but an unexpected non-zero exit
|
|
# must remain visible so the user can report and diagnose it.
|
|
if [[ $OCI_STATUS -ne 0 ]]; then
|
|
exit "$OCI_STATUS"
|
|
fi
|
|
|
|
exec bash "$LOCAL_SCRIPTS/menus/main_menu.sh"
|