Silence SC2024 on the nmtui redirect, with the reason recorded

shellcheck flags 'sudo doesn't affect redirects', which matters when redirecting into a
root-owned file. /dev/tty is the invoking user's own controlling terminal and the redirect
is what gives nmtui a terminal at all, so the warning does not apply here.

Also drop a stale message referencing a forge that a generic install has no knowledge of.
This commit is contained in:
flan
2026-07-13 17:14:08 +00:00
parent a8080cb43b
commit c1a81da6e6
+5 -1
View File
@@ -37,10 +37,14 @@ net_up() { ping -c1 -W3 "${GITEA_SSH_HOST:-archlinux.org}" >/dev/null 2>&1; }
# --- network: prompt + help connect if needed (nmtui, since NetworkManager is installed) ---
require_network() {
net_up && return
echo "No network / can't reach Gitea."
echo "No network yet."
local ans
while ! net_up; do
read -rp ">> Type 'net' to open nmtui, or connect another way then press Enter: " ans </dev/tty || true
# SC2024 warns that sudo doesn't apply to redirects — which matters when redirecting
# into a root-owned file. /dev/tty is this user's own controlling terminal, and the
# redirect exists to hand nmtui a terminal at all. Not applicable.
# shellcheck disable=SC2024
[ "$ans" = net ] && sudo nmtui </dev/tty >/dev/tty 2>&1 || true
done
}