Github user paul-rogers commented on a diff in the pull request: https://github.com/apache/drill/pull/1082#discussion_r160539726 --- Diff: distribution/src/resources/drill-config.sh --- @@ -180,18 +251,46 @@ else fi fi -# Default memory settings if none provided by the environment or +# Checking if being executed in context of Drillbit and not SQLLine +if [ "$DRILLBIT_CONTEXT" == "1" ]; then + # *-auto.sh allows for distrib/user specific checks to be done + distribAuto="$DRILL_CONF_DIR/distrib-auto.sh" + if [ ! -r "$distribAuto" ]; then distribAuto="$DRILL_HOME/conf/distrib-auto.sh"; fi + if [ ! -r "$distribAuto" ]; then distribAuto=""; fi + drillAuto="$DRILL_CONF_DIR/drill-auto.sh" + if [ ! -r "$drillAuto" ]; then drillAuto="$DRILL_HOME/conf/drill-auto.sh"; fi + if [ ! -r "$drillAuto" ]; then drillAuto=""; fi + + # Enforcing checks in order (distrib-auto.sh , drill-auto.sh) + # (NOTE: A script is executed only if it has relevant executable lines) + if [ -n "$distribAuto" ] && [ $(executableLineCount $distribAuto) -gt 0 ]; then + . "$distribAuto" + if [ $? -gt 0 ]; then fatal_error "Aborting Drill Startup due failed checks from $distribAuto"; fi + fi + if [ -n "$drillAuto" ] && [ $(executableLineCount $drillAuto) -gt 0 ]; then --- End diff -- To make the code a bit simpler, touch each file once: * Check if it exists. * Invoke it if so. * Handle any errors that are reported.
---