mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-07-27 16:22:53 +02:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ba8375f4d8 | |||
| cfaed33534 | |||
| fccd4d568f | |||
| 4804aaedf7 | |||
| e7e6456cfa | |||
| 631f56b29e | |||
| a5a77dcd99 | |||
| 2b2e026928 |
+8
-1
@@ -512,7 +512,9 @@ Exercise vigilance regarding copycat or coat-tailing sites that seek to exploit
|
||||
|
||||
### 🆕 New Scripts
|
||||
|
||||
- Discourse ([#16024](https://github.com/community-scripts/ProxmoxVE/pull/16024))
|
||||
- Unpackerr ([#16034](https://github.com/community-scripts/ProxmoxVE/pull/16034))
|
||||
- CookCLI ([#16028](https://github.com/community-scripts/ProxmoxVE/pull/16028))
|
||||
- Discourse ([#16024](https://github.com/community-scripts/ProxmoxVE/pull/16024))
|
||||
- Mastodon ([#16029](https://github.com/community-scripts/ProxmoxVE/pull/16029))
|
||||
- Docspell ([#16033](https://github.com/community-scripts/ProxmoxVE/pull/16033))
|
||||
- Poznote ([#16030](https://github.com/community-scripts/ProxmoxVE/pull/16030))
|
||||
@@ -524,8 +526,13 @@ Exercise vigilance regarding copycat or coat-tailing sites that seek to exploit
|
||||
|
||||
- #### 🐞 Bug Fixes
|
||||
|
||||
- Mylar3 & Medusa: use trixie non-free for unrar, not bookworm [@angusmaul](https://github.com/angusmaul) ([#16072](https://github.com/community-scripts/ProxmoxVE/pull/16072))
|
||||
- Vikunja: pin install/update to v2.3.0 due upstream issues [@MickLesk](https://github.com/MickLesk) ([#16059](https://github.com/community-scripts/ProxmoxVE/pull/16059))
|
||||
|
||||
- #### ✨ New Features
|
||||
|
||||
- OpenThread-BR: Add runtime configuration options [@tomfrenzel](https://github.com/tomfrenzel) ([#16038](https://github.com/community-scripts/ProxmoxVE/pull/16038))
|
||||
|
||||
### 💾 Core
|
||||
|
||||
- #### 🐞 Bug Fixes
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env bash
|
||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: MickLesk (CanbiZ)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/cooklang/cookcli
|
||||
|
||||
APP="CookCLI"
|
||||
var_tags="${var_tags:-recipes;cooking;food}"
|
||||
var_cpu="${var_cpu:-1}"
|
||||
var_ram="${var_ram:-512}"
|
||||
var_disk="${var_disk:-8}"
|
||||
var_os="${var_os:-debian}"
|
||||
var_version="${var_version:-13}"
|
||||
var_arm64="${var_arm64:-yes}"
|
||||
var_unprivileged="${var_unprivileged:-1}"
|
||||
|
||||
header_info "$APP"
|
||||
variables
|
||||
color
|
||||
catch_errors
|
||||
|
||||
function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
|
||||
if [[ ! -f /opt/cookcli/cook ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
if check_for_gh_release "cook" "cooklang/cookcli"; then
|
||||
msg_info "Stopping Service"
|
||||
systemctl stop cookcli
|
||||
msg_ok "Stopped Service"
|
||||
|
||||
create_backup /opt/cookcli/recipes
|
||||
|
||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "cook" "cooklang/cookcli" "prebuild" "latest" "/opt/cookcli" "cook-$(arch_resolve "x86_64-unknown-linux-gnu" "aarch64-unknown-linux-musl").tar.gz"
|
||||
chmod +x /opt/cookcli/cook
|
||||
|
||||
restore_backup
|
||||
|
||||
msg_info "Starting Service"
|
||||
systemctl start cookcli
|
||||
msg_ok "Started Service"
|
||||
msg_ok "Updated successfully!"
|
||||
fi
|
||||
exit
|
||||
}
|
||||
|
||||
start
|
||||
build_container
|
||||
description
|
||||
|
||||
msg_ok "Completed Successfully!\n"
|
||||
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
||||
echo -e "${INFO}${YW}Access it using the following URL:${CL}"
|
||||
echo -e "${GATEWAY}${BGN}http://${IP}:9080${CL}"
|
||||
@@ -0,0 +1,6 @@
|
||||
______ __ ________ ____
|
||||
/ ____/___ ____ / /__/ ____/ / / _/
|
||||
/ / / __ \/ __ \/ //_/ / / / / /
|
||||
/ /___/ /_/ / /_/ / ,< / /___/ /____/ /
|
||||
\____/\____/\____/_/|_|\____/_____/___/
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
__ __ __
|
||||
/ / / /___ ____ ____ ______/ /_____ __________
|
||||
/ / / / __ \/ __ \/ __ `/ ___/ //_/ _ \/ ___/ ___/
|
||||
/ /_/ / / / / /_/ / /_/ / /__/ ,< / __/ / / /
|
||||
\____/_/ /_/ .___/\__,_/\___/_/|_|\___/_/ /_/
|
||||
/_/
|
||||
@@ -70,7 +70,9 @@ function update_script() {
|
||||
-DOTBR_BACKBONE_ROUTER=ON \
|
||||
-DOTBR_SYSTEMD_UNIT_DIR=/etc/systemd/system \
|
||||
-DOT_FIREWALL=ON \
|
||||
-DOTBR_NAT64=ON \
|
||||
-DOT_POSIX_NAT64_CIDR="192.168.255.0/24" \
|
||||
-DOTBR_DNS_UPSTREAM_QUERY=ON \
|
||||
..
|
||||
$STD ninja
|
||||
$STD ninja install
|
||||
@@ -101,6 +103,31 @@ EOF
|
||||
mv /etc/default/otbr-agent.bak /etc/default/otbr-agent
|
||||
msg_ok "Restored Configuration"
|
||||
|
||||
if [[ ! -f /etc/systemd/system/otbr-agent.service.d/10-otbr-post-start.conf ]]; then
|
||||
msg_info "Configuring OpenThread Border Router post-start service"
|
||||
cat <<'EOF' >/usr/local/bin/otbr-post-start.sh
|
||||
#!/bin/sh
|
||||
|
||||
# OpenThread Border Router post-start script
|
||||
# Run custom commands for runtime configuration options
|
||||
|
||||
# Wait for the otbr-agent service to be initialized
|
||||
#sleep 3
|
||||
|
||||
# Configure routing and translation features
|
||||
#ot-ctl nat64 enable
|
||||
#ot-ctl dns server upstream enable
|
||||
EOF
|
||||
chmod +x /usr/local/bin/otbr-post-start.sh
|
||||
mkdir -p /etc/systemd/system/otbr-agent.service.d
|
||||
cat <<'EOF' >/etc/systemd/system/otbr-agent.service.d/10-otbr-post-start.conf
|
||||
[Service]
|
||||
ExecStartPost=/usr/local/bin/otbr-post-start.sh
|
||||
EOF
|
||||
systemctl daemon-reload
|
||||
msg_ok "Configured OpenThread Border Router post-start service"
|
||||
fi
|
||||
|
||||
msg_info "Starting Services"
|
||||
systemctl start otbr-agent
|
||||
systemctl start otbr-web
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env bash
|
||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: MickLesk (CanbiZ)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://unpackerr.zip/
|
||||
|
||||
APP="Unpackerr"
|
||||
var_tags="${var_tags:-downloads;arr;automation;extraction}"
|
||||
var_cpu="${var_cpu:-1}"
|
||||
var_ram="${var_ram:-512}"
|
||||
var_disk="${var_disk:-2}"
|
||||
var_os="${var_os:-debian}"
|
||||
var_version="${var_version:-13}"
|
||||
var_arm64="${var_arm64:-yes}"
|
||||
var_unprivileged="${var_unprivileged:-1}"
|
||||
|
||||
header_info "$APP"
|
||||
variables
|
||||
color
|
||||
catch_errors
|
||||
|
||||
function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
|
||||
if [[ ! -f /etc/unpackerr/unpackerr.conf ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
if check_for_gh_release "unpackerr" "Unpackerr/unpackerr"; then
|
||||
msg_info "Stopping Service"
|
||||
systemctl stop unpackerr
|
||||
msg_ok "Stopped Service"
|
||||
|
||||
create_backup /etc/unpackerr/unpackerr.conf
|
||||
|
||||
DPKG_FORCE_CONFOLD=1 fetch_and_deploy_gh_release "unpackerr" "Unpackerr/unpackerr" "binary" "latest" "/opt/unpackerr" "unpackerr_*_$(arch_resolve).deb"
|
||||
|
||||
restore_backup
|
||||
|
||||
msg_info "Starting Service"
|
||||
systemctl start unpackerr
|
||||
msg_ok "Started Service"
|
||||
msg_ok "Updated successfully!"
|
||||
fi
|
||||
exit
|
||||
}
|
||||
|
||||
start
|
||||
build_container
|
||||
description
|
||||
|
||||
msg_ok "Completed Successfully!\n"
|
||||
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
||||
echo -e "${INFO}${YW}Configure integrations in:${CL}"
|
||||
echo -e "${GATEWAY}${BGN}/etc/unpackerr/unpackerr.conf${CL}"
|
||||
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: MickLesk (CanbiZ)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/cooklang/cookcli
|
||||
|
||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
fetch_and_deploy_gh_release "cook" "cooklang/cookcli" "prebuild" "latest" "/opt/cookcli" "cook-$(arch_resolve "x86_64-unknown-linux-gnu" "aarch64-unknown-linux-musl").tar.gz"
|
||||
|
||||
msg_info "Configuring CookCLI"
|
||||
chmod +x /opt/cookcli/cook
|
||||
mkdir -p /opt/cookcli/recipes
|
||||
cd /opt/cookcli/recipes
|
||||
$STD /opt/cookcli/cook seed
|
||||
msg_ok "Configured CookCLI"
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >/etc/systemd/system/cookcli.service
|
||||
[Unit]
|
||||
Description=CookCLI Recipe Server
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
WorkingDirectory=/opt/cookcli/recipes
|
||||
ExecStart=/opt/cookcli/cook server --host 0.0.0.0 --port 9080
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now cookcli
|
||||
msg_ok "Created Service"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
cleanup_lxc
|
||||
@@ -20,7 +20,7 @@ $STD apt install -y \
|
||||
mediainfo
|
||||
|
||||
cat <<EOF >/etc/apt/sources.list.d/non-free.list
|
||||
deb https://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
|
||||
deb https://deb.debian.org/debian trixie main contrib non-free non-free-firmware
|
||||
EOF
|
||||
$STD apt update
|
||||
$STD apt install -y unrar
|
||||
|
||||
@@ -17,8 +17,9 @@ msg_info "Installing Dependencies"
|
||||
cat <<EOF >/etc/apt/sources.list.d/non-free.sources
|
||||
Types: deb
|
||||
URIs: http://deb.debian.org/debian
|
||||
Suites: bookworm
|
||||
Suites: trixie
|
||||
Components: non-free non-free-firmware
|
||||
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
||||
EOF
|
||||
$STD apt update
|
||||
$STD apt install -y unrar
|
||||
|
||||
@@ -66,7 +66,9 @@ $STD cmake -GNinja \
|
||||
-DOTBR_BACKBONE_ROUTER=ON \
|
||||
-DOTBR_SYSTEMD_UNIT_DIR=/etc/systemd/system \
|
||||
-DOT_FIREWALL=ON \
|
||||
-DOTBR_NAT64=ON \
|
||||
-DOT_POSIX_NAT64_CIDR="192.168.255.0/24" \
|
||||
-DOTBR_DNS_UPSTREAM_QUERY=ON \
|
||||
..
|
||||
$STD ninja
|
||||
$STD ninja install
|
||||
@@ -103,6 +105,25 @@ EOF
|
||||
cat <<'EOF' >/etc/default/otbr-web
|
||||
OTBR_WEB_OPTS="-I wpan0 -a 0.0.0.0 -p 80"
|
||||
EOF
|
||||
cat <<'EOF' >/usr/local/bin/otbr-post-start.sh
|
||||
#!/bin/sh
|
||||
|
||||
# OpenThread Border Router post-start script
|
||||
# Run custom commands for runtime configuration options
|
||||
|
||||
# Wait for the otbr-agent service to be initialized
|
||||
#sleep 3
|
||||
|
||||
# Configure routing and translation features
|
||||
#ot-ctl nat64 enable
|
||||
#ot-ctl dns server upstream enable
|
||||
EOF
|
||||
chmod +x /usr/local/bin/otbr-post-start.sh
|
||||
mkdir -p /etc/systemd/system/otbr-agent.service.d
|
||||
cat <<'EOF' >/etc/systemd/system/otbr-agent.service.d/10-otbr-post-start.conf
|
||||
[Service]
|
||||
ExecStartPost=/usr/local/bin/otbr-post-start.sh
|
||||
EOF
|
||||
systemctl enable -q dbus rsyslog otbr-agent otbr-web
|
||||
systemctl enable -q bind9 2>/dev/null || systemctl enable -q named 2>/dev/null || true
|
||||
systemctl start -q dbus rsyslog bind9
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: MickLesk (CanbiZ)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://unpackerr.zip/
|
||||
|
||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
fetch_and_deploy_gh_release "unpackerr" "Unpackerr/unpackerr" "binary" "latest" "/opt/unpackerr" "unpackerr_*_$(arch_resolve).deb"
|
||||
|
||||
msg_info "Configuring Unpackerr"
|
||||
mkdir -p /etc/unpackerr
|
||||
cat <<EOF >/etc/unpackerr/unpackerr.conf
|
||||
debug = false
|
||||
quiet = false
|
||||
activity = false
|
||||
interval = "2m"
|
||||
parallel = 1
|
||||
file_mode = "0644"
|
||||
dir_mode = "0755"
|
||||
|
||||
[webserver]
|
||||
metrics = false
|
||||
listen_addr = "0.0.0.0:5656"
|
||||
|
||||
[folders]
|
||||
interval = "0s"
|
||||
EOF
|
||||
chmod 640 /etc/unpackerr/unpackerr.conf
|
||||
msg_ok "Configured Unpackerr"
|
||||
|
||||
msg_info "Creating Service"
|
||||
systemctl enable -q --now unpackerr
|
||||
msg_ok "Created Service"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
cleanup_lxc
|
||||
+138
-115
@@ -895,108 +895,6 @@ choose_and_set_storage_for_file() {
|
||||
# SECTION 5: CONFIGURATION & DEFAULTS MANAGEMENT
|
||||
# ==============================================================================
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Distinct versions of OS type $1 in the cached pveam catalog (no network).
|
||||
# `pveam available` prints "<section>\t<template>" - the name is field 2.
|
||||
# Must never fail: callers capture this via mapfile < <(...).
|
||||
# ------------------------------------------------------------------------------
|
||||
_list_os_versions() {
|
||||
local ostype="${1:-}"
|
||||
[[ -n "$ostype" ]] || return 0
|
||||
pveam available -section system 2>/dev/null |
|
||||
grep -E '\.(tar\.zst|tar\.xz|tar\.gz)$' |
|
||||
awk '{print $2}' |
|
||||
sed -nE "s/^${ostype}-([0-9]+(\.[0-9]+)?).*/\1/p" |
|
||||
sort -u -V || true
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Catalog templates matching prefix $1 and variant $2 ("debian-13" +
|
||||
# "-standard_"), oldest first. Same no-fail contract as _list_os_versions.
|
||||
# ------------------------------------------------------------------------------
|
||||
_list_templates() {
|
||||
local search="${1:-}" pattern="${2:-}"
|
||||
[[ -n "$search" ]] || return 0
|
||||
pveam available -section system 2>/dev/null |
|
||||
grep -E '\.(tar\.zst|tar\.xz|tar\.gz)$' |
|
||||
awk '{print $2}' |
|
||||
grep -E "^${search}.*${pattern}" |
|
||||
sort -t - -k 2 -V || true
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Maps var_version onto a version this host's catalog actually has, before the
|
||||
# settings summary is printed. Availability comes from `pveam available` only -
|
||||
# never inferred from the PVE release (an updated 8.4 may carry templates an
|
||||
# older 8.x never saw, and entries drop out again at EOL).
|
||||
# Picks the nearest version, newer wins on a tie. Interactive: menu with that
|
||||
# candidate preselected; unattended: takes it with a warning.
|
||||
# ------------------------------------------------------------------------------
|
||||
resolve_os_version() {
|
||||
local ostype="${var_os:-}" want="${var_version:-}"
|
||||
[[ -n "$ostype" && -n "$want" ]] || return 0
|
||||
|
||||
# ARM64 pulls from linuxcontainers.org, the pveam catalog says nothing there
|
||||
[[ "$(dpkg --print-architecture 2>/dev/null)" == "arm64" ]] && return 0
|
||||
|
||||
local -a versions=()
|
||||
mapfile -t versions < <(_list_os_versions "$ostype")
|
||||
[[ ${#versions[@]} -gt 0 ]] || return 0
|
||||
|
||||
local v
|
||||
for v in "${versions[@]}"; do
|
||||
[[ "$v" == "$want" ]] && return 0
|
||||
done
|
||||
|
||||
# Already downloaded counts as available even if the catalog dropped it
|
||||
if [[ -n "${TEMPLATE_STORAGE:-}" ]] &&
|
||||
pveam list "$TEMPLATE_STORAGE" 2>/dev/null | grep -q "/${ostype}-${want}-"; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
local candidate
|
||||
candidate=$(printf '%s\n' "${versions[@]}" | awk -v want="$want" '
|
||||
function num(v, a) { split(v, a, "."); return a[1] * 10000 + (a[2] + 0) }
|
||||
BEGIN { w = num(want); best = ""; bestd = -1 }
|
||||
{
|
||||
d = num($0) - w
|
||||
ad = (d < 0) ? -d : d
|
||||
if (bestd < 0 || ad < bestd || (ad == bestd && d > 0)) { bestd = ad; best = $0 }
|
||||
}
|
||||
END { print best }
|
||||
')
|
||||
[[ -n "$candidate" ]] || return 0
|
||||
|
||||
msg_warn "${ostype^} ${want} is not in this host's template catalog (PVE ${PVEVERSION:-unknown})"
|
||||
|
||||
if [[ "${PHS_SILENT:-0}" != "1" ]] && command -v whiptail &>/dev/null && [ -t 0 ] && [[ "$TERM" != "dumb" ]]; then
|
||||
local -a menu=()
|
||||
while read -r v; do
|
||||
if [[ "$v" == "$candidate" ]]; then
|
||||
menu+=("$v" "closest to ${want} (recommended)")
|
||||
else
|
||||
menu+=("$v" " ")
|
||||
fi
|
||||
done < <(printf '%s\n' "${versions[@]}" | sort -rV)
|
||||
|
||||
local choice
|
||||
choice=$(whiptail --backtitle "Proxmox VE Helper Scripts" \
|
||||
--title "OS VERSION NOT AVAILABLE" \
|
||||
--ok-button "Use" --cancel-button "Exit" \
|
||||
--menu "\n${ostype^} ${want} is not available on this Proxmox host.\n\nSelect the version to use instead:" \
|
||||
20 70 8 "${menu[@]}" --default-item "$candidate" \
|
||||
3>&1 1>&2 2>&3) || exit_script
|
||||
candidate="$choice"
|
||||
else
|
||||
msg_warn "Unattended run - continuing with ${ostype} ${candidate}"
|
||||
fi
|
||||
|
||||
var_version="$candidate"
|
||||
export var_version
|
||||
msg_ok "Using ${ostype} ${var_version} instead of ${want}"
|
||||
return 0 # last call in base_settings(), which runs under errexit
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# base_settings()
|
||||
#
|
||||
@@ -1170,11 +1068,8 @@ base_settings() {
|
||||
var_os="debian"
|
||||
fi
|
||||
if [ -z "$var_version" ]; then
|
||||
var_version="13"
|
||||
var_version="12"
|
||||
fi
|
||||
|
||||
# every install path passes here, and still before any summary is printed
|
||||
resolve_os_version
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
@@ -6584,7 +6479,7 @@ create_lxc_container() {
|
||||
fi
|
||||
|
||||
ONLINE_TEMPLATES=()
|
||||
mapfile -t ONLINE_TEMPLATES < <(_list_templates "$TEMPLATE_SEARCH" "$TEMPLATE_PATTERN")
|
||||
mapfile -t ONLINE_TEMPLATES < <(pveam available -section system 2>/dev/null | grep -E '\.(tar\.zst|tar\.xz|tar\.gz)$' | awk '{print $2}' | grep -E "^${TEMPLATE_SEARCH}.*${TEMPLATE_PATTERN}" | sort -t - -k 2 -V 2>/dev/null || true)
|
||||
[[ ${#ONLINE_TEMPLATES[@]} -gt 0 ]] && ONLINE_TEMPLATE="${ONLINE_TEMPLATES[-1]}"
|
||||
|
||||
TEMPLATE="$ONLINE_TEMPLATE"
|
||||
@@ -6592,13 +6487,58 @@ create_lxc_container() {
|
||||
msg_ok "Template search completed"
|
||||
fi
|
||||
|
||||
# resolve_os_version() already validated the version, so this means the
|
||||
# variant (TEMPLATE_PATTERN) is missing - a catalog issue, don't auto-repair
|
||||
# If still no template, try to find alternatives
|
||||
if [[ -z "$TEMPLATE" ]]; then
|
||||
msg_error "No ${TEMPLATE_PATTERN#-} template found for ${PCT_OSTYPE} ${PCT_OSVERSION}"
|
||||
msg_custom "ℹ️" "${YW}" "Refresh the catalog and check what this host offers:"
|
||||
echo -e "${TAB} pveam update && pveam available -section system | grep '${PCT_OSTYPE}-'"
|
||||
exit 225
|
||||
msg_warn "No template found for ${PCT_OSTYPE} ${PCT_OSVERSION}, searching for alternatives..."
|
||||
|
||||
# Get all available versions for this OS type
|
||||
AVAILABLE_VERSIONS=()
|
||||
mapfile -t AVAILABLE_VERSIONS < <(
|
||||
pveam available -section system 2>/dev/null |
|
||||
grep -E '\.(tar\.zst|tar\.xz|tar\.gz)$' |
|
||||
awk -F'\t' '{print $1}' |
|
||||
grep "^${PCT_OSTYPE}-" |
|
||||
sed -E "s/.*${PCT_OSTYPE}-([0-9]+(\.[0-9]+)?).*/\1/" |
|
||||
sort -u -V 2>/dev/null
|
||||
)
|
||||
|
||||
if [[ ${#AVAILABLE_VERSIONS[@]} -gt 0 ]]; then
|
||||
echo ""
|
||||
echo "${BL}Available ${PCT_OSTYPE} versions:${CL}"
|
||||
for i in "${!AVAILABLE_VERSIONS[@]}"; do
|
||||
echo " [$((i + 1))] ${AVAILABLE_VERSIONS[$i]}"
|
||||
done
|
||||
echo ""
|
||||
read -p "Select version [1-${#AVAILABLE_VERSIONS[@]}] or press Enter to cancel: " choice </dev/tty
|
||||
|
||||
if [[ "$choice" =~ ^[0-9]+$ ]] && [[ "$choice" -ge 1 ]] && [[ "$choice" -le ${#AVAILABLE_VERSIONS[@]} ]]; then
|
||||
PCT_OSVERSION="${AVAILABLE_VERSIONS[$((choice - 1))]}"
|
||||
TEMPLATE_SEARCH="${PCT_OSTYPE}-${PCT_OSVERSION}"
|
||||
|
||||
ONLINE_TEMPLATES=()
|
||||
mapfile -t ONLINE_TEMPLATES < <(
|
||||
pveam available -section system 2>/dev/null |
|
||||
grep -E '\.(tar\.zst|tar\.xz|tar\.gz)$' |
|
||||
awk '{print $2}' |
|
||||
grep -E "^${TEMPLATE_SEARCH}-.*${TEMPLATE_PATTERN}" |
|
||||
sort -t - -k 2 -V 2>/dev/null || true
|
||||
)
|
||||
|
||||
if [[ ${#ONLINE_TEMPLATES[@]} -gt 0 ]]; then
|
||||
TEMPLATE="${ONLINE_TEMPLATES[-1]}"
|
||||
TEMPLATE_SOURCE="online"
|
||||
else
|
||||
msg_error "No templates available for ${PCT_OSTYPE} ${PCT_OSVERSION}"
|
||||
exit 225
|
||||
fi
|
||||
else
|
||||
msg_custom "🚫" "${YW}" "Installation cancelled"
|
||||
exit 0
|
||||
fi
|
||||
else
|
||||
msg_error "No ${PCT_OSTYPE} templates available"
|
||||
exit 225
|
||||
fi
|
||||
fi
|
||||
|
||||
TEMPLATE_PATH="$(pvesm path $TEMPLATE_STORAGE:vztmpl/$TEMPLATE 2>/dev/null || true)"
|
||||
@@ -6613,10 +6553,93 @@ create_lxc_container() {
|
||||
fi
|
||||
|
||||
[[ -n "$TEMPLATE_PATH" ]] || {
|
||||
msg_error "Could not resolve a storage path for template ${TEMPLATE}"
|
||||
exit 220
|
||||
if [[ -z "$TEMPLATE" ]]; then
|
||||
msg_error "Template ${PCT_OSTYPE} ${PCT_OSVERSION} not available"
|
||||
|
||||
# Get available versions
|
||||
mapfile -t AVAILABLE_VERSIONS < <(
|
||||
pveam available -section system 2>/dev/null |
|
||||
grep "^${PCT_OSTYPE}-" |
|
||||
sed -E 's/.*'"${PCT_OSTYPE}"'-([0-9]+\.[0-9]+).*/\1/' |
|
||||
grep -E '^[0-9]+\.[0-9]+$' |
|
||||
sort -u -V 2>/dev/null || sort -u
|
||||
)
|
||||
|
||||
if [[ ${#AVAILABLE_VERSIONS[@]} -gt 0 ]]; then
|
||||
echo -e "\n${BL}Available versions:${CL}"
|
||||
for i in "${!AVAILABLE_VERSIONS[@]}"; do
|
||||
echo " [$((i + 1))] ${AVAILABLE_VERSIONS[$i]}"
|
||||
done
|
||||
|
||||
echo ""
|
||||
read -p "Select version [1-${#AVAILABLE_VERSIONS[@]}] or press Enter to exit: " choice </dev/tty
|
||||
|
||||
if [[ "$choice" =~ ^[0-9]+$ ]] && [[ "$choice" -ge 1 ]] && [[ "$choice" -le ${#AVAILABLE_VERSIONS[@]} ]]; then
|
||||
export var_version="${AVAILABLE_VERSIONS[$((choice - 1))]}"
|
||||
export PCT_OSVERSION="$var_version"
|
||||
msg_ok "Switched to ${PCT_OSTYPE} ${var_version}"
|
||||
|
||||
# Retry template search with new version
|
||||
TEMPLATE_SEARCH="${PCT_OSTYPE}-${PCT_OSVERSION:-}"
|
||||
|
||||
mapfile -t LOCAL_TEMPLATES < <(
|
||||
pveam list "$TEMPLATE_STORAGE" 2>/dev/null |
|
||||
awk -v search="${TEMPLATE_SEARCH}-" -v pattern="${TEMPLATE_PATTERN}" '$1 ~ search && $1 ~ pattern {print $1}' |
|
||||
sed 's|.*/||' | sort -t - -k 2 -V
|
||||
)
|
||||
mapfile -t ONLINE_TEMPLATES < <(
|
||||
pveam available -section system 2>/dev/null |
|
||||
grep -E '\.(tar\.zst|tar\.xz|tar\.gz)$' |
|
||||
awk '{print $2}' |
|
||||
grep -E "^${TEMPLATE_SEARCH}-.*${TEMPLATE_PATTERN}" |
|
||||
sort -t - -k 2 -V 2>/dev/null || true
|
||||
)
|
||||
ONLINE_TEMPLATE=""
|
||||
[[ ${#ONLINE_TEMPLATES[@]} -gt 0 ]] && ONLINE_TEMPLATE="${ONLINE_TEMPLATES[-1]}"
|
||||
|
||||
if [[ ${#LOCAL_TEMPLATES[@]} -gt 0 ]]; then
|
||||
TEMPLATE="${LOCAL_TEMPLATES[-1]}"
|
||||
TEMPLATE_SOURCE="local"
|
||||
else
|
||||
TEMPLATE="$ONLINE_TEMPLATE"
|
||||
TEMPLATE_SOURCE="online"
|
||||
fi
|
||||
|
||||
TEMPLATE_PATH="$(pvesm path $TEMPLATE_STORAGE:vztmpl/$TEMPLATE 2>/dev/null || true)"
|
||||
if [[ -z "$TEMPLATE_PATH" ]]; then
|
||||
TEMPLATE_BASE=$(awk -v s="$TEMPLATE_STORAGE" '$1==s {f=1} f && /path/ {print $2; exit}' /etc/pve/storage.cfg)
|
||||
[[ -n "$TEMPLATE_BASE" ]] && TEMPLATE_PATH="$TEMPLATE_BASE/template/cache/$TEMPLATE"
|
||||
fi
|
||||
|
||||
# If we still don't have a path but have a valid template name, construct it
|
||||
if [[ -z "$TEMPLATE_PATH" && -n "$TEMPLATE" ]]; then
|
||||
TEMPLATE_PATH="/var/lib/vz/template/cache/$TEMPLATE"
|
||||
fi
|
||||
|
||||
[[ -n "$TEMPLATE_PATH" ]] || {
|
||||
msg_error "Template still not found after version change"
|
||||
exit 220
|
||||
}
|
||||
else
|
||||
msg_custom "🚫" "${YW}" "Installation cancelled"
|
||||
exit 0
|
||||
fi
|
||||
else
|
||||
msg_error "No ${PCT_OSTYPE} templates available"
|
||||
exit 220
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Validate that we found a template
|
||||
if [[ -z "$TEMPLATE" ]]; then
|
||||
msg_error "No template found for ${PCT_OSTYPE} ${PCT_OSVERSION}"
|
||||
msg_custom "ℹ️" "${YW}" "Please check:"
|
||||
msg_custom " •" "${YW}" "Is pveam catalog available? (run: pveam available -section system)"
|
||||
msg_custom " •" "${YW}" "Does the template exist for your OS version?"
|
||||
exit 225
|
||||
fi
|
||||
|
||||
msg_ok "Template ${BL}$TEMPLATE${CL} [$TEMPLATE_SOURCE]"
|
||||
msg_debug "Resolved TEMPLATE_PATH=$TEMPLATE_PATH"
|
||||
|
||||
|
||||
@@ -376,11 +376,10 @@ error_handler() {
|
||||
active_log="$BUILD_LOG"
|
||||
fi
|
||||
|
||||
# stderr: the trap can fire inside a $(...) capture that would eat this as data
|
||||
if [[ -n "$active_log" && -s "$active_log" ]]; then
|
||||
echo -e "\n${TAB}--- Last 20 lines of log ---" >&2
|
||||
tail -n 20 "$active_log" >&2
|
||||
echo -e "${TAB}-----------------------------------\n" >&2
|
||||
echo -e "\n${TAB}--- Last 20 lines of log ---"
|
||||
tail -n 20 "$active_log"
|
||||
echo -e "${TAB}-----------------------------------\n"
|
||||
fi
|
||||
|
||||
# ── Node.js heap OOM detection with actionable guidance ──
|
||||
|
||||
Reference in New Issue
Block a user