ladybird/Meta/.shell_include.sh
Baitinq 88c9e4f3b0 Meta: Don't depend on sudo for privileged operations
We previously depended on sudo's specific -E flag to keep all the
environment variables when performing a privilege escalation. We now
incorporate the -E flag into the $SUDO variable, allowing for other
privilege escalation binaries (such as doas) to be used (as long as
they preserve the current environment variables).
2022-12-14 14:38:13 +00:00

19 lines
569 B
Bash
Executable File

#!/bin/sh
# shellcheck disable=SC2034
# SC2034: "Variable appears unused. Verify it or export it."
# Those are intentional here, as the file is meant to be included elsewhere.
# NOTE: If using another privilege escalation binary make sure it is configured or has the appropiate flag
# to keep the current environment variables in the launched process (in sudo's case this is achieved
# through the -E flag described in sudo(8).
SUDO="sudo -E"
if [ "$(uname -s)" = "SerenityOS" ]; then
SUDO="pls -E"
fi
die() {
echo "die: $*"
exit 1
}