Skip to content
Snippets Groups Projects
Commit 2cf1822b authored by Jan Rinze Peterzon's avatar Jan Rinze Peterzon
Browse files

Task #8079: added build script for qpid and init.d script

parent 5dec7777
No related branches found
No related tags found
No related merge requests found
......@@ -4062,6 +4062,8 @@ QPID/local/bin/qls -text
QPID/local/bin/sendmsg -text
QPID/local/bin/start-qpid -text
QPID/local/bin/stop-qpid -text
QPID/local/sbin/build_qpid -text
QPID/local/sbin/init.d_script -text
RTCP/Cobalt/BrokenAntennaInfo/CMakeLists.txt -text
RTCP/Cobalt/BrokenAntennaInfo/test/CMakeLists.txt -text
RTCP/Cobalt/BrokenAntennaInfo/test/debugbeaminfo.py -text
......
#!/bin/bash
QPIDINSTALLDIR=/opt/qpid
# checkout sources for apache qpid and apache proton
if [[ -x ~/sources/proton ]]
then
echo Skipping svn download because source directory exists
else
cd ~
mkdir -p sources
cd ~/sources
svn co http://svn.apache.org/repos/asf/qpid/proton/tags/0.8/ proton
svn co http://svn.apache.org/repos/asf/qpid/tags/0.30/qpid/ qpid-0.30
fi
# build and install proton libraries
cd ~/sources/proton/
rm -Rf ./BUILD
mkdir BUILD
cd BUILD
cmake -DCMAKE_INSTALL_PREFIX=$QPIDINSTALLDIR -DBUILD_PERL=OFF ../
make
make install
if [ ! -x $QPIDINSTALLDIR/lib/cmake/Proton ]
then
if [ -x $QPIDINSTALLDIR/lib64/cmake/Proton ]
then
# fix for lib64
ln -s $QPIDINSTALLDIR/lib64 $QPIDINSTALLDIR/lib
fi
fi
PROTONDIR=$QPIDINSTALLDIR/lib/cmake/Proton
# build and install QPID C++ broker and libraries
cd ~/sources/qpid-0.30/cpp
rm -Rf ./BUILD
mkdir BUILD
cd BUILD
# extra options when building if there are libraries missing and have ben built in the QPIDINSTALL directory:
# -DBUILD_TESTING=OFF -DCMAKE_INCLUDE_PATH=$QPIDINSTALLDIR/include -DCMAKE_LIBRARY_PATH=$QPIDINSTALLDIR/lib -DCMAKE_INCLUDE_DIRECTORIES_BEFORE=ON
cmake -DCMAKE_INSTALL_PREFIX=$QPIDINSTALLDIR -DProton_DIR=$PROTONDIR -DBUILD_XML=OFF -DBUILD_SSL=OFF -DBUILD_BINDING_RUBY=OFF ../
make -j4
make install
# setup config with 256MB storage per queue max.
cat >> $QPIDINSTALLDIR/etc/qpid/qpidd.conf << \EOF
# max 256MB per queue persistent buffering
num-jfiles=32
jfile-size-pgs=128
EOF
# build and install QPID python generic libs
cd ~/sources/qpid-0.30/python
./setup.py build
./setup.py install --home=$QPIDINSTALLDIR
cd ..
# build and install QPID QMF python libraries
cd ~/sources/qpid-0.30/extras/qmf
./setup.py build
./setup.py install --home=$QPIDINSTALLDIR
cd ../..
# build and install QPID tools
cd ~/sources/qpid-0.30/tools
./setup.py build
./setup.py install --home=$QPIDINSTALLDIR
cd ..
# retrieve current python version
MYPYTHONVERSION=$(python -V 2>&1 | sed "s/\./ /g" | awk ' { print $2"." $3 }')
# create .profile for setting proper environment variables
cat > $QPIDINSTALLDIR/.profile << EOF
export PATH=\$PATH:$QPIDINSTALLDIR/sbin/:$QPIDINSTALLDIR/bin/:$QPIDINSTALLDIR/local/bin/
export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:$QPIDINSTALLDIR/lib:$QPIDINSTALLDIR/local/lib/
export PYTHONPATH=\$PYTHONPATH:$QPIDINSTALLDIR/lib/python/:$QPIDINSTALLDIR/lib/python$MYPYTHONVERSION/site-packages/
EOF
# assure patching a silly python 2.6 only implementation.
if [ "$MYPYTHONVERSION" = "2.4" ]
then
echo "Applying patch on $QPIDINSTALLDIR/lib/python/qpid/messaging/driver.py for Python 2.4.x"
echo "--- $QPIDINSTALLDIR/lib/python/qpid/messaging/driver.py 2015-02-06 14:40:42.000000000 +0000" > /tmp/patch_qpid_driver_python2.4
echo "+++ $QPIDINSTALLDIR/lib/python/qpid/messaging/driver.py 2015-02-06 15:37:54.000000000 +0000" >> /tmp/patch_qpid_driver_python2.4
cat >> /tmp/patch_qpid_driver_python2.4 << \EOF
@@ -1050,10 +1050,16 @@
declare = props.get("x-declare", {})
if type == "topic":
- cmd = ExchangeDeclare(exchange=name, durable=durable) if create_node else None
+ if create_node :
+ cmd = ExchangeDeclare(exchange=name, durable=durable)
+ else:
+ cmd = None
bindings = get_bindings(props, exchange=name)
elif type == "queue":
- cmd = QueueDeclare(queue=name, durable=durable) if create_node else None
+ if create_node :
+ cmd = QueueDeclare(queue=name, durable=durable)
+ else:
+ cmd=None
bindings = get_bindings(props, queue=name)
else:
raise ValueError(type)
EOF
cd /
patch -p1 < /tmp/patch_qpid_driver_python2.4
fi
#! /bin/sh
### BEGIN INIT INFO
# Provides: skeleton
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Chkconfig: 2345 81 19
# Short-Description: Example initscript
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
### END INIT INFO
# Author: Foo Bar <peterzon@astron.nl>
#
# Please remove the "Author" lines above and replace them
# with your own name if you copy and modify this script.
# Do NOT "set -e"
# PATH should only include /usr/* if it runs after the mountnfs.sh script
DAEMON=/opt/qpid/sbin/qpidd
DESC="QPID message broker daemon"
NAME="qpidd"
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
MYID=$( id -u )
SUCMD=""
case "$MYID" in
0) SUCMD="su -l qpid -c "
;;
*)
;;
esac
#
# Function that starts the daemon/service
#
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
$SUCMD start-qpid
return "$?"
# Add code here, if necessary, that waits for the process to be ready
# to handle requests from services started subsequently which depend
# on this one. As a last resort, sleep for some time.
}
#
# Function that stops the daemon/service
#
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
$SUCMD stop-qpid
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
# Wait for children to finish too if this is a daemon that forks
# and if the daemon is only ever run from this initscript.
# If the above conditions are not satisfied then add some other code
# that waits for the process to drop all resources that could be
# needed by services started subsequently. A last resort is to
# sleep for some time.
# Many daemons don't delete their pidfiles when they exit.
return "$RETVAL"
}
#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
#
# If the daemon can reload its configuration without
# restarting (for example, when it is sent a SIGHUP),
# then implement that here.
#
#start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
return 0
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
#reload|force-reload)
#
# If do_reload() is not implemented then leave this commented out
# and leave 'force-reload' as an alias for 'restart'.
#
#log_daemon_msg "Reloading $DESC" "$NAME"
#do_reload
#log_end_msg $?
#;;
restart|force-reload)
#
# If the "reload" option is implemented then remove the
# 'force-reload' alias
#
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment