aports/testing/dart/dart-wrapper.sh
2024-12-14 21:41:24 +00:00

21 lines
740 B
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env sh
set -e
# This is always set in the Dart entrypoint script provided by Flutter,
# but not for standalone Dart. Emulating this behavior by only exporting
# if flutter is installed.
FLUTTER_ROOT=/usr/lib/flutter
if [ -f "$FLUTTER_ROOT/version" ]; then
export FLUTTER_ROOT
fi
# Test if running as superuser but don't warn if running within Docker or CI.
if [ "$(id -u)" = "0" ] && ! [ -f /.dockerenv ] && [ "$CI" != "true" ] && [ "$BOT" != "true" ] && [ "$CONTINUOUS_INTEGRATION" != "true" ]; then
>&2 echo " Woah! You appear to be trying to run dart as root."
>&2 echo " We strongly recommend running dart without superuser privileges."
>&2 echo " /"
>&2 echo "📎"
fi
exec /usr/lib/dart/bin/dart "$@"