packages: riak/riak.init (NEW), riak/riak.spec (NEW), riak/riak.tmpfiles.co...

aredridel aredridel at pld-linux.org
Sun Apr 22 23:11:22 CEST 2012


Author: aredridel                    Date: Sun Apr 22 21:11:22 2012 GMT
Module: packages                      Tag: HEAD
---- Log message:
Added to repository. NFY

---- Files affected:
packages/riak:
   riak.init (NONE -> 1.1)  (NEW), riak.spec (NONE -> 1.1)  (NEW), riak.tmpfiles.conf (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/riak/riak.init
diff -u /dev/null packages/riak/riak.init:1.1
--- /dev/null	Sun Apr 22 23:11:22 2012
+++ packages/riak/riak.init	Sun Apr 22 23:11:16 2012
@@ -0,0 +1,106 @@
+#!/bin/bash
+#
+# Riak Distributed Data Store
+#
+# chkconfig: 2345 80 30
+# description: Riak is a distributed data store.
+# processname: beam 
+# config: /etc/riak/app.config
+# config: /etc/riak/vm.args
+#
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+#check for script,config, and data dirs
+[ -x /usr/sbin/riak ] || exit 0
+[ -d /etc/riak ] || exit 0
+[ -d /var/lib/riak ] || exit 0
+
+# Create /var/run/riak if necessary (/var/run may be in a tmpfs filesystem).
+if [ ! -d /var/run/riak ]; then
+    mkdir -p /var/run/riak
+    chown riak:riak /var/run/riak
+fi
+
+RETVAL=0
+
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+DESC="a distributed key value store"
+NAME=riak
+DAEMON=/usr/sbin/$NAME
+
+
+start() {
+    #Check if Riak is running
+    RETVAL=`su - riak -c "$DAEMON ping"`
+    [ "$RETVAL" = "pong" ] && echo "Riak is already running" && return 1
+
+    # Start daemons.
+    echo -n $"Starting Riak: "
+    su - riak -c "$DAEMON start" && success || failure $"$NAME start"
+    RETVAL=$?
+    [ $RETVAL -eq 0 ]
+    echo
+    return $RETVAL
+}
+
+stop() {
+    # Stop daemon.
+    echo -n $"Stopping Riak: "
+    RETVAL=`su - riak -c "$DAEMON ping"`
+    [ "$RETVAL" = "pong" ] && su - riak -c "$DAEMON stop 2>/dev/null 1>&2" 
+    sleep 2
+    RETVAL=`pidof beam.smp`
+    [ "$RETVAL" = "" ] && success && echo && return 0 || failure $"$NAME stop"
+    sleep 10
+    RETVAL=`pidof beam.smp`
+    [ "$RETVAL" = "" ] && success && echo && return 0 || failure $"$NAME failed to stop"
+    echo
+    return 1
+}
+
+reload() {
+    # Restart the VM without exiting the process
+    echo -n $"Reloading Riak: "
+    RETVAL=`su - riak -c "$DAEMON ping"`
+    [ "$RETVAL" = "pong" ] && su - riak -c "$DAEMON restart 2>/dev/null 1>&2" \
+        && success && echo && return 0 || failure $"$NAME restart" 
+    echo
+    return $RETVAL
+}
+
+status() {
+    RETVAL=`su - riak -c "$DAEMON ping"`
+    [ "$RETVAL" = "pong" ] && echo $"$NAME is running..." && return 0
+    echo $"$NAME is stopped"
+    return 3
+}
+
+# See how we were called.
+case "$1" in
+  start)
+        start
+        ;;
+  stop)
+        stop
+	;;
+  restart)
+        stop
+	start
+	;;
+  reload)
+	reload
+	;;
+  status)
+	status
+	;;
+  ping)
+        su - riak -c "$DAEMON ping" || exit $?
+        ;;
+  *)
+        echo $"Usage: $0 {start|stop|reload|restart|ping}"
+	exit 1
+esac
+
+exit $?

================================================================
Index: packages/riak/riak.spec
diff -u /dev/null packages/riak/riak.spec:1.1
--- /dev/null	Sun Apr 22 23:11:22 2012
+++ packages/riak/riak.spec	Sun Apr 22 23:11:16 2012
@@ -0,0 +1,146 @@
+# $Revision$, $Date$
+# TODO:
+# - package dependencies separately
+Name:		riak
+Version:	1.1.2
+Release:	0
+License:	Apache
+Group:		Development/Libraries
+Source0:	http://downloads.basho.com/riak/CURRENT/%{name}-%{version}.tar.gz
+# Source0-md5:	2820cc52942c778656d9dc839247dbb4
+Source1:	%{name}.init
+Source2:	%{name}.tmpfiles.conf
+Summary:	Riak Distributed Data Store
+URL:		http://basho.com
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+Riak is a distrubuted data store.
+
+%prep
+%setup -q
+cat > rel/vars.config <<EOF
+% app.config
+{web_ip,       "127.0.0.1"}.
+{web_port,     8098}.
+{handoff_port, 8099}.
+{pb_ip,        "127.0.0.1"}.
+{pb_port,      8087}.
+{ring_state_dir,        "%{_sharedstatedir}/%{name}/ring"}.
+{bitcask_data_root,     "%{_sharedstatedir}/%{name}/bitcask"}.
+{leveldb_data_root,     "%{_sharedstatedir}/%{name}/leveldb"}.
+{merge_index_data_root,    "%{_sharedstatedir}/%{name}/merge_index"}.
+{merge_index_data_root_2i, "%{_sharedstatedir}/%{name}/merge_index_2i"}.
+{sasl_error_log,        "/var/log/%{name}/sasl-error.log"}.
+{sasl_log_dir,          "/var/log/%{name}/sasl"}.
+{mapred_queue_dir,      "%{_sharedstatedir}/%{name}/mr_queue"}.
+{map_js_vms,   8}.
+{reduce_js_vms, 6}.
+{hook_js_vms, 2}.
+% Platform-specific installation paths
+{platform_bin_dir,  "%{_bindir}"}.
+{platform_data_dir, "%{_sharedstatedir}/%{name}"}.
+{platform_etc_dir, "%{_sysconfdir}/%{name}"}.
+{platform_lib_dir,  "%{_libdir}/%{name}"}.
+{platform_log_dir,  "/var/log/%{name}"}.
+% vm.args
+{node,              "riak at 127.0.0.1"}.
+{crash_dump,        "/var/log/%{name}/erl_crash.dump"}.
+% bin/riak*
+{runner_script_dir,  "%{_bindir}"}.
+{runner_base_dir,    "%{_libdir}/%{name}"}.
+{runner_etc_dir, "%{_sysconfdir}/%{name}"}.
+{runner_log_dir,     "/var/log/%{name}"}.
+{pipe_dir,           "%{_varrun}/%{name}/"}.
+{runner_user,        "%{name}"}.
+EOF
+cp rel/files/riak rel/files/riak.tmp
+sed -e "s/^RIAK_VERSION.*$/RIAK_VERSION=\"%{_versionstring}\"/" < rel/files/riak.tmp > rel/files/riak
+
+%build
+mkdir %{name}
+%{__make} rel
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT%{_sysconfdir}/riak
+install -d $RPM_BUILD_ROOT%{_libdir}/%{name}
+install -d $RPM_BUILD_ROOT%{_mandir}/man1
+install -d $RPM_BUILD_ROOT%{_sharedstatedir}/%{name}/dets
+install -d $RPM_BUILD_ROOT%{_sharedstatedir}/%{name}/bitcask
+install -d $RPM_BUILD_ROOT%{_sharedstatedir}/%{name}/leveldb
+install -d $RPM_BUILD_ROOT%{_sharedstatedir}/%{name}/ring
+install -d $RPM_BUILD_ROOT%{_sharedstatedir}/%{name}/merge_index
+install -d $RPM_BUILD_ROOT/var/log/%{name}
+install -d $RPM_BUILD_ROOT/var/log/%{name}/sasl
+install -d $RPM_BUILD_ROOT%{_varrun}/%{name}
+install -d $RPM_BUILD_ROOT%{_sharedstatedir}/%{name}/mr_queue
+
+#Copy all necessary lib files etc.
+cp -r rel/%{name}/lib $RPM_BUILD_ROOT%{_libdir}/%{name}/
+cp -r rel/%{name}/erts-* \
+		$RPM_BUILD_ROOT%{_libdir}/%{name}
+cp -r rel/%{name}/releases \
+		$RPM_BUILD_ROOT%{_libdir}/%{name}
+cp -r doc/man/man1/*.gz \
+		$RPM_BUILD_ROOT%{_mandir}/man1
+install -p -D \
+rel/%{name}%{_sysconfdir}/app.config \
+$RPM_BUILD_ROOT%{_sysconfdir}/riak/
+install -p -D \
+rel/%{name}%{_sysconfdir}/vm.args \
+$RPM_BUILD_ROOT%{_sysconfdir}/riak/
+install -p -D \
+	rel/%{name}/bin/%{name} \
+	$RPM_BUILD_ROOT/%{_bindir}/%{name}
+install -p -D \
+	rel/%{name}/bin/%{name}-admin \
+	$RPM_BUILD_ROOT/%{_bindir}/%{name}-admin
+install -p -D \
+	rel/%{name}/bin/search-cmd \
+	$RPM_BUILD_ROOT/%{_bindir}/search-cmd
+
+install -d $RPM_BUILD_ROOT/etc/rc.d/init.d/
+install -p -D %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
+
+install -d $RPM_BUILD_ROOT/%{_sysconfdir}/tmpfiles.d/
+install %{SOURCE2} $RPM_BUILD_ROOT/%{_sysconfdir}/tmpfiles.d/%{name}.conf
+
+%pre
+%groupadd -g 281 riak
+%useradd -u 281 -d %{_sharedstatedir}/%{name} -s /bin/sh -g riak -c "Riak Server" riak
+
+%post
+[ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>&1
+/sbin/ldconfig
+/sbin/chkconfig --add riak
+%service riak restart
+
+%files
+%defattr(644,root,root,755)
+%attr(-,root,root) %{_libdir}/*
+%dir %{_sysconfdir}/%{name}
+%config(noreplace) %{_sysconfdir}/%{name}/*
+%config(noreplace) %{_sysconfdir}/tmpfiles.d/%{name}.conf
+%attr(754,root,root) /etc/rc.d/init.d/%{name}
+%attr(755,root,root) %{_bindir}/%{name}
+%attr(755,root,root) %{_bindir}/%{name}-admin
+%attr(755,root,root) %{_bindir}/search-cmd
+%{_mandir}/man1/*
+%attr(770,riak,riak) %{_sharedstatedir}/%{name}
+%attr(751,riak,root) %dir /var/log/%{name}
+%attr(751,riak,root) %dir /var/log/%{name}/sasl
+%{_varrun}/%{name}
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%define date	%(echo `LC_ALL="C" date +"%a %b %d %Y"`)
+%changelog
+* %{date} PLD Team <feedback at pld-linux.org>
+All persons listed below can be reached at <cvs_login>@pld-linux.org
+
+$Log$
+Revision 1.1  2012/04/22 21:11:16  aredridel
+Added to repository. NFY
+

================================================================
Index: packages/riak/riak.tmpfiles.conf
diff -u /dev/null packages/riak/riak.tmpfiles.conf:1.1
--- /dev/null	Sun Apr 22 23:11:22 2012
+++ packages/riak/riak.tmpfiles.conf	Sun Apr 22 23:11:16 2012
@@ -0,0 +1 @@
+d /var/run/riak 770 riak riak -
================================================================


More information about the pld-cvs-commit mailing list