You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bigtop.apache.org by ma...@apache.org on 2013/08/07 22:54:32 UTC

git commit: BIGTOP-1037. Provide a mechanism to control the sourcing of defaults files

Updated Branches:
  refs/heads/master e993a3edb -> ae257d12a


BIGTOP-1037. Provide a mechanism to control the sourcing of defaults files


Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo
Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/ae257d12
Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/ae257d12
Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/ae257d12

Branch: refs/heads/master
Commit: ae257d12a488b22e37a4336a06c3bf190826a71d
Parents: e993a3e
Author: Sean Mackrory <ma...@apache.org>
Authored: Tue Jul 30 11:28:59 2013 -0700
Committer: Sean Mackrory <ma...@apache.org>
Committed: Wed Aug 7 13:53:43 2013 -0700

----------------------------------------------------------------------
 .../src/common/bigtop-utils/bigtop-detect-classpath       |  3 ++-
 .../src/common/bigtop-utils/bigtop-detect-javahome        |  3 ++-
 .../src/common/bigtop-utils/bigtop-detect-javalibs        |  3 ++-
 bigtop-packages/src/common/flume/flume-agent.init         |  5 ++---
 bigtop-packages/src/common/hadoop/install_hadoop.sh       |  5 ++---
 bigtop-packages/src/common/hbase/hbase.svc                |  3 ++-
 bigtop-packages/src/common/hbase/install_hbase.sh         |  3 ++-
 bigtop-packages/src/common/hbase/regionserver-init.d.tpl  |  5 +++--
 bigtop-packages/src/common/hcatalog/install_hcatalog.sh   | 10 ++++------
 bigtop-packages/src/common/hive/install_hive.sh           |  8 +++-----
 bigtop-packages/src/common/pig/install_pig.sh             |  6 ++----
 bigtop-packages/src/common/solr/install_solr.sh           |  5 +++--
 bigtop-packages/src/deb/hue/hue-server.hue.init           |  5 ++---
 bigtop-packages/src/templates/init.d.tmpl                 |  8 +++-----
 14 files changed, 34 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bigtop/blob/ae257d12/bigtop-packages/src/common/bigtop-utils/bigtop-detect-classpath
----------------------------------------------------------------------
diff --git a/bigtop-packages/src/common/bigtop-utils/bigtop-detect-classpath b/bigtop-packages/src/common/bigtop-utils/bigtop-detect-classpath
index 7d06170..b962e65 100644
--- a/bigtop-packages/src/common/bigtop-utils/bigtop-detect-classpath
+++ b/bigtop-packages/src/common/bigtop-utils/bigtop-detect-classpath
@@ -15,7 +15,8 @@
 # limitations under the License.
 
 # Add files to BIGTOP_CLASSPATH and they will be prepended to the contents of /var/lib/bigtop
-[ -r /etc/default/bigtop-utils ] && . /etc/default/bigtop-utils
+BIGTOP_DEFAULTS_DIR=${BIGTOP_DEFAULTS_DIR-/etc/default}
+[ -n "${BIGTOP_DEFAULTS_DIR}" -a -r ${BIGTOP_DEFAULTS_DIR}/bigtop-utils ] && . ${BIGTOP_DEFAULTS_DIR}/bigtop-utils
 
 # Overriding this is not recommended because it has had to be hard-coded in
 # properties files for components that use bigtop-tomcat

http://git-wip-us.apache.org/repos/asf/bigtop/blob/ae257d12/bigtop-packages/src/common/bigtop-utils/bigtop-detect-javahome
----------------------------------------------------------------------
diff --git a/bigtop-packages/src/common/bigtop-utils/bigtop-detect-javahome b/bigtop-packages/src/common/bigtop-utils/bigtop-detect-javahome
index 21b15ef..0467e70 100644
--- a/bigtop-packages/src/common/bigtop-utils/bigtop-detect-javahome
+++ b/bigtop-packages/src/common/bigtop-utils/bigtop-detect-javahome
@@ -17,7 +17,8 @@
 
 # Override JAVA_HOME in the file below if you want to disable
 # automatic JAVA_HOME detection
-[ -r /etc/default/bigtop-utils ] && . /etc/default/bigtop-utils
+BIGTOP_DEFAULTS_DIR=${BIGTOP_DEFAULTS_DIR-/etc/default}
+[ -n "${BIGTOP_DEFAULTS_DIR}" -a -r ${BIGTOP_DEFAULTS_DIR}/bigtop-utils ] && . ${BIGTOP_DEFAULTS_DIR}/bigtop-utils
 
 # attempt to find java
 if [ -z "$JAVA_HOME" ]; then

http://git-wip-us.apache.org/repos/asf/bigtop/blob/ae257d12/bigtop-packages/src/common/bigtop-utils/bigtop-detect-javalibs
----------------------------------------------------------------------
diff --git a/bigtop-packages/src/common/bigtop-utils/bigtop-detect-javalibs b/bigtop-packages/src/common/bigtop-utils/bigtop-detect-javalibs
index e90fa68..a21021b 100644
--- a/bigtop-packages/src/common/bigtop-utils/bigtop-detect-javalibs
+++ b/bigtop-packages/src/common/bigtop-utils/bigtop-detect-javalibs
@@ -17,7 +17,8 @@
 
 # Override JAVA_NATIVE_PATH in the file below if you want to disable
 # automatic library detection
-[ -r /etc/default/bigtop-utils ] && . /etc/default/bigtop-utils
+BIGTOP_DEFAULTS_DIR=${BIGTOP_DEFAULTS_DIR-/etc/default}
+[ -n "${BIGTOP_DEFAULTS_DIR}" -a -r ${BIGTOP_DEFAULTS_DIR}/bigtop-utils ] && . ${BIGTOP_DEFAULTS_DIR}/bigtop-utils
 
 # ensure that java has already been found
 if [ -z "$JAVA_HOME" ]; then

http://git-wip-us.apache.org/repos/asf/bigtop/blob/ae257d12/bigtop-packages/src/common/flume/flume-agent.init
----------------------------------------------------------------------
diff --git a/bigtop-packages/src/common/flume/flume-agent.init b/bigtop-packages/src/common/flume/flume-agent.init
index 1c94aa5..b877434 100644
--- a/bigtop-packages/src/common/flume/flume-agent.init
+++ b/bigtop-packages/src/common/flume/flume-agent.init
@@ -33,9 +33,8 @@
 
 . /lib/lsb/init-functions
 
-if [ -f /etc/default/flume-agent ] ; then
-  . /etc/default/flume-agent
-fi
+BIGTOP_DEFAULTS_DIR=${BIGTOP_DEFAULTS_DIR-/etc/default}
+[ -n "${BIGTOP_DEFAULTS_DIR}" -a -r ${BIGTOP_DEFAULTS_DIR}/flume-agent ] && . ${BIGTOP_DEFAULTS_DIR}/flume-agent
 
 # Autodetect JAVA_HOME if not defined
 . /usr/lib/bigtop-utils/bigtop-detect-javahome

http://git-wip-us.apache.org/repos/asf/bigtop/blob/ae257d12/bigtop-packages/src/common/hadoop/install_hadoop.sh
----------------------------------------------------------------------
diff --git a/bigtop-packages/src/common/hadoop/install_hadoop.sh b/bigtop-packages/src/common/hadoop/install_hadoop.sh
index ed9cb5c..08ddb52 100755
--- a/bigtop-packages/src/common/hadoop/install_hadoop.sh
+++ b/bigtop-packages/src/common/hadoop/install_hadoop.sh
@@ -266,9 +266,8 @@ cat > $fuse_wrapper << EOF
 
 export HADOOP_HOME=\${HADOOP_HOME:-${HADOOP_DIR#${PREFIX}}}
 
-if [ -f /etc/default/hadoop-fuse ]
-then . /etc/default/hadoop-fuse
-fi
+BIGTOP_DEFAULTS_DIR=\${BIGTOP_DEFAULTS_DIR-/etc/default}
+[ -n "${BIGTOP_DEFAULTS_DIR}" -a -r ${BIGTOP_DEFAULTS_DIR}/hadoop-fuse ] && . ${BIGTOP_DEFAULTS_DIR}/hadoop-fuse
 
 export HADOOP_LIBEXEC_DIR=${SYSTEM_LIBEXEC_DIR#${PREFIX}}
 

http://git-wip-us.apache.org/repos/asf/bigtop/blob/ae257d12/bigtop-packages/src/common/hbase/hbase.svc
----------------------------------------------------------------------
diff --git a/bigtop-packages/src/common/hbase/hbase.svc b/bigtop-packages/src/common/hbase/hbase.svc
index 93b776d..49385d4 100644
--- a/bigtop-packages/src/common/hbase/hbase.svc
+++ b/bigtop-packages/src/common/hbase/hbase.svc
@@ -27,7 +27,8 @@ cat <<'__EOT__'
 
 hbase_env() {
     export HBASE_HOME=/usr/lib/hbase
-    . /etc/default/hbase
+    BIGTOP_DEFAULTS_DIR=${BIGTOP_DEFAULTS_DIR-/etc/default}
+    [ -n "${BIGTOP_DEFAULTS_DIR}" -a -r ${BIGTOP_DEFAULTS_DIR}/hbase ] && . ${BIGTOP_DEFAULTS_DIR}/hbase
 }
 
 __EOT__

http://git-wip-us.apache.org/repos/asf/bigtop/blob/ae257d12/bigtop-packages/src/common/hbase/install_hbase.sh
----------------------------------------------------------------------
diff --git a/bigtop-packages/src/common/hbase/install_hbase.sh b/bigtop-packages/src/common/hbase/install_hbase.sh
index f23cd27..3968b99 100755
--- a/bigtop-packages/src/common/hbase/install_hbase.sh
+++ b/bigtop-packages/src/common/hbase/install_hbase.sh
@@ -140,7 +140,8 @@ mkdir -p `dirname $wrapper`
 cat > $wrapper <<EOF
 #!/bin/sh
 
-. /etc/default/hbase
+BIGTOP_DEFAULTS_DIR=${BIGTOP_DEFAULTS_DIR-/etc/default}
+[ -n "${BIGTOP_DEFAULTS_DIR}" -a -r ${BIGTOP_DEFAULTS_DIR}/hbase ] && . ${BIGTOP_DEFAULTS_DIR}/hbase
 
 # Autodetect JAVA_HOME if not defined
 . /usr/lib/bigtop-utils/bigtop-detect-javahome

http://git-wip-us.apache.org/repos/asf/bigtop/blob/ae257d12/bigtop-packages/src/common/hbase/regionserver-init.d.tpl
----------------------------------------------------------------------
diff --git a/bigtop-packages/src/common/hbase/regionserver-init.d.tpl b/bigtop-packages/src/common/hbase/regionserver-init.d.tpl
index 7a21126..82c1487 100644
--- a/bigtop-packages/src/common/hbase/regionserver-init.d.tpl
+++ b/bigtop-packages/src/common/hbase/regionserver-init.d.tpl
@@ -47,8 +47,9 @@
 # Short-Description: Hadoop HBase @HBASE_DAEMON@ daemon
 ### END INIT INFO
 
-. /etc/default/hadoop
-. /etc/default/hbase
+BIGTOP_DEFAULTS_DIR=${BIGTOP_DEFAULTS_DIR-/etc/default}
+[ -n "${BIGTOP_DEFAULTS_DIR}" -a -r ${BIGTOP_DEFAULTS_DIR}/hadoop ] && . ${BIGTOP_DEFAULTS_DIR}/hadoop
+[ -n "${BIGTOP_DEFAULTS_DIR}" -a -r ${BIGTOP_DEFAULTS_DIR}/hbase ] && . ${BIGTOP_DEFAULTS_DIR}/hbase
 
 # Autodetect JAVA_HOME if not defined
 . /usr/lib/bigtop-utils/bigtop-detect-javahome

http://git-wip-us.apache.org/repos/asf/bigtop/blob/ae257d12/bigtop-packages/src/common/hcatalog/install_hcatalog.sh
----------------------------------------------------------------------
diff --git a/bigtop-packages/src/common/hcatalog/install_hcatalog.sh b/bigtop-packages/src/common/hcatalog/install_hcatalog.sh
index aa9fc5b..20f8ad1 100644
--- a/bigtop-packages/src/common/hcatalog/install_hcatalog.sh
+++ b/bigtop-packages/src/common/hcatalog/install_hcatalog.sh
@@ -114,13 +114,11 @@ done
 
 wrapper=${PREFIX}/$BIN_DIR/hcat
 cat >>$wrapper <<EOF
-#!/bin/sh
-. /etc/default/hadoop
+#!/bin/bash
 
-# look for HBase
-if [ -f /etc/default/hbase ] ; then
-  . /etc/default/hbase
-fi
+BIGTOP_DEFAULTS_DIR=${BIGTOP_DEFAULTS_DIR-/etc/default}
+[ -n "${BIGTOP_DEFAULTS_DIR}" -a -r ${BIGTOP_DEFAULTS_DIR}/hadoop ] && . ${BIGTOP_DEFAULTS_DIR}/hadoop
+[ -n "${BIGTOP_DEFAULTS_DIR}" -a -r ${BIGTOP_DEFAULTS_DIR}/hbase ] && . ${BIGTOP_DEFAULTS_DIR}/hbase
 
 # Autodetect JAVA_HOME if not defined
 . /usr/lib/bigtop-utils/bigtop-detect-javahome

http://git-wip-us.apache.org/repos/asf/bigtop/blob/ae257d12/bigtop-packages/src/common/hive/install_hive.sh
----------------------------------------------------------------------
diff --git a/bigtop-packages/src/common/hive/install_hive.sh b/bigtop-packages/src/common/hive/install_hive.sh
index 745c760..3d987fa 100755
--- a/bigtop-packages/src/common/hive/install_hive.sh
+++ b/bigtop-packages/src/common/hive/install_hive.sh
@@ -118,15 +118,13 @@ for file in hive
 do
   wrapper=${PREFIX}/$BIN_DIR/$file
   cat >>$wrapper <<EOF
-#!/bin/sh
+#!/bin/bash
 
 # Autodetect JAVA_HOME if not defined
 . /usr/lib/bigtop-utils/bigtop-detect-javahome
 
-# look for HBase
-if [ -f /etc/default/hbase ] ; then
-  . /etc/default/hbase
-fi
+BIGTOP_DEFAULTS_DIR=${BIGTOP_DEFAULTS_DIR-/etc/default}
+[ -n "${BIGTOP_DEFAULTS_DIR}" -a -r ${BIGTOP_DEFAULTS_DIR}/hbase ] && . ${BIGTOP_DEFAULTS_DIR}/hbase
 
 export HIVE_HOME=$INSTALLED_LIB_DIR
 exec $INSTALLED_LIB_DIR/bin/$file "\$@"

http://git-wip-us.apache.org/repos/asf/bigtop/blob/ae257d12/bigtop-packages/src/common/pig/install_pig.sh
----------------------------------------------------------------------
diff --git a/bigtop-packages/src/common/pig/install_pig.sh b/bigtop-packages/src/common/pig/install_pig.sh
index c3068f6..6561647 100644
--- a/bigtop-packages/src/common/pig/install_pig.sh
+++ b/bigtop-packages/src/common/pig/install_pig.sh
@@ -134,10 +134,8 @@ cat > $PREFIX/$BIN_DIR/pig <<EOF
 # Autodetect JAVA_HOME if not defined
 . /usr/lib/bigtop-utils/bigtop-detect-javahome
 
-# look for HBase
-if [ -f /etc/default/hbase ] ; then
-  . /etc/default/hbase
-fi
+BIGTOP_DEFAULTS_DIR=${BIGTOP_DEFAULTS_DIR-/etc/default}
+[ -n "${BIGTOP_DEFAULTS_DIR}" -a -r ${BIGTOP_DEFAULTS_DIR}/hbase ] && . ${BIGTOP_DEFAULTS_DIR}/hbase
 
 exec $INSTALLED_LIB_DIR/bin/pig "\$@"
 EOF

http://git-wip-us.apache.org/repos/asf/bigtop/blob/ae257d12/bigtop-packages/src/common/solr/install_solr.sh
----------------------------------------------------------------------
diff --git a/bigtop-packages/src/common/solr/install_solr.sh b/bigtop-packages/src/common/solr/install_solr.sh
index 4e09e40..3e27c3b 100644
--- a/bigtop-packages/src/common/solr/install_solr.sh
+++ b/bigtop-packages/src/common/solr/install_solr.sh
@@ -148,9 +148,10 @@ cp -ra ${BUILD_DIR}/example/solr/* $PREFIX/${CONF_DIR}.dist
 
 # Copy in the wrapper
 cat > $PREFIX/$LIB_DIR/bin/solrd <<EOF
-#!/bin/sh
+#!/bin/bash
 
-[ -f /etc/default/solr ] && . /etc/default/solr
+BIGTOP_DEFAULTS_DIR=${BIGTOP_DEFAULTS_DIR-/etc/default}
+[ -n "${BIGTOP_DEFAULTS_DIR}" -a -r ${BIGTOP_DEFAULTS_DIR}/solr ] && . ${BIGTOP_DEFAULTS_DIR}/solr
 
 # Autodetect JAVA_HOME if not defined
 . /usr/lib/bigtop-utils/bigtop-detect-javahome

http://git-wip-us.apache.org/repos/asf/bigtop/blob/ae257d12/bigtop-packages/src/deb/hue/hue-server.hue.init
----------------------------------------------------------------------
diff --git a/bigtop-packages/src/deb/hue/hue-server.hue.init b/bigtop-packages/src/deb/hue/hue-server.hue.init
index e9b11a8..f104ddb 100644
--- a/bigtop-packages/src/deb/hue/hue-server.hue.init
+++ b/bigtop-packages/src/deb/hue/hue-server.hue.init
@@ -63,9 +63,8 @@ DAEMONUSER=hue     # Users to run the daemons as. If this value
                         # is set start-stop-daemon will chuid the server
 
 # Include defaults if available
-if [ -f /etc/default/$NAME ] ; then
-    . /etc/default/$NAME
-fi
+BIGTOP_DEFAULTS_DIR=${BIGTOP_DEFAULTS_DIR-/etc/default}
+[ -n "${BIGTOP_DEFAULTS_DIR}" -a -r ${BIGTOP_DEFAULTS_DIR}/$NAME ] && . ${BIGTOP_DEFAULTS_DIR}/$NAME
 
 # Use this if you want the user to explicitly set 'RUN' in
 # /etc/default/

http://git-wip-us.apache.org/repos/asf/bigtop/blob/ae257d12/bigtop-packages/src/templates/init.d.tmpl
----------------------------------------------------------------------
diff --git a/bigtop-packages/src/templates/init.d.tmpl b/bigtop-packages/src/templates/init.d.tmpl
index cd5e592..39e4f4c 100644
--- a/bigtop-packages/src/templates/init.d.tmpl
+++ b/bigtop-packages/src/templates/init.d.tmpl
@@ -180,11 +180,9 @@ cat <<__EOT__
 ### END INIT INFO
 
 . /lib/lsb/init-functions
-. /etc/default/hadoop
-
-if [ -f /etc/default/$DAEMON ] ; then
-  . /etc/default/$DAEMON
-fi
+BIGTOP_DEFAULTS_DIR=\${BIGTOP_DEFAULTS_DIR-/etc/default}
+[ -n "\${BIGTOP_DEFAULTS_DIR}" -a -r \${BIGTOP_DEFAULTS_DIR}/hadoop ] && . \${BIGTOP_DEFAULTS_DIR}/hadoop
+[ -n "\${BIGTOP_DEFAULTS_DIR}" -a -r \${BIGTOP_DEFAULTS_DIR}/$DAEMON ] && . \${BIGTOP_DEFAULTS_DIR}/$DAEMON
 
 # Autodetect JAVA_HOME if not defined
 if [ -e /usr/libexec/bigtop-detect-javahome ]; then