From 261baf17c20e8d2ce06dcf06fca743e5aa5a6f5d Mon Sep 17 00:00:00 2001 From: vagrant Date: Mon, 5 Aug 2013 16:21:56 +0000 Subject: [PATCH] Created Debian Package for Ozone install (Pull request by Christian Richter) --- stratosphere-dist/pom.xml | 142 ++++++++++++ .../src/deb/bin/nephele-jobmanager | 218 ++++++++++++++++++ .../src/deb/bin/nephele-taskmanager | 218 ++++++++++++++++++ .../src/deb/bin/pact-webfrontend | 218 ++++++++++++++++++ stratosphere-dist/src/deb/control/control | 8 + stratosphere-dist/src/deb/control/postinst | 55 +++++ 6 files changed, 859 insertions(+) create mode 100755 stratosphere-dist/src/deb/bin/nephele-jobmanager create mode 100755 stratosphere-dist/src/deb/bin/nephele-taskmanager create mode 100755 stratosphere-dist/src/deb/bin/pact-webfrontend create mode 100644 stratosphere-dist/src/deb/control/control create mode 100644 stratosphere-dist/src/deb/control/postinst diff --git a/stratosphere-dist/pom.xml b/stratosphere-dist/pom.xml index e9dc6d97014..cac7f0cc9dc 100644 --- a/stratosphere-dist/pom.xml +++ b/stratosphere-dist/pom.xml @@ -112,6 +112,148 @@ + + jdeb + org.vafer + 1.0.1 + + + package + + jdeb + + + ${project.build.directory}/${project.artifactId}_${project.version}.deb + ${basedir}/src/deb/control + + + ${basedir}/src/deb/bin/nephele-jobmanager + file + + perm + /etc/init.d + root + root + 0755 + + + + ${basedir}/src/deb/bin/nephele-taskmanager + file + + perm + /etc/init.d + root + root + 0755 + + + + ${basedir}/src/deb/bin/pact-webfrontend + file + + perm + /etc/init.d + root + root + 0755 + + + + ${project.build.directory}/${project.artifactId}-${project.version}-bin/stratosphere-${project.version}/bin + directory + + perm + /usr/share/${project.artifactId}/bin + root + root + 0755 + + + + ${project.build.directory}/${project.artifactId}-${project.version}-bin/stratosphere-${project.version}/docs + directory + + perm + /usr/share/${project.artifactId}/docs + root + root + + + + ${project.build.directory}/${project.artifactId}-${project.version}-bin/stratosphere-${project.version}/examples + directory + + perm + /usr/share/${project.artifactId}/examples + root + root + + + + ${project.build.directory}/${project.artifactId}-${project.version}-bin/stratosphere-${project.version}/lib + directory + + perm + /usr/share/${project.artifactId}/lib + root + root + + + + ${project.build.directory}/${project.artifactId}-${project.version}-bin/stratosphere-${project.version}/lib_clients + directory + + perm + /usr/share/${project.artifactId}/lib_clients + root + root + + + + ${project.build.directory}/${project.artifactId}-${project.version}-bin/stratosphere-${project.version}/resources + directory + + perm + /usr/share/${project.artifactId}/resources + root + root + + + + ${project.build.directory}/${project.artifactId}-${project.version}-bin/stratosphere-${project.version}/conf + directory + + perm + /etc/${project.artifactId}/conf + root + root + + + + template + + /var/log/${project.artifactId} + + + + link + /usr/share/${project.artifactId}/conf + /etc/${project.artifactId}/conf + true + + + link + /usr/share/${project.artifactId}/log + /var/log/${project.artifactId} + true + + + + + + + diff --git a/stratosphere-dist/src/deb/bin/nephele-jobmanager b/stratosphere-dist/src/deb/bin/nephele-jobmanager new file mode 100755 index 00000000000..c27666a8cf9 --- /dev/null +++ b/stratosphere-dist/src/deb/bin/nephele-jobmanager @@ -0,0 +1,218 @@ +#! /bin/sh +# +# 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 . +# Modified for Debian +# by Ian Murdock . +# Further changes by Javier Fernandez-Sanguino +# +# Version: @(#)skeleton 1.9 26-Feb-2001 miquels@cistron.nl +# +# Starts a Nephele tasktracker +# +# chkconfig: 2345 85 15 +# description: Nephele jobmanager +# +### BEGIN INIT INFO +# Provides: nephele-jobmanager +# Required-Start: $network $local_fs +# Required-Stop: +# Should-Start: $named +# Should-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Nephele jobmanager daemon +### END INIT INFO + +# Include hadoop defaults if available +if [ -f /etc/default/nephele ] ; then + . /etc/default/nephele +fi + + +if [ "$NEPHELE_PID_DIR" = "" ]; then + NEPHELE_PID_DIR=/tmp +fi + +if [ "$NEPHELE_IDENT_STRING" = "" ]; then + NEPHELE_IDENT_STRING="$USER" +fi + +NEPHELE_HOME=/usr/share/stratosphere-dist +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DAEMON_SCRIPT=$NEPHELE_HOME/bin/nephele-jobmanager.sh +NAME=nephele-jobmanager +DESC="Nephele jobmanager daemon" +PID_FILE=$NEPHELE_PID_DIR/nephele-$NEPHELE_IDENT_STRING-jobmanager.pid + +test -x $DAEMON_SCRIPT || exit 1 + + +DODTIME=5 # 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 +nephele_is_process_alive() { + local pid="$1" + ps -fp $pid | grep $pid | grep jobmanager > /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 +nephele_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" + + nephele_is_process_alive $pid +} + +nephele_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 nephele_is_process_alive "$pid"; then + # Success + return 0 + fi + + sleep 1 + done + + # Timeout + return 1 +} + +# Kill the process associated to a pidfile +nephele_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 nephele_process_kill "$pid" 15; then + return 0 + fi + + # Otherwise try the hard way + if nephele_process_kill "$pid" 9; then + return 0 + fi + + return 1 +} + +start() { + $NEPHELE_HOME/bin/nephele-jobmanager.sh start cluster +} + +stop() { + $NEPHELE_HOME/bin/nephele-jobmanager.sh stop +} + +check_for_root() { + if [ $(id -ur) -ne 0 ]; then + echo 'Error: root user required' + echo + exit 1 + fi +} + +nephele_service() { + case "$1" in + start) + check_for_root + echo -n "Starting $DESC: " + start + + if nephele_check_pidfile $PID_FILE ; then + echo "$NAME." + else + echo "ERROR. Could not start $DESC" + exit 1 + fi + ;; + stop) + check_for_root + echo -n "Stopping $DESC: " + stop + [ -n "$DODTIME" ] && sleep $DODTIME + + if nephele_check_pidfile $PID_FILE ; then + echo "ERROR. Could not stop $DESC" + exit 1 + else + echo "$NAME." + fi + ;; + force-stop) + check_for_root + echo -n "Forcefully stopping $DESC: " + nephele_stop_pidfile $PID_FILE + [ -n "$DODTIME" ] && sleep $DODTIME + + if ! nephele_check_pidfile $PID_FILE ; then + echo "$NAME." + else + echo "ERROR. Could not force stop $DESC" + exit 1 + fi + ;; + force-reload) + check_for_root + echo -n "Forcefully reloading $DESC: " + nephele_check_pidfile $PID_FILE && $0 restart + ;; + restart) + check_for_root + echo -n "Restarting $DESC: " + stop + [ -n "$DODTIME" ] && sleep $DODTIME + $0 start + ;; + status) + echo -n "$NAME is " + if nephele_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|force-reload|status|force-stop}" >&2 + exit 1 + ;; + esac +} + +nephele_service "$1" + +exit 0 diff --git a/stratosphere-dist/src/deb/bin/nephele-taskmanager b/stratosphere-dist/src/deb/bin/nephele-taskmanager new file mode 100755 index 00000000000..d856930e465 --- /dev/null +++ b/stratosphere-dist/src/deb/bin/nephele-taskmanager @@ -0,0 +1,218 @@ +#! /bin/sh +# +# 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 . +# Modified for Debian +# by Ian Murdock . +# Further changes by Javier Fernandez-Sanguino +# +# Version: @(#)skeleton 1.9 26-Feb-2001 miquels@cistron.nl +# +# Starts a Nephele tasktracker +# +# chkconfig: 2345 85 15 +# description: Nephele taskmanager +# +### BEGIN INIT INFO +# Provides: nephele-taskmanager +# Required-Start: $network $local_fs +# Required-Stop: +# Should-Start: $named +# Should-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Nephele taskmanager daemon +### END INIT INFO + +# Include hadoop defaults if available +if [ -f /etc/default/nephele ] ; then + . /etc/default/nephele +fi + + +if [ "$NEPHELE_PID_DIR" = "" ]; then + NEPHELE_PID_DIR=/tmp +fi + +if [ "$NEPHELE_IDENT_STRING" = "" ]; then + NEPHELE_IDENT_STRING="$USER" +fi + +NEPHELE_HOME=/usr/share/stratosphere-dist +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DAEMON_SCRIPT=$NEPHELE_HOME/bin/nephele-taskmanager.sh +NAME=nephele-taskmanager +DESC="Nephele taskmanager daemon" +PID_FILE=$NEPHELE_PID_DIR/nephele-$NEPHELE_IDENT_STRING-taskmanager.pid + +test -x $DAEMON_SCRIPT || exit 1 + + +DODTIME=5 # 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 +nephele_is_process_alive() { + local pid="$1" + ps -fp $pid | grep $pid | grep taskmanager > /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 +nephele_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" + + nephele_is_process_alive $pid +} + +nephele_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 nephele_is_process_alive "$pid"; then + # Success + return 0 + fi + + sleep 1 + done + + # Timeout + return 1 +} + +# Kill the process associated to a pidfile +nephele_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 nephele_process_kill "$pid" 15; then + return 0 + fi + + # Otherwise try the hard way + if nephele_process_kill "$pid" 9; then + return 0 + fi + + return 1 +} + +start() { + $NEPHELE_HOME/bin/nephele-taskmanager.sh start +} + +stop() { + $NEPHELE_HOME/bin/nephele-taskmanager.sh stop +} + +check_for_root() { + if [ $(id -ur) -ne 0 ]; then + echo 'Error: root user required' + echo + exit 1 + fi +} + +nephele_service() { + case "$1" in + start) + check_for_root + echo -n "Starting $DESC: " + start + + if nephele_check_pidfile $PID_FILE ; then + echo "$NAME." + else + echo "ERROR. Could not start $DESC" + exit 1 + fi + ;; + stop) + check_for_root + echo -n "Stopping $DESC: " + stop + [ -n "$DODTIME" ] && sleep $DODTIME + + if nephele_check_pidfile $PID_FILE ; then + echo "ERROR. Could not stop $DESC" + exit 1 + else + echo "$NAME." + fi + ;; + force-stop) + check_for_root + echo -n "Forcefully stopping $DESC: " + nephele_stop_pidfile $PID_FILE + [ -n "$DODTIME" ] && sleep $DODTIME + + if ! nephele_check_pidfile $PID_FILE ; then + echo "$NAME." + else + echo "ERROR. Could not force stop $DESC" + exit 1 + fi + ;; + force-reload) + check_for_root + echo -n "Forcefully reloading $DESC: " + nephele_check_pidfile $PID_FILE && $0 restart + ;; + restart) + check_for_root + echo -n "Restarting $DESC: " + stop + [ -n "$DODTIME" ] && sleep $DODTIME + $0 start + ;; + status) + echo -n "$NAME is " + if nephele_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|force-reload|status|force-stop}" >&2 + exit 1 + ;; + esac +} + +nephele_service "$1" + +exit 0 diff --git a/stratosphere-dist/src/deb/bin/pact-webfrontend b/stratosphere-dist/src/deb/bin/pact-webfrontend new file mode 100755 index 00000000000..2663dab93c2 --- /dev/null +++ b/stratosphere-dist/src/deb/bin/pact-webfrontend @@ -0,0 +1,218 @@ +#! /bin/sh +# +# 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 . +# Modified for Debian +# by Ian Murdock . +# Further changes by Javier Fernandez-Sanguino +# +# Version: @(#)skeleton 1.9 26-Feb-2001 miquels@cistron.nl +# +# Starts a Nephele tasktracker +# +# chkconfig: 2345 85 15 +# description: Pact webfrontend +# +### BEGIN INIT INFO +# Provides: pact-webfrontend +# Required-Start: $network $local_fs +# Required-Stop: +# Should-Start: $named +# Should-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Pact webfrontend daemon +### END INIT INFO + +# Include hadoop defaults if available +if [ -f /etc/default/nephele ] ; then + . /etc/default/nephele +fi + + +if [ "$NEPHELE_PID_DIR" = "" ]; then + NEPHELE_PID_DIR=/tmp +fi + +if [ "$NEPHELE_IDENT_STRING" = "" ]; then + NEPHELE_IDENT_STRING="$USER" +fi + +NEPHELE_HOME=/usr/share/stratosphere-dist +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DAEMON_SCRIPT=$NEPHELE_HOME/bin/pact-webfrontend.sh +NAME=pact-webfrontend +DESC="Pact webfrontend daemon" +PID_FILE=$NEPHELE_PID_DIR/nephele-$NEPHELE_IDENT_STRING-pact-web.pid + +test -x $DAEMON_SCRIPT || exit 1 + + +DODTIME=5 # 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 +nephele_is_process_alive() { + local pid="$1" + ps -fp $pid | grep $pid | grep pact-web > /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 +nephele_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" + + nephele_is_process_alive $pid +} + +nephele_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 nephele_is_process_alive "$pid"; then + # Success + return 0 + fi + + sleep 1 + done + + # Timeout + return 1 +} + +# Kill the process associated to a pidfile +nephele_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 nephele_process_kill "$pid" 15; then + return 0 + fi + + # Otherwise try the hard way + if nephele_process_kill "$pid" 9; then + return 0 + fi + + return 1 +} + +start() { + $NEPHELE_HOME/bin/pact-webfrontend.sh start +} + +stop() { + $NEPHELE_HOME/bin/pact-webfrontend.sh stop +} + +check_for_root() { + if [ $(id -ur) -ne 0 ]; then + echo 'Error: root user required' + echo + exit 1 + fi +} + +nephele_service() { + case "$1" in + start) + check_for_root + echo -n "Starting $DESC: " + start + + if nephele_check_pidfile $PID_FILE ; then + echo "$NAME." + else + echo "ERROR. Could not start $DESC" + exit 1 + fi + ;; + stop) + check_for_root + echo -n "Stopping $DESC: " + stop + [ -n "$DODTIME" ] && sleep $DODTIME + + if nephele_check_pidfile $PID_FILE ; then + echo "ERROR. Could not stop $DESC" + exit 1 + else + echo "$NAME." + fi + ;; + force-stop) + check_for_root + echo -n "Forcefully stopping $DESC: " + nephele_stop_pidfile $PID_FILE + [ -n "$DODTIME" ] && sleep $DODTIME + + if ! nephele_check_pidfile $PID_FILE ; then + echo "$NAME." + else + echo "ERROR. Could not force stop $DESC" + exit 1 + fi + ;; + force-reload) + check_for_root + echo -n "Forcefully reloading $DESC: " + nephele_check_pidfile $PID_FILE && $0 restart + ;; + restart) + check_for_root + echo -n "Restarting $DESC: " + stop + [ -n "$DODTIME" ] && sleep $DODTIME + $0 start + ;; + status) + echo -n "$NAME is " + if nephele_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|force-reload|status|force-stop}" >&2 + exit 1 + ;; + esac +} + +nephele_service "$1" + +exit 0 diff --git a/stratosphere-dist/src/deb/control/control b/stratosphere-dist/src/deb/control/control new file mode 100644 index 00000000000..d7cf41b364c --- /dev/null +++ b/stratosphere-dist/src/deb/control/control @@ -0,0 +1,8 @@ +Package: [[name]] +Version: 0.2 +Section: misc +Depends: java6-runtime +Priority: low +Architecture: all +Description: [[description]] +Maintainer: christian_richter@gmx.de \ No newline at end of file diff --git a/stratosphere-dist/src/deb/control/postinst b/stratosphere-dist/src/deb/control/postinst new file mode 100644 index 00000000000..6c687120541 --- /dev/null +++ b/stratosphere-dist/src/deb/control/postinst @@ -0,0 +1,55 @@ +#!/bin/sh +# postinst script for importer + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-remove' +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + +case "$1" in + configure) + if ! getent group ozone >/dev/null; then + addgroup --system ozone + fi + + if ! getent passwd stratosphere >/dev/null; then + adduser --quiet \ + --system \ + --ingroup ozone \ + --quiet \ + --disabled-login \ + --disabled-password \ + --home /usr/share/stratosphere-dist \ + --no-create-home \ + -gecos "Stratosphere User" \ + stratosphere + fi + + if [ -z "$2" ]; then + chown -R stratosphere:ozone /var/log/stratosphere-dist + fi + sed -i s'#./resources/web-docs#/usr/share/stratosphere-dist/resources/web-docs#' /usr/share/stratosphere-dist/conf/pact-user.xml + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# \ No newline at end of file -- GitLab