Compare commits

..

2 Commits

Author SHA1 Message Date
CanbiZ (MickLesk) 354d899811 Merge branch 'main' into feat/sdn-vnet-advanced 2026-06-24 21:31:30 +02:00
MickLesk c0eec305cc feat(build): add SDN vnet selection in advanced install
List Proxmox SDN vnets in the bridge step and use pct vnet= when selected.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-19 22:51:10 +02:00
4 changed files with 42 additions and 204 deletions
-6
View File
@@ -1,6 +0,0 @@
____ _ __ ______ __
/ __ \(_)___ _____/ /_ / __/ /___ _/ /_
/ /_/ / / __ \/ ___/ __ \/ /_/ / __ `/ __/
/ ____/ / / / / /__/ / / / __/ / /_/ / /_
/_/ /_/_/ /_/\___/_/ /_/_/ /_/\__,_/\__/
-69
View File
@@ -1,69 +0,0 @@
#!/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: nnsense
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/kieraneglin/pinchflat
APP="Pinchflat"
var_tags="${var_tags:-media;youtube;downloader}"
var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-2048}"
var_disk="${var_disk:-8}"
var_os="${var_os:-debian}"
var_version="${var_version:-13}"
var_unprivileged="${var_unprivileged:-1}"
var_gpu="${var_gpu:-yes}"
header_info "$APP"
variables
color
catch_errors
function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -d /opt/pinchflat/app ]]; then
msg_error "No ${APP} installation found."
exit 1
fi
if check_for_gh_release "pinchflat" "kieraneglin/pinchflat"; then
msg_info "Stopping Service"
systemctl stop pinchflat
msg_ok "Stopped Service"
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "pinchflat" "kieraneglin/pinchflat" "tarball" "latest" "/opt/pinchflat-src"
msg_info "Building Pinchflat"
cd /opt/pinchflat-src
export MIX_ENV=prod
export ERL_FLAGS="+JPperf true"
$STD mix deps.get --only prod
$STD mix deps.compile
$STD yarn --cwd assets install
$STD mix assets.deploy
$STD mix compile
$STD mix release --overwrite
rm -rf /opt/pinchflat/app
cp -r _build/prod/rel/pinchflat /opt/pinchflat/app
msg_ok "Built Pinchflat"
msg_info "Starting Service"
systemctl start pinchflat
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 "${TAB}${GATEWAY}${BGN}http://${IP}:8945${CL}"
-125
View File
@@ -1,125 +0,0 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2026 community-scripts ORG
# Author: nnsense
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/kieraneglin/pinchflat
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Dependencies"
$STD apt install -y \
build-essential \
elixir \
erlang-dev \
erlang-inets \
erlang-os-mon \
erlang-runtime-tools \
erlang-syntax-tools \
erlang-xmerl \
git \
libsqlite3-dev \
locales \
openssh-client \
openssl \
pipx \
pkg-config \
procps \
python3-mutagen \
zip
msg_ok "Installed Dependencies"
NODE_VERSION="24" NODE_MODULE="yarn" setup_nodejs
FFMPEG_TYPE="binary" setup_ffmpeg
setup_hwaccel
fetch_and_deploy_gh_release "deno" "denoland/deno" "prebuild" "latest" "/usr/local/bin" "deno-x86_64-unknown-linux-gnu.zip"
fetch_and_deploy_gh_release "yt-dlp" "yt-dlp/yt-dlp" "singlefile" "latest" "/usr/local/bin" "yt-dlp_linux"
msg_info "Installing Apprise"
export PIPX_HOME=/opt/pipx
export PIPX_BIN_DIR=/usr/local/bin
$STD pipx install apprise
msg_ok "Installed Apprise"
fetch_and_deploy_gh_release "pinchflat" "kieraneglin/pinchflat" "tarball" "latest" "/opt/pinchflat-src"
msg_info "Configuring Pinchflat"
CONFIG_PATH="/opt/pinchflat/config"
DOWNLOADS_PATH="/opt/pinchflat/downloads"
mkdir -p \
/etc/elixir_tzdata_data \
/etc/yt-dlp/plugins \
/opt/pinchflat/app \
"$CONFIG_PATH/db" \
"$CONFIG_PATH/extras" \
"$CONFIG_PATH/logs" \
"$CONFIG_PATH/metadata" \
"$DOWNLOADS_PATH"
ln -sfn "$CONFIG_PATH" /config
ln -sfn "$DOWNLOADS_PATH" /downloads
chmod ugo+rw /etc/elixir_tzdata_data /etc/yt-dlp /etc/yt-dlp/plugins
cat <<EOF >/opt/pinchflat/.env
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_ALL=en_US.UTF-8
MIX_ENV=prod
PHX_SERVER=true
PORT=8945
RUN_CONTEXT=selfhosted
CONFIG_PATH=${CONFIG_PATH}
MEDIA_PATH=${DOWNLOADS_PATH}
TZ_DATA_PATH=/etc/elixir_tzdata_data
SECRET_KEY_BASE=$(openssl rand -base64 48)
EOF
msg_ok "Configured Pinchflat"
msg_info "Building Pinchflat"
cd /opt/pinchflat-src
export MIX_ENV=prod
export ERL_FLAGS="+JPperf true"
$STD mix local.hex --force
$STD mix local.rebar --force
$STD mix deps.get --only prod
$STD mix deps.compile
$STD yarn --cwd assets install
$STD mix assets.deploy
$STD mix compile
$STD mix release --overwrite
rm -rf /opt/pinchflat/app
cp -r _build/prod/rel/pinchflat /opt/pinchflat/app
msg_ok "Built Pinchflat"
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/pinchflat.service
[Unit]
Description=Pinchflat
After=network.target
[Service]
Type=simple
EnvironmentFile=/opt/pinchflat/.env
WorkingDirectory=/opt/pinchflat/app
UMask=0022
ExecStartPre=/opt/pinchflat/app/bin/check_file_permissions
ExecStartPre=/opt/pinchflat/app/bin/migrate
ExecStart=/opt/pinchflat/app/bin/pinchflat start
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now pinchflat
msg_ok "Created Service"
motd_ssh
customize
cleanup_lxc
+42 -4
View File
@@ -519,6 +519,19 @@ validate_bridge() {
return 0
}
# ------------------------------------------------------------------------------
# validate_sdn_vnet()
#
# - Validates that an SDN vnet exists in the cluster config
# ------------------------------------------------------------------------------
validate_sdn_vnet() {
local vnet="$1"
[[ -z "$vnet" ]] && return 1
[[ -f /etc/pve/sdn/vnets.cfg ]] && grep -qE "^vnet:[[:space:]]*${vnet}([[:space:]]|$)" /etc/pve/sdn/vnets.cfg && return 0
command -v pvesh &>/dev/null && pvesh get "/cluster/sdn/vnets/${vnet}" &>/dev/null && return 0
return 1
}
# ------------------------------------------------------------------------------
# validate_gateway_in_subnet()
#
@@ -964,6 +977,7 @@ base_settings() {
HN="$requested_hostname"
BRG=${var_brg:-"vmbr0"}
SDN_VNET=${var_sdn_vnet:-""}
NET=${var_net:-"dhcp"}
# Resolve IP range if NET contains a range (e.g., 192.168.1.100/24-192.168.1.200/24)
@@ -1078,7 +1092,7 @@ load_vars_file() {
var_gateway var_hostname var_ipv6_method var_mac var_mknod var_mount_fs var_mtu
var_net var_nesting var_ns var_os var_protection var_pw var_ram var_tags var_timezone var_tun var_unprivileged
var_verbose var_version var_vlan var_ssh var_ssh_authorized_key var_container_storage var_template_storage var_searchdomain
var_post_install
var_post_install var_sdn_vnet
)
# Whitelist check helper
@@ -1253,6 +1267,9 @@ load_vars_file() {
continue
fi
;;
var_sdn_vnet)
if [[ -n "$var_val" ]] && ! validate_sdn_vnet "$var_val"; then
msg_warn "SDN vnet '$var_val' from $file not found, ignoring"
var_http_proxy)
if [[ -n "$var_val" ]] && ! [[ "$var_val" =~ ^https?://[^[:space:]]+(:[0-9]+)?/?$ ]]; then
msg_warn "Invalid HTTP proxy URL '$var_val' in $file, ignoring"
@@ -1308,7 +1325,7 @@ default_var_settings() {
var_gateway var_hostname var_ipv6_method var_mac var_mknod var_mount_fs var_mtu
var_net var_nesting var_ns var_os var_protection var_pw var_ram var_tags var_timezone var_tun var_unprivileged
var_verbose var_version var_vlan var_ssh var_ssh_authorized_key var_container_storage var_template_storage
var_post_install
var_post_install var_sdn_vnet
)
# Snapshot: environment variables (highest precedence)
@@ -1491,7 +1508,7 @@ if ! declare -p VAR_WHITELIST >/dev/null 2>&1; then
var_gateway var_hostname var_ipv6_method var_mac var_mknod var_mount_fs var_mtu
var_net var_nesting var_ns var_os var_protection var_pw var_ram var_tags var_timezone var_tun var_unprivileged
var_verbose var_version var_vlan var_ssh var_ssh_authorized_key var_container_storage var_template_storage var_searchdomain
var_post_install
var_post_install var_sdn_vnet
)
fi
@@ -1705,6 +1722,7 @@ _build_current_app_vars_tmp() {
[ -n "$_hostname" ] && echo "var_hostname=$(_sanitize_value "$_hostname")"
[ -n "$_searchdomain" ] && echo "var_searchdomain=$(_sanitize_value "$_searchdomain")"
[ -n "${var_sdn_vnet:-}" ] && echo "var_sdn_vnet=$(_sanitize_value "${var_sdn_vnet}")"
[ -n "$_tpl_storage" ] && echo "var_template_storage=$(_sanitize_value "$_tpl_storage")"
[ -n "$_ct_storage" ] && echo "var_container_storage=$(_sanitize_value "$_ct_storage")"
@@ -1865,6 +1883,7 @@ advanced_settings() {
local _core_count="${var_cpu:-1}"
local _ram_size="${var_ram:-1024}"
local _bridge="${var_brg:-vmbr0}"
local _sdn_vnet="${var_sdn_vnet:-}"
local _net="${var_net:-dhcp}"
local _gate="${var_gateway:-}"
local _ipv6_method="${var_ipv6_method:-auto}"
@@ -1946,6 +1965,11 @@ advanced_settings() {
fi
done <<<"$BRIDGES"
fi
if [[ -f /etc/pve/sdn/vnets.cfg ]]; then
while IFS= read -r vnet; do
[[ -n "$vnet" ]] && BRIDGE_MENU_OPTIONS+=("sdn:${vnet}" "[SDN] ${vnet}")
done < <(awk '/^vnet:/{print $2}' /etc/pve/sdn/vnets.cfg 2>/dev/null)
fi
}
_detect_bridges
@@ -2178,8 +2202,18 @@ advanced_settings() {
if [[ "$bridge_test" == "__other__" || "$bridge_test" == -* ]]; then
continue
fi
if validate_bridge "$bridge_test"; then
if [[ "$bridge_test" == sdn:* ]]; then
local vnet_test="${bridge_test#sdn:}"
if validate_sdn_vnet "$vnet_test"; then
_sdn_vnet="$vnet_test"
_bridge="${var_brg:-vmbr0}"
((STEP++))
else
whiptail --msgbox "SDN vnet '$vnet_test' is not configured on this cluster." 8 58
fi
elif validate_bridge "$bridge_test"; then
_bridge="$bridge_test"
_sdn_vnet=""
((STEP++))
else
whiptail --msgbox "Bridge '$bridge_test' is not available or not active." 8 58
@@ -2957,6 +2991,7 @@ Advanced:
var_timezone="$_ct_timezone"
var_apt_cacher="$_apt_cacher"
var_apt_cacher_ip="$_apt_cacher_ip"
var_sdn_vnet="$_sdn_vnet"
var_http_proxy="$_http_proxy"
var_http_no_proxy="$_http_no_proxy"
@@ -3892,6 +3927,9 @@ build_container() {
# if [ "$VERBOSE" == "yes" ]; then set -x; fi
NET_STRING="-net0 name=eth0,bridge=${BRG:-vmbr0}"
if [[ -n "${var_sdn_vnet:-${SDN_VNET:-}}" ]]; then
NET_STRING="-net0 name=eth0,vnet=${var_sdn_vnet:-$SDN_VNET}"
fi
# MAC
if [[ -n "$MAC" ]]; then