diff --git a/bigtop-packages/src/common/bigtop-utils/bigtop-detect-pythonpath b/bigtop-packages/src/common/bigtop-utils/bigtop-detect-pythonpath new file mode 100644 index 0000000000..e20baa26d2 --- /dev/null +++ b/bigtop-packages/src/common/bigtop-utils/bigtop-detect-pythonpath @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# Override python3 in the file below if you want to disable +# automatic python3 detection +BIGTOP_DEFAULTS_DIR=${BIGTOP_DEFAULTS_DIR-/etc/default} +[ -n "${BIGTOP_DEFAULTS_DIR}" -a -r ${BIGTOP_DEFAULTS_DIR}/bigtop-utils ] && . ${BIGTOP_DEFAULTS_DIR}/bigtop-utils + +PYTHON3_PATH_CANDIDATES=( + '/usr/bin/python3' + '/opt/python3/bin/python3' + '/usr/lib/python3/bin/python3' +) + +# attempt to find python3 +if [ -z "${PYTHON3_PATH}" ]; then + for candidate in ${PYTHON3_PATH_CANDIDATES[@]} ; do + if [ -e ${candidate} ]; then + export PYTHON3_PATH=${candidate} + break + fi + done +fi diff --git a/bigtop-packages/src/common/bigtop-utils/bigtop-utils.default b/bigtop-packages/src/common/bigtop-utils/bigtop-utils.default index 53118481be..caedf20926 100644 --- a/bigtop-packages/src/common/bigtop-utils/bigtop-utils.default +++ b/bigtop-packages/src/common/bigtop-utils/bigtop-utils.default @@ -16,6 +16,9 @@ # Override JAVA_HOME detection for all bigtop packages # export JAVA_HOME +# Override PYTHON3_PATH detection for all bigtop packages +# export PYTHON3_PATH + # Provide a colon-delimited list of directories to search for native Java libraries (e.g. libjvm.so) # export JAVA_NATIVE_PATH diff --git a/bigtop-packages/src/deb/bigtop-utils/rules b/bigtop-packages/src/deb/bigtop-utils/rules index e55e985fa9..75d1058a24 100644 --- a/bigtop-packages/src/deb/bigtop-utils/rules +++ b/bigtop-packages/src/deb/bigtop-utils/rules @@ -35,6 +35,7 @@ override_dh_auto_install: install -p -m 755 debian/bigtop-detect-javahome debian/bigtop-utils/usr/lib/bigtop-utils/ install -p -m 755 debian/bigtop-detect-javalibs debian/bigtop-utils/usr/lib/bigtop-utils/ install -p -m 755 debian/bigtop-detect-classpath debian/bigtop-utils/usr/lib/bigtop-utils/ + install -p -m 755 debian/bigtop-detect-pythonpath debian/bigtop-utils/usr/lib/bigtop-utils/ install -p -m 755 debian/bigtop-monitor-service debian/bigtop-utils/usr/lib/bigtop-utils/ install -d -p -m 755 debian/bigtop-utils/etc/default install -p -m 644 debian/bigtop-utils.default debian/bigtop-utils/etc/default/bigtop-utils diff --git a/bigtop-packages/src/rpm/bigtop-utils/SPECS/bigtop-utils.spec b/bigtop-packages/src/rpm/bigtop-utils/SPECS/bigtop-utils.spec index 9a89091f86..0417eabe5b 100644 --- a/bigtop-packages/src/rpm/bigtop-utils/SPECS/bigtop-utils.spec +++ b/bigtop-packages/src/rpm/bigtop-utils/SPECS/bigtop-utils.spec @@ -32,6 +32,7 @@ Source2: bigtop-utils.default Source3: bigtop-detect-javalibs Source4: bigtop-detect-classpath Source5: bigtop-monitor-service +Source6: bigtop-detect-pythonpath Requires: bash # "which" command is needed for a lot of projects. @@ -54,6 +55,7 @@ install -p -m 644 %{SOURCE2} . install -p -m 644 %{SOURCE3} . install -p -m 644 %{SOURCE4} . install -p -m 644 %{SOURCE5} . +install -p -m 644 %{SOURCE6} . %build @@ -66,6 +68,7 @@ install -p -m 755 %{SOURCE0} $RPM_BUILD_ROOT%{lib_dir}/ install -p -m 755 %{SOURCE3} $RPM_BUILD_ROOT%{lib_dir}/ install -p -m 755 %{SOURCE4} $RPM_BUILD_ROOT%{lib_dir}/ install -p -m 755 %{SOURCE5} $RPM_BUILD_ROOT%{lib_dir}/ +install -p -m 755 %{SOURCE6} $RPM_BUILD_ROOT%{lib_dir}/ install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT/etc/default/bigtop-utils %clean