mirror of
https://git.quad4.io/RNS-Things/MeshChatX.git
synced 2026-04-11 02:05:57 +00:00
15 lines
368 B
Bash
15 lines
368 B
Bash
# shellcheck shell=sh
|
|
# Sourced by scripts/ci/*.sh — run commands as root when sudo is missing (e.g. Docker, act).
|
|
# Usage: . "$(dirname "$0")/priv.sh"
|
|
|
|
run_priv() {
|
|
if [ "$(id -u)" -eq 0 ]; then
|
|
"$@"
|
|
elif command -v sudo >/dev/null 2>&1; then
|
|
sudo "$@"
|
|
else
|
|
echo "run_priv: need root or sudo for: $*" >&2
|
|
exit 1
|
|
fi
|
|
}
|