aboutsummaryrefslogtreecommitdiff
path: root/bigtop-packages/src/deb/hbase
diff options
context:
space:
mode:
authorAndrew Bayer <abayer@apache.org>2011-08-31 22:57:21 +0000
committerAndrew Bayer <abayer@apache.org>2011-08-31 22:57:21 +0000
commit44e22d9f4082614bbd4876ca1110586afe2943ca (patch)
treeb1f60ae4760e4e8504794b606974f805240e66a5 /bigtop-packages/src/deb/hbase
parent6f3cbe0f3fafa252995453986e8f3fcab685d8c1 (diff)
Fixes BIGTOP-51. Reorganizes source repository.
Leaving site modules as is for the moment. Will clean them up later once we figure out how we want to reconcile the two existing ones. git-svn-id: https://svn.apache.org/repos/asf/incubator/bigtop/trunk@1163857 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'bigtop-packages/src/deb/hbase')
-rw-r--r--bigtop-packages/src/deb/hbase/compat1
-rw-r--r--bigtop-packages/src/deb/hbase/control56
-rw-r--r--bigtop-packages/src/deb/hbase/copyright15
-rw-r--r--bigtop-packages/src/deb/hbase/hadoop-hbase-doc.dirs1
-rw-r--r--bigtop-packages/src/deb/hbase/hadoop-hbase-doc.install1
-rw-r--r--bigtop-packages/src/deb/hbase/hadoop-hbase.default2
-rw-r--r--bigtop-packages/src/deb/hbase/hadoop-hbase.dirs3
-rw-r--r--bigtop-packages/src/deb/hbase/hadoop-hbase.install3
-rw-r--r--bigtop-packages/src/deb/hbase/hadoop-hbase.manpages1
-rw-r--r--bigtop-packages/src/deb/hbase/hadoop-hbase.postinst44
-rw-r--r--bigtop-packages/src/deb/hbase/hadoop-hbase.preinst61
-rw-r--r--bigtop-packages/src/deb/hbase/hadoop-hbase.prerm57
-rwxr-xr-xbigtop-packages/src/deb/hbase/install_init_scripts.sh35
-rwxr-xr-xbigtop-packages/src/deb/hbase/rules99
-rw-r--r--bigtop-packages/src/deb/hbase/service-init.d.tpl211
-rw-r--r--bigtop-packages/src/deb/hbase/service-postinst.tpl53
-rw-r--r--bigtop-packages/src/deb/hbase/service-postrm.tpl53
17 files changed, 696 insertions, 0 deletions
diff --git a/bigtop-packages/src/deb/hbase/compat b/bigtop-packages/src/deb/hbase/compat
new file mode 100644
index 00000000..1e8b3149
--- /dev/null
+++ b/bigtop-packages/src/deb/hbase/compat
@@ -0,0 +1 @@
+6
diff --git a/bigtop-packages/src/deb/hbase/control b/bigtop-packages/src/deb/hbase/control
new file mode 100644
index 00000000..834c57f2
--- /dev/null
+++ b/bigtop-packages/src/deb/hbase/control
@@ -0,0 +1,56 @@
+# 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.
+Source: hadoop-hbase
+Section: misc
+Priority: extra
+Maintainer: Alex Newman <newalex@cloudera.com>
+Build-Depends: debhelper (>= 6), sun-java6-jdk, git-core, adduser
+Standards-Version: 3.8.0
+Homepage: http://hadoop.apache.org/hbase/
+
+Package: hadoop-hbase
+Architecture: all
+Depends: adduser, sun-java6-jre, hadoop-zookeeper (>= 3.3.1), hadoop
+Recommends: ntp
+Description: HBase is the Hadoop database
+ Use it when you need random, realtime read/write access to your Big Data.
+ This project's goal is the hosting of very large tables -- billions of rows
+ X millions of columns -- atop clusters of commodity hardware.
+
+Package: hadoop-hbase-doc
+Architecture: all
+Section: doc
+Description: Documentation for HBase
+ This package contains the HBase manual and JavaDoc.
+
+Package: hadoop-hbase-master
+Architecture: all
+Depends: hadoop-hbase (= ${source:Version})
+Description: HMaster is the "master server" for a HBase
+ There is only one HMaster for a single HBase deployment.
+
+Package: hadoop-hbase-regionserver
+Architecture: all
+Depends: hadoop-hbase (= ${source:Version})
+Description: HRegionServer makes a set of HRegions available to clients
+ It checks in with the HMaster. There are many HRegionServers in a single
+ HBase deployment.
+
+Package: hadoop-hbase-thrift
+Architecture: all
+Depends: hadoop-hbase (= ${source:Version})
+Description: Provides an HBase Thrift service
+ This package provides a Thrift service interface to the HBase distributed
+ database.
diff --git a/bigtop-packages/src/deb/hbase/copyright b/bigtop-packages/src/deb/hbase/copyright
new file mode 100644
index 00000000..4f30204b
--- /dev/null
+++ b/bigtop-packages/src/deb/hbase/copyright
@@ -0,0 +1,15 @@
+Format: http://dep.debian.net/deps/dep5
+Source: http://hbase.apache.org/
+Upstream-Name: Apache HBase
+
+Files: *
+Copyright: 2008-2011, The Apache Software Foundation
+License: Apache-2.0
+
+Files debian/*
+Copyright: 2011, The Apache Software Foundation
+License: Apache-2.0
+
+License: Apache-2.0
+ On Debian systems, the complete text of the Apache 2.0 license
+ can be found in "/usr/share/common-licenses/Apache-2.0".
diff --git a/bigtop-packages/src/deb/hbase/hadoop-hbase-doc.dirs b/bigtop-packages/src/deb/hbase/hadoop-hbase-doc.dirs
new file mode 100644
index 00000000..bef810f1
--- /dev/null
+++ b/bigtop-packages/src/deb/hbase/hadoop-hbase-doc.dirs
@@ -0,0 +1 @@
+/usr/share/doc/hadoop-hbase-doc/
diff --git a/bigtop-packages/src/deb/hbase/hadoop-hbase-doc.install b/bigtop-packages/src/deb/hbase/hadoop-hbase-doc.install
new file mode 100644
index 00000000..a379d05e
--- /dev/null
+++ b/bigtop-packages/src/deb/hbase/hadoop-hbase-doc.install
@@ -0,0 +1 @@
+/usr/share/doc/hadoop-hbase-doc
diff --git a/bigtop-packages/src/deb/hbase/hadoop-hbase.default b/bigtop-packages/src/deb/hbase/hadoop-hbase.default
new file mode 100644
index 00000000..6060c6a6
--- /dev/null
+++ b/bigtop-packages/src/deb/hbase/hadoop-hbase.default
@@ -0,0 +1,2 @@
+export HADOOP_HOME=/usr/lib/hadoop
+export HBASE_HOME=/usr/lib/hbase
diff --git a/bigtop-packages/src/deb/hbase/hadoop-hbase.dirs b/bigtop-packages/src/deb/hbase/hadoop-hbase.dirs
new file mode 100644
index 00000000..0b73bef4
--- /dev/null
+++ b/bigtop-packages/src/deb/hbase/hadoop-hbase.dirs
@@ -0,0 +1,3 @@
+/usr/bin
+/var/log/hbase
+/etc/default
diff --git a/bigtop-packages/src/deb/hbase/hadoop-hbase.install b/bigtop-packages/src/deb/hbase/hadoop-hbase.install
new file mode 100644
index 00000000..2bdbe2e4
--- /dev/null
+++ b/bigtop-packages/src/deb/hbase/hadoop-hbase.install
@@ -0,0 +1,3 @@
+/usr/lib/hbase
+/usr/bin/hbase
+/etc/hbase
diff --git a/bigtop-packages/src/deb/hbase/hadoop-hbase.manpages b/bigtop-packages/src/deb/hbase/hadoop-hbase.manpages
new file mode 100644
index 00000000..1ba4c0d7
--- /dev/null
+++ b/bigtop-packages/src/deb/hbase/hadoop-hbase.manpages
@@ -0,0 +1 @@
+debian/hbase.1
diff --git a/bigtop-packages/src/deb/hbase/hadoop-hbase.postinst b/bigtop-packages/src/deb/hbase/hadoop-hbase.postinst
new file mode 100644
index 00000000..7d6017b8
--- /dev/null
+++ b/bigtop-packages/src/deb/hbase/hadoop-hbase.postinst
@@ -0,0 +1,44 @@
+#!/bin/sh
+#
+# 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.
+
+# postinst script for hbase
+
+set -e
+
+case "$1" in
+ configure)
+ install -d -m 0755 -o hbase -g hbase /var/log/hbase
+ install -d -m 0755 -o hbase -g hbase /var/run/hbase
+ rm -f /usr/lib/hbase/logs || :
+ rm -f /usr/lib/hbase/pids || :
+
+ chown hbase:hbase -R /var/run/hbase /var/log/hbase
+ ln -s /var/log/hbase /usr/lib/hbase/logs
+ ln -s /var/run/hbase /usr/lib/hbase/pids
+
+ ;;
+
+ abort-upgrade|abort-remove|abort-deconfigure)
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+#DEBHELPER#
diff --git a/bigtop-packages/src/deb/hbase/hadoop-hbase.preinst b/bigtop-packages/src/deb/hbase/hadoop-hbase.preinst
new file mode 100644
index 00000000..3f28d461
--- /dev/null
+++ b/bigtop-packages/src/deb/hbase/hadoop-hbase.preinst
@@ -0,0 +1,61 @@
+#!/bin/sh
+#
+# 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.
+
+# preinst script for hbase
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <new-preinst> `install'
+# * <new-preinst> `install' <old-version>
+# * <new-preinst> `upgrade' <old-version>
+# * <old-preinst> `abort-upgrade' <new-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ install|upgrade)
+ if ! getent passwd hbase >/dev/null; then
+ # Adding system user: hbase.
+ adduser \
+ --system \
+ --group \
+ --home /var/lib/hbase \
+ --gecos "HBase User" \
+ --shell /bin/bash \
+ hbase >/dev/null
+ fi
+ ;;
+
+ abort-upgrade)
+ ;;
+
+ *)
+ echo "preinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/bigtop-packages/src/deb/hbase/hadoop-hbase.prerm b/bigtop-packages/src/deb/hbase/hadoop-hbase.prerm
new file mode 100644
index 00000000..fd9685c5
--- /dev/null
+++ b/bigtop-packages/src/deb/hbase/hadoop-hbase.prerm
@@ -0,0 +1,57 @@
+#!/bin/sh
+#
+# 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.
+
+# prerm script for hbase
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <prerm> `remove'
+# * <old-prerm> `upgrade' <new-version>
+# * <new-prerm> `failed-upgrade' <old-version>
+# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
+# * <deconfigured's-prerm> `deconfigure' `in-favour'
+# <package-being-installed> <version> `removing'
+# <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ remove|upgrade|deconfigure)
+ unlink /usr/lib/hbase/logs
+ ;;
+
+ failed-upgrade)
+ ;;
+
+ *)
+ echo "prerm called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
diff --git a/bigtop-packages/src/deb/hbase/install_init_scripts.sh b/bigtop-packages/src/deb/hbase/install_init_scripts.sh
new file mode 100755
index 00000000..c9b892dd
--- /dev/null
+++ b/bigtop-packages/src/deb/hbase/install_init_scripts.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+#
+# 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.
+
+SRC_PKG=hadoop-hbase
+for node in master regionserver thrift ; do
+ service_pkgdir=debian/$SRC_PKG-$node
+ debdir=$service_pkgdir/DEBIAN
+ template="debian/service-init.d.tpl"
+
+ mkdir -p $service_pkgdir/etc/init.d/ $debdir
+ sed -e "s|@HBASE_DAEMON@|$node|" $template > $service_pkgdir/etc/init.d/$SRC_PKG-$node
+ sed -e "s|@HBASE_DAEMON@|$node|" debian/service-postinst.tpl > $debdir/postinst
+ sed -e "s|@HBASE_DAEMON@|$node|" debian/service-postrm.tpl > $debdir/postrm
+ echo /etc/init.d/$SRC_PKG-$node > $debdir/conffiles
+ chmod 755 $debdir/postinst $debdir/postrm $service_pkgdir/etc/init.d*
+
+ mkdir -p $service_pkgdir/usr/share/lintian/overrides
+ echo "$SRC_PKG-$node: new-package-should-close-itp-bug" > $service_pkgdir/usr/share/lintian/overrides/$SRC_PKG-$node
+
+done
+
diff --git a/bigtop-packages/src/deb/hbase/rules b/bigtop-packages/src/deb/hbase/rules
new file mode 100755
index 00000000..399e11b4
--- /dev/null
+++ b/bigtop-packages/src/deb/hbase/rules
@@ -0,0 +1,99 @@
+#!/usr/bin/make -f
+#
+# 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.
+#
+# -*- makefile -*-
+
+# Uncomment this to turn on verbose mode.
+export DH_VERBOSE=1
+
+# This has to be exported to make some magic below work.
+export DH_OPTIONS
+
+patch: patch-stamp
+patch-stamp:
+ touch $@
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f *-stamp
+ dh_clean
+ find debian -name .\*swp -exec rm -f {} \;
+
+build:
+ dh_testdir
+ mvn clean -DskipTests -Dhbase.version=${HBASE_VERSION} install assembly:assembly -Dmaven.repo.local=${HOME}/.m2/repository
+
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+ sh -x debian/install_hbase.sh \
+ --build-dir=. \
+ --doc-dir=usr/share/doc/hadoop-hbase-doc \
+ --prefix=debian/tmp
+ # Symlink in the dependency jars from their packages. Both of these packages
+ # provide an unversioned symlink foo.jar -> foo-0.1.2.jar.
+ rm debian/tmp/usr/lib/hbase/lib/zookeeper-*.jar
+ rm debian/tmp/usr/lib/hbase/lib/hadoop-*.jar
+ ln -s /usr/lib/zookeeper/zookeeper.jar debian/tmp/usr/lib/hbase/lib/zookeeper.jar
+ ln -s /usr/lib/hadoop/hadoop-core.jar debian/tmp/usr/lib/hbase/lib/hadoop-core.jar
+
+ # Wage war on "executable-not-elf-or-script" warnings:
+ ### ruby scripts should not be executable - they require
+ ### hbase org.jruby.Main <script>
+ find debian/tmp/usr/lib/hbase/bin debian/tmp/usr/lib/hbase/lib -name \*.rb -exec chmod 644 {} \;
+ ### webapps should not be executable either
+ find debian/tmp/usr/lib/hbase/hbase-webapps -type f -exec chmod 644 {} \;
+
+ (dh_lintian) || /bin/true
+
+ touch $@
+
+install-indep:
+ dh_install --sourcedir=debian/tmp
+ sh debian/install_init_scripts.sh
+
+binary-common:
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs
+ dh_installdocs
+ dh_installman
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+ dh_makeshlibs
+ dh_installinit --onlyscripts
+ # dh_installinit has a bug whereby it makes preinst/postinst files
+ # even for subpackages that don't have an init script!
+ rm -f debian/hadoop-hbase-doc*debhelper debian/hadoop-hbase.*debhelper || :
+
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary-indep: build install install-indep
+ $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
+
+binary: binary-indep
+.PHONY: clean build binary-indep binary install configure
diff --git a/bigtop-packages/src/deb/hbase/service-init.d.tpl b/bigtop-packages/src/deb/hbase/service-init.d.tpl
new file mode 100644
index 00000000..11108dbd
--- /dev/null
+++ b/bigtop-packages/src/deb/hbase/service-init.d.tpl
@@ -0,0 +1,211 @@
+#! /bin/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.
+
+# skeleton example file to build /etc/init.d/ scripts.
+# This file should be used to construct scripts for /etc/init.d.
+#
+# Written by Miquel van Smoorenburg <miquels@cistron.nl>.
+# Modified for Debian
+# by Ian Murdock <imurdock@gnu.ai.mit.edu>.
+# Further changes by Javier Fernandez-Sanguino <jfs@debian.org>
+#
+# Version: @(#)skeleton 1.9 26-Feb-2001 miquels@cistron.nl
+#
+### BEGIN INIT INFO
+# Provides: hbase-@HBASE_DAEMON@
+# Required-Start: $network $local_fs $remote_fs
+# Required-Stop: $remote_fs
+# Should-Start: $named
+# Should-Stop:
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Hadoop HBase @HBASE_DAEMON@ daemon
+### END INIT INFO
+
+set -e
+
+# Our default HBASE_HOME and HBASE_PID_DIR
+export HBASE_HOME=/usr/lib/hbase
+export HBASE_PID_DIR=/var/run/hbase
+
+# Include HBase defaults if available
+if [ -f /etc/default/hadoop-hbase ] ; then
+ . /etc/default/hadoop-hbase
+fi
+
+if [ -f /usr/lib/hbase/bin/hbase-config.sh ] ; then
+ . /usr/lib/hbase/bin/hbase-config.sh
+fi
+
+if [ -z "$HBASE_PID_DIR" -o -z "$HBASE_HOME" ]; then
+ echo No HBASE_HOME or HBASE_PID_DIR set.
+ exit 1
+fi
+
+
+install -d -m 0755 -o hbase -g hbase ${HBASE_PID_DIR}
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+DAEMON_SCRIPT=$HBASE_HOME/bin/hbase-daemon.sh
+NAME=hbase-@HBASE_DAEMON@
+DESC="Hadoop HBase @HBASE_DAEMON@ daemon"
+PID_FILE=$HBASE_PID_DIR/hbase-hbase-@HBASE_DAEMON@.pid
+
+
+DODTIME=3 # Time to wait for the server to die, in seconds
+ # If this value is set too low you might not
+ # let some servers to die gracefully and
+ # 'restart' will not work
+
+# Checks if the given pid represents a live process.
+# Returns 0 if the pid is a live process, 1 otherwise
+hbase_is_process_alive() {
+ local pid="$1"
+ ps -fp $pid | grep $pid | grep @HBASE_DAEMON@ > /dev/null 2>&1
+}
+
+# Check if the process associated to a pidfile is running.
+# Return 0 if the pidfile exists and the process is running, 1 otherwise
+hbase_check_pidfile() {
+ local pidfile="$1" # IN
+ local pid
+
+ pid=`cat "$pidfile" 2>/dev/null`
+ if [ "$pid" = '' ]; then
+ # The file probably does not exist or is empty.
+ return 1
+ fi
+
+ set -- $pid
+ pid="$1"
+
+ hbase_is_process_alive $pid
+}
+
+# Kill the process associated to a pidfile
+hbase_stop_pidfile() {
+ local pidfile="$1" # IN
+ local pid
+
+ pid=`cat "$pidfile" 2>/dev/null`
+ if [ "$pid" = '' ]; then
+ # The file probably does not exist or is empty. Success
+ return 0
+ fi
+
+ set -- $pid
+ pid="$1"
+
+ # First try the easy way
+ if hbase_process_kill "$pid" 15; then
+ return 0
+ fi
+
+ # Otherwise try the hard way
+ if hbase_process_kill "$pid" 9; then
+ return 0
+ fi
+
+ return 1
+}
+
+hbase_process_kill() {
+ local pid="$1" # IN
+ local signal="$2" # IN
+ local second
+
+ kill -$signal $pid 2>/dev/null
+
+ # Wait a bit to see if the dirty job has really been done
+ for second in 0 1 2 3 4 5 6 7 8 9 10; do
+ if hbase_is_process_alive "$pid"; then
+ # Success
+ return 0
+ fi
+
+ sleep 1
+ done
+
+ # Timeout
+ return 1
+}
+
+
+start() {
+ su -s /bin/sh hbase -c "$DAEMON_SCRIPT start @HBASE_DAEMON@"
+}
+stop() {
+ su -s /bin/sh hbase -c "$DAEMON_SCRIPT stop @HBASE_DAEMON@"
+}
+
+
+case "$1" in
+ start)
+ echo -n "Starting $DESC: "
+ start
+ if hbase_check_pidfile $PID_FILE ; then
+ echo "$NAME."
+ else
+ echo "ERROR."
+ fi
+ ;;
+ stop)
+ echo -n "Stopping $DESC: "
+ stop
+ if hbase_check_pidfile $PID_FILE ; then
+ echo 'ERROR'
+ else
+ echo "$NAME."
+ fi
+ ;;
+ force-stop)
+ echo -n "Forcefully stopping $DESC: "
+ hbase_stop_pidfile $PID_FILE
+ if hbase_check_pidfile $PID_FILE ; then
+ echo "$NAME."
+ else
+ echo " ERROR."
+ fi
+ ;;
+ force-reload)
+ # check wether $DAEMON is running. If so, restart
+ hbase_check_pidfile $PID_FILE && $0 restart
+ ;;
+ restart)
+ echo -n "Restarting $DESC: "
+ stop
+ [ -n "$DODTIME" ] && sleep $DODTIME
+ $0 start
+ ;;
+ status)
+ echo -n "$NAME is "
+ if hbase_check_pidfile $PID_FILE ; then
+ echo "running"
+ else
+ echo "not running."
+ exit 1
+ fi
+ ;;
+ *)
+ N=/etc/init.d/$NAME
+ # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
+ echo "Usage: $N {start|stop|restart|force-reload|status|force-stop}" >&2
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/bigtop-packages/src/deb/hbase/service-postinst.tpl b/bigtop-packages/src/deb/hbase/service-postinst.tpl
new file mode 100644
index 00000000..690b27d4
--- /dev/null
+++ b/bigtop-packages/src/deb/hbase/service-postinst.tpl
@@ -0,0 +1,53 @@
+#!/bin/sh
+#
+# 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.
+
+# postinst script for hbase
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <postinst> `configure' <most-recently-configured-version>
+# * <old-postinst> `abort-upgrade' <new version>
+# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+# <new-version>
+# * <postinst> `abort-remove'
+# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+# <failed-install-package> <version> `removing'
+# <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ configure)
+ update-rc.d hadoop-hbase-@HBASE_DAEMON@ defaults >/dev/null || exit 1
+ ;;
+
+ abort-upgrade|abort-remove|abort-deconfigure)
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+exit 0
+
+
diff --git a/bigtop-packages/src/deb/hbase/service-postrm.tpl b/bigtop-packages/src/deb/hbase/service-postrm.tpl
new file mode 100644
index 00000000..635fbbd3
--- /dev/null
+++ b/bigtop-packages/src/deb/hbase/service-postrm.tpl
@@ -0,0 +1,53 @@
+#!/bin/sh
+#
+# 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.
+
+# postrm script for hbase
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <postrm> `remove'
+# * <postrm> `purge'
+# * <old-postrm> `upgrade' <new-version>
+# * <new-postrm> `failed-upgrade' <old-version>
+# * <new-postrm> `abort-install'
+# * <new-postrm> `abort-install' <old-version>
+# * <new-postrm> `abort-upgrade' <old-version>
+# * <disappearer's-postrm> `disappear' <overwriter>
+# <overwriter-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ purge)
+ update-rc.d -f hadoop-hbase-@HBASE_DAEMON@ remove > /dev/null || exit 1
+ ;;
+ remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+ ;;
+
+ *)
+ echo "postrm called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+exit 0
+
+