Github user kkhatua commented on a diff in the pull request: https://github.com/apache/drill/pull/1082#discussion_r166158426 --- Diff: distribution/src/resources/drill-config.sh --- @@ -180,18 +251,61 @@ else fi fi -# Default memory settings if none provided by the environment or +# Execute distrib-setup.sh for any distribution-specific setup (e.g. checks). +# distrib-setup.sh is optional; it is created by some distribution installers +# that need additional distribution-specific setup to be done. +# Because installers will have site-specific steps, the file +# should be moved into the site directory, if the user employs one. + +# Checking if being executed in context of Drillbit and not SQLLine +if [ "$DRILLBIT_CONTEXT" == "1" ]; then + # Check whether to run exclusively distrib-setup.sh OR auto-setup.sh + distribSetup="$DRILL_CONF_DIR/distrib-setup.sh" ; #Site-based distrib-setup.sh + if [ $(checkExecutableLineCount $distribSetup) -eq 0 ]; then + distribSetup="$DRILL_HOME/conf/distrib-setup.sh" ; #Install-based distrib-setup.sh + if [ $(checkExecutableLineCount $distribSetup) -eq 0 ]; then + # Run Default Auto Setup + distribSetup="$DRILL_HOME/bin/auto-setup.sh" + fi + fi + # Check and run additional setup defined by user + drillSetup="$DRILL_CONF_DIR/drill-setup.sh" ; #Site-based drill-setup.sh + if [ $(checkExecutableLineCount $drillSetup) -eq 0 ]; then + drillSetup="$DRILL_HOME/conf/drill-setup.sh" ; #Install-based drill-setup.sh + if [ $(checkExecutableLineCount $drillSetup) -eq 0 ]; then drillSetup=""; fi + fi + + # Enforcing checks in order (distrib-setup.sh , drill-setup.sh) + # (NOTE: A script is executed only if it has relevant executable lines) + # Both distribSetup & drillSetup are executed because the user might have introduced additional checks + if [ -n "$distribSetup" ]; then + . "$distribSetup" + if [ $? -gt 0 ]; then fatal_error "Aborting Drill Startup due failed setup by $distribSetup"; fi --- End diff -- The auto-configuration scripts do indeed do that. However, I thought it would be good to have a higher level error message also indicating the source of the failure. This allows us to catch any non-zero exit codes that might be thrown and not handled cleanly. Other sections of `drill-config.sh` followed this principle.
---