From 9e2f740df33115f1484808d2249d68ab9b59560c Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Sun, 21 Dec 2025 21:09:41 +0100 Subject: [PATCH] Add sysctl script to local sbin directory --- qbittorrent/rootfs/usr/local/sbin/sysctl | 33 ++++-------------------- 1 file changed, 5 insertions(+), 28 deletions(-) diff --git a/qbittorrent/rootfs/usr/local/sbin/sysctl b/qbittorrent/rootfs/usr/local/sbin/sysctl index d09843062..b76c18c88 100644 --- a/qbittorrent/rootfs/usr/local/sbin/sysctl +++ b/qbittorrent/rootfs/usr/local/sbin/sysctl @@ -1,40 +1,17 @@ #!/usr/bin/env bash set -euo pipefail -SCRIPT_PATH="$(readlink -f "$0")" -REAL_SYSCTL_CMD=() - -_maybe_set_backend() { - local candidate="$1" - if [[ -x "${candidate}" && "$(readlink -f "${candidate}")" != "${SCRIPT_PATH}" ]]; then - REAL_SYSCTL_CMD=("${candidate}") - return 0 - fi - return 1 -} - -# Prefer system binaries that are not the wrapper itself -_maybe_set_backend "/sbin/sysctl" \ - || _maybe_set_backend "/usr/sbin/sysctl" \ - || _maybe_set_backend "/bin/sysctl" \ - || _maybe_set_backend "/usr/bin/sysctl" - -# Fallback to the busybox applet if no dedicated binary was found -if [[ ${#REAL_SYSCTL_CMD[@]} -eq 0 ]] && command -v busybox >/dev/null 2>&1; then - REAL_SYSCTL_CMD=("$(command -v busybox)" sysctl) -fi - -if [[ ${#REAL_SYSCTL_CMD[@]} -eq 0 ]]; then - echo "sysctl wrapper: no backend sysctl binary found" >&2 - exit 1 +REAL_SYSCTL="/sbin/sysctl" +if [[ ! -x "${REAL_SYSCTL}" ]]; then + REAL_SYSCTL="/usr/sbin/sysctl" fi if [[ "$#" -ge 2 && "$1" == "-q" && "$2" == "net.ipv4.conf.all.src_valid_mark=1" ]]; then - if "${REAL_SYSCTL_CMD[@]}" "$@" >/dev/null 2>&1; then + if "${REAL_SYSCTL}" "$@" >/dev/null 2>&1; then exit 0 fi # Suppress failure for this specific key to keep wg-quick from aborting in unprivileged environments. exit 0 fi -exec "${REAL_SYSCTL_CMD[@]}" "$@" +exec "${REAL_SYSCTL}" "$@"