mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-04-06 02:02:59 +02:00
Compare commits
7 Commits
github-act
...
add-script
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e7305eec27 | ||
|
|
e247a8ee8b | ||
|
|
68e009e9c6 | ||
|
|
f652864208 | ||
|
|
59c0052bc8 | ||
|
|
05748eb1ed | ||
|
|
f2d6840756 |
14
CHANGELOG.md
14
CHANGELOG.md
@@ -439,6 +439,20 @@ Exercise vigilance regarding copycat or coat-tailing sites that seek to exploit
|
||||
|
||||
</details>
|
||||
|
||||
## 2026-04-05
|
||||
|
||||
### 🚀 Updated Scripts
|
||||
|
||||
- #### 🐞 Bug Fixes
|
||||
|
||||
- MotionEye: run as root to enable SMB share support [@MickLesk](https://github.com/MickLesk) ([#13527](https://github.com/community-scripts/ProxmoxVE/pull/13527))
|
||||
|
||||
### 💾 Core
|
||||
|
||||
- #### 🔧 Refactor
|
||||
|
||||
- core: silent() function - use return instead of exit to allow || true error handling [@MickLesk](https://github.com/MickLesk) ([#13529](https://github.com/community-scripts/ProxmoxVE/pull/13529))
|
||||
|
||||
## 2026-04-04
|
||||
|
||||
### 🧰 Tools
|
||||
|
||||
87
ct/openthread-br.sh
Normal file
87
ct/openthread-br.sh
Normal file
@@ -0,0 +1,87 @@
|
||||
#!/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://openthread.io/guides/border-router
|
||||
|
||||
APP="OpenThread-BR"
|
||||
var_tags="${var_tags:-thread;iot;border-router;matter}"
|
||||
var_cpu="${var_cpu:-2}"
|
||||
var_ram="${var_ram:-2048}"
|
||||
var_disk="${var_disk:-4}"
|
||||
var_os="${var_os:-debian}"
|
||||
var_version="${var_version:-13}"
|
||||
var_unprivileged="${var_unprivileged:-0}"
|
||||
var_tun="${var_tun:-yes}"
|
||||
|
||||
header_info "$APP"
|
||||
variables
|
||||
color
|
||||
catch_errors
|
||||
|
||||
function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
|
||||
if [[ ! -d /opt/ot-br-posix ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
cd /opt/ot-br-posix
|
||||
LOCAL_COMMIT=$(git rev-parse HEAD)
|
||||
$STD git fetch --depth 1 origin main
|
||||
REMOTE_COMMIT=$(git rev-parse origin/main)
|
||||
|
||||
if [[ "${LOCAL_COMMIT}" == "${REMOTE_COMMIT}" ]]; then
|
||||
msg_ok "Already up to date (${LOCAL_COMMIT:0:7})"
|
||||
exit
|
||||
fi
|
||||
|
||||
msg_info "Stopping Services"
|
||||
systemctl stop otbr-web
|
||||
systemctl stop otbr-agent
|
||||
msg_ok "Stopped Services"
|
||||
|
||||
msg_info "Updating Source"
|
||||
$STD git reset --hard origin/main
|
||||
$STD git submodule update --depth 1 --init --recursive
|
||||
msg_ok "Updated Source"
|
||||
|
||||
msg_info "Rebuilding OpenThread Border Router (Patience)"
|
||||
cd /opt/ot-br-posix/build
|
||||
$STD cmake -GNinja \
|
||||
-DBUILD_TESTING=OFF \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DOTBR_DBUS=ON \
|
||||
-DOTBR_MDNS=openthread \
|
||||
-DOTBR_REST=ON \
|
||||
-DOTBR_WEB=ON \
|
||||
-DOTBR_BORDER_ROUTING=ON \
|
||||
-DOTBR_BACKBONE_ROUTER=ON \
|
||||
-DOT_FIREWALL=ON \
|
||||
-DOT_POSIX_NAT64_CIDR="192.168.255.0/24" \
|
||||
..
|
||||
$STD ninja
|
||||
$STD ninja install
|
||||
msg_ok "Rebuilt OpenThread Border Router"
|
||||
|
||||
msg_info "Starting Services"
|
||||
systemctl start otbr-agent
|
||||
systemctl start otbr-web
|
||||
msg_ok "Started Services"
|
||||
msg_ok "Updated successfully!"
|
||||
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}${CL}"
|
||||
@@ -50,6 +50,7 @@ msg_ok "Installed MotionEye"
|
||||
|
||||
msg_info "Creating Service"
|
||||
curl -fsSL "https://raw.githubusercontent.com/motioneye-project/motioneye/dev/motioneye/extra/motioneye.systemd" -o "/etc/systemd/system/motioneye.service"
|
||||
sed -i 's/^User=.*/User=root/' /etc/systemd/system/motioneye.service
|
||||
systemctl enable -q --now motioneye
|
||||
msg_ok "Created Service"
|
||||
|
||||
|
||||
94
install/openthread-br-install.sh
Normal file
94
install/openthread-br-install.sh
Normal file
@@ -0,0 +1,94 @@
|
||||
#!/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://openthread.io/guides/border-router
|
||||
|
||||
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 \
|
||||
cmake \
|
||||
ninja-build \
|
||||
pkg-config \
|
||||
git \
|
||||
iproute2 \
|
||||
libreadline-dev \
|
||||
libncurses-dev \
|
||||
rsyslog \
|
||||
dbus \
|
||||
libdbus-1-dev \
|
||||
libjsoncpp-dev \
|
||||
iptables \
|
||||
ipset \
|
||||
bind9 \
|
||||
libnetfilter-queue1 \
|
||||
libnetfilter-queue-dev \
|
||||
libprotobuf-dev \
|
||||
protobuf-compiler \
|
||||
socat
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
setup_nodejs
|
||||
|
||||
msg_info "Cloning OpenThread Border Router"
|
||||
# git clone is needed to fetch submodules, fetch_and_deploy_gh_release doesn't support this. We use --depth 1 to minimize the amount of data cloned, but it still may take a while.
|
||||
$STD git clone --depth 1 https://github.com/openthread/ot-br-posix /opt/ot-br-posix
|
||||
cd /opt/ot-br-posix
|
||||
$STD git submodule update --depth 1 --init --recursive
|
||||
msg_ok "Cloned OpenThread Border Router"
|
||||
|
||||
msg_info "Building OpenThread Border Router (Patience)"
|
||||
mkdir -p build && cd build
|
||||
$STD cmake -GNinja \
|
||||
-DBUILD_TESTING=OFF \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DOTBR_DBUS=ON \
|
||||
-DOTBR_MDNS=openthread \
|
||||
-DOTBR_REST=ON \
|
||||
-DOTBR_WEB=ON \
|
||||
-DOTBR_BORDER_ROUTING=ON \
|
||||
-DOTBR_BACKBONE_ROUTER=ON \
|
||||
-DOT_FIREWALL=ON \
|
||||
-DOT_POSIX_NAT64_CIDR="192.168.255.0/24" \
|
||||
..
|
||||
$STD ninja
|
||||
$STD ninja install
|
||||
msg_ok "Built OpenThread Border Router"
|
||||
|
||||
msg_info "Configuring Network"
|
||||
cat <<EOF >/etc/sysctl.d/99-otbr.conf
|
||||
net.ipv6.conf.all.forwarding=1
|
||||
net.ipv4.ip_forward=1
|
||||
EOF
|
||||
$STD sysctl -p /etc/sysctl.d/99-otbr.conf
|
||||
msg_ok "Configured Network"
|
||||
|
||||
msg_info "Configuring Services"
|
||||
cat <<'EOF' >/etc/default/otbr-agent
|
||||
# USB example:
|
||||
# OTBR_AGENT_OPTS="-I wpan0 -B eth0 --vendor-name OpenThread --model-name BorderRouter --rest-listen-address 0.0.0.0 --rest-listen-port 8081 spinel+hdlc+uart:///dev/ttyACM0"
|
||||
# TCP via socat (for network-attached RCP like SLZB-06/SLZB-MR3):
|
||||
|
||||
# OTBR_AGENT_OPTS="-I wpan0 -B eth0 --vendor-name OpenThread --model-name BorderRouter --rest-listen-address 0.0.0.0 --rest-listen-port 8081 spinel+hdlc+forkpty:///usr/bin/socat?forkpty-arg=-,rawer&forkpty-arg=tcp:IP:PORT trel://eth0"
|
||||
OTBR_AGENT_OPTS="-I wpan0 -B eth0 --vendor-name OpenThread --model-name BorderRouter --rest-listen-address 0.0.0.0 --rest-listen-port 8081 spinel+hdlc+uart:///dev/ttyACM0"
|
||||
EOF
|
||||
cat <<'EOF' >/etc/default/otbr-web
|
||||
OTBR_WEB_OPTS="-I wpan0 -a 0.0.0.0 -p 80"
|
||||
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
|
||||
msg_ok "Configured Services"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
cleanup_lxc
|
||||
@@ -527,29 +527,23 @@ silent() {
|
||||
fi
|
||||
|
||||
if [[ $rc -ne 0 ]]; then
|
||||
# Source explain_exit_code if needed
|
||||
if ! declare -f explain_exit_code >/dev/null 2>&1; then
|
||||
if ! source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/error_handler.func); then
|
||||
explain_exit_code() { echo "unknown (error_handler.func download failed)"; }
|
||||
fi
|
||||
fi
|
||||
# Return instead of exit so that callers can use `$STD cmd || true`
|
||||
# or `if $STD cmd; then ...` to handle errors gracefully.
|
||||
# When no || / if is used, set -e + ERR trap will still catch it
|
||||
# and error_handler() will display the error and exit.
|
||||
#
|
||||
# Set flag so error_handler knows to show log tail from silent's logfile
|
||||
export _SILENT_FAILED_RC="$rc"
|
||||
export _SILENT_FAILED_CMD="$cmd"
|
||||
export _SILENT_FAILED_LINE="$caller_line"
|
||||
export _SILENT_FAILED_LOG="$logfile"
|
||||
|
||||
local explanation
|
||||
explanation="$(explain_exit_code "$rc")"
|
||||
|
||||
printf "\e[?25h"
|
||||
msg_error "in line ${caller_line}: exit code ${rc} (${explanation})"
|
||||
msg_custom "→" "${YWB}" "${cmd}"
|
||||
|
||||
if [[ -s "$logfile" ]]; then
|
||||
echo -e "\n${TAB}--- Last 20 lines of log ---"
|
||||
tail -n 20 "$logfile"
|
||||
echo -e "${TAB}-----------------------------------"
|
||||
echo -e "${TAB}📋 Full log: ${logfile}\n"
|
||||
fi
|
||||
|
||||
exit "$rc"
|
||||
return "$rc"
|
||||
fi
|
||||
|
||||
# Clear stale flags on success (prevents false positives if a previous
|
||||
# $STD cmd || true failed and a later non-silent command triggers error_handler)
|
||||
unset _SILENT_FAILED_RC _SILENT_FAILED_CMD _SILENT_FAILED_LINE _SILENT_FAILED_LOG 2>/dev/null || true
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
@@ -236,6 +236,16 @@ error_handler() {
|
||||
|
||||
command="${command//\$STD/}"
|
||||
|
||||
# If error originated from silent(), use its captured metadata
|
||||
# This provides the actual command and line number instead of "silent ..."
|
||||
if [[ -n "${_SILENT_FAILED_RC:-}" ]]; then
|
||||
exit_code="$_SILENT_FAILED_RC"
|
||||
command="$_SILENT_FAILED_CMD"
|
||||
line_number="$_SILENT_FAILED_LINE"
|
||||
# Clear flags to prevent stale data on subsequent errors
|
||||
unset _SILENT_FAILED_RC _SILENT_FAILED_CMD _SILENT_FAILED_LINE
|
||||
fi
|
||||
|
||||
if [[ "$exit_code" -eq 0 ]]; then
|
||||
return 0
|
||||
fi
|
||||
@@ -279,8 +289,12 @@ error_handler() {
|
||||
fi
|
||||
|
||||
# Get active log file (BUILD_LOG or INSTALL_LOG)
|
||||
# Prefer silent()'s logfile when available (contains the actual command output)
|
||||
local active_log=""
|
||||
if declare -f get_active_logfile >/dev/null 2>&1; then
|
||||
if [[ -n "${_SILENT_FAILED_LOG:-}" && -s "${_SILENT_FAILED_LOG}" ]]; then
|
||||
active_log="$_SILENT_FAILED_LOG"
|
||||
unset _SILENT_FAILED_LOG
|
||||
elif declare -f get_active_logfile >/dev/null 2>&1; then
|
||||
active_log="$(get_active_logfile)"
|
||||
elif [[ -n "${SILENT_LOGFILE:-}" ]]; then
|
||||
active_log="$SILENT_LOGFILE"
|
||||
|
||||
@@ -188,32 +188,18 @@ silent() {
|
||||
trap 'error_handler' ERR
|
||||
|
||||
if [[ $rc -ne 0 ]]; then
|
||||
# Source explain_exit_code if needed
|
||||
if ! declare -f explain_exit_code >/dev/null 2>&1; then
|
||||
source <(curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxVE/raw/branch/main/misc/error_handler.func) 2>/dev/null || true
|
||||
fi
|
||||
# Return instead of exit so that callers can use `$STD cmd || true`
|
||||
# When no || is used, set -e + ERR trap catches it via error_handler()
|
||||
export _SILENT_FAILED_RC="$rc"
|
||||
export _SILENT_FAILED_CMD="$cmd"
|
||||
export _SILENT_FAILED_LINE="$caller_line"
|
||||
export _SILENT_FAILED_LOG="$logfile"
|
||||
|
||||
local explanation=""
|
||||
if declare -f explain_exit_code >/dev/null 2>&1; then
|
||||
explanation="$(explain_exit_code "$rc")"
|
||||
fi
|
||||
|
||||
printf "\e[?25h"
|
||||
if [[ -n "$explanation" ]]; then
|
||||
msg_error "in line ${caller_line}: exit code ${rc} (${explanation})"
|
||||
else
|
||||
msg_error "in line ${caller_line}: exit code ${rc}"
|
||||
fi
|
||||
msg_custom "→" "${YWB}" "${cmd}"
|
||||
|
||||
if [[ -s "$logfile" ]]; then
|
||||
echo -e "\n${TAB}--- Last 20 lines of log ---"
|
||||
tail -n 20 "$logfile"
|
||||
echo -e "${TAB}----------------------------\n"
|
||||
fi
|
||||
|
||||
exit "$rc"
|
||||
return "$rc"
|
||||
fi
|
||||
|
||||
# Clear stale flags on success
|
||||
unset _SILENT_FAILED_RC _SILENT_FAILED_CMD _SILENT_FAILED_LINE _SILENT_FAILED_LOG 2>/dev/null || true
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user