summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--system/apache-cassandra/apache-cassandra.SlackBuild63
-rw-r--r--system/apache-cassandra/apache-cassandra.info10
-rw-r--r--system/apache-cassandra/cassandra.in.sh46
-rw-r--r--system/apache-cassandra/doinst.sh3
-rw-r--r--system/apache-cassandra/rc.cassandra95
5 files changed, 98 insertions, 119 deletions
diff --git a/system/apache-cassandra/apache-cassandra.SlackBuild b/system/apache-cassandra/apache-cassandra.SlackBuild
index 674ac3ea78..c29685266c 100644
--- a/system/apache-cassandra/apache-cassandra.SlackBuild
+++ b/system/apache-cassandra/apache-cassandra.SlackBuild
@@ -1,8 +1,8 @@
#!/bin/sh
+# Slackware build script for apache-cassandra
#
-# Slackware build script for apache-cassandra-bin
-
# Copyright 2010 Manlio Modugno <manliomodugno -# #- gmail-# #- com>
+# Copyright 2014 Mario Antunes
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -24,12 +24,12 @@
# based on apache-tomcat.SlackBuild by Heinz Wiesinger and Vincent Batts
-PRGNAM=apache-cassandra
-VERSION=0.6.12
-BUILD=${BUILD:-2}
+PRGNAM="apache-cassandra"
+VERSION=${VERSION:-2.0.7}
+BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
-ARCH=noarch
+ARCH="noarch"
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
@@ -46,54 +46,47 @@ tar xvf $CWD/$PRGNAM-$VERSION-bin.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
find -L . \
- \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
- -exec chmod 755 {} \; -o \
- \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
- -exec chmod 644 {} \;
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
mkdir -p $PKG/opt/$PRGNAM
-mkdir -p $PKG/etc/$PRGNAM
-mkdir -p $PKG/var/log/cassandra
-mkdir -p $PKG/var/lib/cassandra
+mkdir -p $PKG/var/log/$PRGNAM
+mkdir -p $PKG/etc/{profile.d,rc.d}
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+
rm -f bin/*.bat
-#####
-cp -rf conf/* interface $PKG/etc/$PRGNAM
-cp -rf bin lib $PKG/opt/$PRGNAM
-mkdir -p $PKG/etc/{profile.d,rc.d}
+cp -rf bin conf interface lib pylib tools $PKG/opt/$PRGNAM
cp $CWD/rc.cassandra $PKG/etc/rc.d/rc.cassandra.new
-cp -f $CWD/cassandra.in.sh $PKG/etc/$PRGNAM/cassandra.in.sh.new
-mv $PKG/etc/apache-cassandra/storage-conf.xml \
- $PKG/etc/apache-cassandra/storage-conf.xml.new
+
+cp -a CHANGES.txt LICENSE.txt NEWS.txt NOTICE.txt README.txt \
+ $PKG/usr/doc/$PRGNAM-$VERSION
+cp -rf javadoc $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
cat << EOF > $PKG/etc/profile.d/$PRGNAM.csh
#!/bin/csh
-setenv CASSANDRA_HOME /opt/$PRGNAM
-setenv CASSANDRA_CONF /etc/$PRGNAM
-setenv CASSANDRA_INCLUDE "\$CASSANDRA_CONF/cassandra.in.sh"
+setenv CASSANDRA_HOME="/opt/$PRGNAM"
+setenv CASSANDRA_CONF="\$CASSANDRA_HOME/conf"
+setenv CASSANDRA_INCLUDE="\$CASSANDRA_HOME/tools/bin/cassandra.in.sh"
+setenv PATH="\$PATH:\$CASSANDRA_HOME/bin"
EOF
cat << EOF > $PKG/etc/profile.d/$PRGNAM.sh
#!/bin/sh
-export CASSANDRA_HOME=/opt/$PRGNAM
-export CASSANDRA_CONF=/etc/$PRGNAM
-export CASSANDRA_INCLUDE="\$CASSANDRA_CONF/cassandra.in.sh"
+export CASSANDRA_HOME="/opt/$PRGNAM"
+export CASSANDRA_CONF="\$CASSANDRA_HOME/conf"
+export CASSANDRA_INCLUDE="\$CASSANDRA_HOME/tools/bin/cassandra.in.sh"
+export PATH="\$PATH:\$CASSANDRA_HOME/bin"
EOF
chmod 0755 $PKG/etc/profile.d/*
-# Documentation
-mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
-cp -a CHANGES.txt LICENSE.txt NEWS.txt NOTICE.txt README.txt \
- $PKG/usr/doc/$PRGNAM-$VERSION
-cp -rf javadoc $PKG/usr/doc/$PRGNAM-$VERSION
-cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
-
-####
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
-
diff --git a/system/apache-cassandra/apache-cassandra.info b/system/apache-cassandra/apache-cassandra.info
index d8153564cd..887836f517 100644
--- a/system/apache-cassandra/apache-cassandra.info
+++ b/system/apache-cassandra/apache-cassandra.info
@@ -1,10 +1,10 @@
PRGNAM="apache-cassandra"
-VERSION="0.6.12"
+VERSION="2.0.7"
HOMEPAGE="http://cassandra.apache.org/"
-DOWNLOAD="https://archive.apache.org/dist/cassandra/0.6.12/apache-cassandra-0.6.12-bin.tar.gz"
-MD5SUM="ad8a62259b734a94f52801a4c8036217"
+DOWNLOAD="http://apache.mirror.quintex.com/cassandra/2.0.7/apache-cassandra-2.0.7-bin.tar.gz"
+MD5SUM="1894c5103d12a2be14a2c44bfa2363cc"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES="jdk"
-MAINTAINER="Manlio Modugno"
-EMAIL="manliomodugno -# #- gmail-# #- com"
+MAINTAINER="Mario Antunes"
+EMAIL="mariolpantunes@gmail.com"
diff --git a/system/apache-cassandra/cassandra.in.sh b/system/apache-cassandra/cassandra.in.sh
deleted file mode 100644
index 54be13c33d..0000000000
--- a/system/apache-cassandra/cassandra.in.sh
+++ /dev/null
@@ -1,46 +0,0 @@
-# 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.
-
-# This can be the path to a jar file, or a directory containing the
-# compiled classes. NOTE: This isn't needed by the startup script,
-# it's just used here in constructing the classpath.
-cassandra_bin=$CASSANDRA_HOME/build/classes
-#cassandra_bin=$cassandra_home/build/cassandra.jar
-
-# JAVA_HOME can optionally be set here
-#JAVA_HOME=/usr/local/jdk6
-
-# The java classpath (required)
-CLASSPATH=$CASSANDRA_CONF:$cassandra_bin
-
-for jar in $CASSANDRA_HOME/lib/*.jar; do
- CLASSPATH=$CLASSPATH:$jar
-done
-
-# Arguments to pass to the JVM
-JVM_OPTS=" \
- -ea \
- -Xms256M \
- -Xmx1G \
- -XX:+UseParNewGC \
- -XX:+UseConcMarkSweepGC \
- -XX:+CMSParallelRemarkEnabled \
- -XX:SurvivorRatio=8 \
- -XX:MaxTenuringThreshold=1 \
- -XX:+HeapDumpOnOutOfMemoryError \
- -Dcom.sun.management.jmxremote.port=8080 \
- -Dcom.sun.management.jmxremote.ssl=false \
- -Dcom.sun.management.jmxremote.authenticate=false"
diff --git a/system/apache-cassandra/doinst.sh b/system/apache-cassandra/doinst.sh
index 06483c5804..786d1b22b8 100644
--- a/system/apache-cassandra/doinst.sh
+++ b/system/apache-cassandra/doinst.sh
@@ -23,6 +23,3 @@ preserve_perms() {
}
preserve_perms etc/rc.d/rc.cassandra.new
-preserve_perms etc/apache-cassandra/storage-conf.xml.new
-preserve_perms etc/apache-cassandra/cassandra.in.sh.new
-
diff --git a/system/apache-cassandra/rc.cassandra b/system/apache-cassandra/rc.cassandra
index 97a8e8f172..8fa5d9a7ce 100644
--- a/system/apache-cassandra/rc.cassandra
+++ b/system/apache-cassandra/rc.cassandra
@@ -1,41 +1,76 @@
#!/bin/bash
-set -e
+export JAVA="/usr/lib64/java/bin/java"
+export CASSANDRA_HOME="/opt/apache-cassandra"
+export CASSANDRA_CONF="$CASSANDRA_HOME/conf"
+export CASSANDRA_INCLUDE="$CASSANDRA_HOME/tools/bin/cassandra.in.sh"
-CASSANDRA_BIN_PATH="/opt/apache-cassandra/bin"
-PID_FILE="/var/run/cassandra.pid"
+PRG="cassandra"
+DIR="/opt/apache-cassandra/bin/"
+PID_DIRECTORY="/var/run"
+PID_FILE="$PID_DIRECTORY/$PRG.pid"
-stop_cassandra(){
- kill `cat $PID_FILE`
- rm -f $PID_FILE
+function isRunning() {
+[[ ! -f "$PID_FILE" ]] && return 1
+PID="$(<"$PID_FILE")"
+[[ -z "$PID" ]] && return 1
+[[ ! $(ps -p $PID | grep $PID) == "" ]] && RV=0 || RV=1
+return $RV
}
-if [ ! -d $CASSANDRA_BIN_PATH ]; then
- echo
- echo "Cassandra is not installed on this machine!"
- echo "Please check cassandra installation or set var CASSANDRA_BIN_PATH properly"
- echo
- exit 1
+function status() {
+isRunning
+STATUS=$?
+if [[ $STATUS -eq 0 ]]; then
+ echo -e "Service $PRG is running"
+else
+ echo -e "Service $PRG is not running."
fi
+}
+
+function start() {
+isRunning
+STATUS=$?
+if [[ $STATUS -eq 0 ]]; then
+ echo -e "Service $PRG is already running."
+else
+ echo -e "Start service $PRG"
+ $DIR$PRG -p $PID_FILE > /dev/null 2>&1 &
+fi
+}
+
+function stop() {
+isRunning
+STATUS=$?
+if [[ $STATUS -eq 0 ]]; then
+ echo -e "Stop service $PRG"
+ PID="$(<"$PID_FILE")"
+ kill $PID
+ rm "$PID_FILE"
+else
+ echo -e "Service $PRG not running."
+fi
+}
case $1 in
- start)
- echo " * Starting Cassandra..."
- $CASSANDRA_BIN_PATH/cassandra -p $PID_FILE > /dev/null 2>&1
- ;;
- stop)
- echo " * Stopping Cassandra..."
- stop_cassandra
- ;;
- restart)
- echo " * Rerstarting Cassandra..."
- stop_cassandra
- sleep 3
- $CASSANDRA_BIN_PATH/cassandra -p $PID_FILE > /dev/null 2>&1
- ;;
- *)
- echo " * Please provide correct option between start|stop|restart"
- ;;
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ start
+ sleep 1
+ stop
+ ;;
+ status)
+ status
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|status}"
+ exit 1
+ ;;
esac
-
+exit 0