# shellcheck disable=SC2034
uid=$(id -u)
CAN_ROOT=
SUDO=
if [ "$uid" = 0 ]; then
  CAN_ROOT=1
  SUDO=""
elif command -v sudo >/dev/null; then
  CAN_ROOT=1
  SUDO="sudo"
elif command -v doas >/dev/null; then
  CAN_ROOT=1
  SUDO="doas"
fi
if [ "$CAN_ROOT" != "1" ]; then
  echo "This installer needs to run commands as root."
  echo "We tried looking for 'sudo' and 'doas', but couldn't find them."
  echo "Either re-run this script as root, or set up sudo/doas."
  exit 1
fi
