packages: tokyotyrant/tokyotyrant-example-config (NEW), tokyotyrant/tokyoty...

gotar gotar at pld-linux.org
Fri May 28 10:45:20 CEST 2010


Author: gotar                        Date: Fri May 28 08:45:20 2010 GMT
Module: packages                      Tag: HEAD
---- Log message:
- initial PLD release by Remigiusz 'Enleth' Marcinkiewicz enleth at enleth.com

---- Files affected:
packages/tokyotyrant:
   tokyotyrant-example-config (NONE -> 1.1)  (NEW), tokyotyrant.init (NONE -> 1.1)  (NEW), tokyotyrant.spec (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/tokyotyrant/tokyotyrant-example-config
diff -u /dev/null packages/tokyotyrant/tokyotyrant-example-config:1.1
--- /dev/null	Fri May 28 10:45:20 2010
+++ packages/tokyotyrant/tokyotyrant-example-config	Fri May 28 10:45:14 2010
@@ -0,0 +1,6 @@
+TT_DATABASE="*"
+TT_ADDR="/tmp/tt-example.sock"
+TT_PORT=0
+TT_UID=nobody:nobody
+TT_MASK="copy,restore,repl,slave"
+TT_PID="/tmp/tt-example.pid"

================================================================
Index: packages/tokyotyrant/tokyotyrant.init
diff -u /dev/null packages/tokyotyrant/tokyotyrant.init:1.1
--- /dev/null	Fri May 28 10:45:20 2010
+++ packages/tokyotyrant/tokyotyrant.init	Fri May 28 10:45:14 2010
@@ -0,0 +1,170 @@
+#!/bin/sh
+#
+# tokyotyrant      This shell script starts and stops TokyoTyrant server processes.
+#
+# chkconfig:   2345 80 30
+# description: Tokyo Tyrant is a network interface to the Tokyo Cabinet DBM-like database.
+# processname: ttserver
+# pidfile:  /var/run/tokyotyrant/*.pid
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+# Source networking configuration.
+. /etc/sysconfig/network
+
+# Source default configureation.
+. /etc/sysconfig/tokyotyrant
+
+# Check that networking is up.
+if is_yes "${NETWORKING}"; then
+	if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
+		msg_network_down "TokyoTyrant"
+		exit 1
+	fi
+else
+	exit 0
+fi
+
+tt_start() {
+	(
+		. /etc/tokyotyrant.d/${1}
+		msg_starting "TokyoTyrant (${1})"
+		# user/group
+		ssdargs="$ssdargs ${TT_UID:+-c $TT_UID}"
+
+		# bind address
+		args="$args ${TT_ADDR:+-host $TT_ADDR}"
+		args="$args ${TT_PORT:+-port $TT_PORT}"
+		
+		args="$args ${TT_THREADS:+-thnum $TT_THREADS}"
+		args="$args ${TT_TIMEOUT:+-tout $TT_TIMEOUT}"
+		args="$args ${TT_MASK:+-mask $TT_MASK}"
+		args="$args ${TT_UNMASK:+-unmask $TT_UNMASK}"
+		args="$args ${TT_LOGFILE:+-log $TT_LOGFILE}"
+		args="$args ${TT_SKEL:+-skel $TT_SKEL}"
+		args="$args $TT_ARGS"
+
+		# set umask the same way daemon() does.
+		[ -z "$DEFAULT_SERVICE_UMASK" ] && DEFAULT_SERVICE_UMASK=022
+		umask ${SERVICE_UMASK:-$DEFAULT_SERVICE_UMASK}
+
+		env -i PATH=$PATH /sbin/start-stop-daemon --start -x /usr/bin/ttserver -p /var/run/tokyotyrant/${1}.pid -o $ssdargs -g tokyotyrant -- -pid /var/run/tokyotyrant/${1}.pid -dmn $args "$TT_DATABASE"
+		RETVAL=$?
+
+		if [ $RETVAL -eq 0 ]; then
+			ok
+		else
+			fail
+		fi
+
+	)
+	return $?
+}
+
+tt_stop() {
+	(
+		. /etc/tokyotyrant.d/${1}
+		msg_stopping "TokyoTyrant (${1})"
+		killproc --pidfile tokyotyrant/${1}.pid /usr/bin/ttserver
+	)
+	return $?
+}
+
+start() {
+	local file
+	local files
+	local nstarted=0
+	local nfailed=0
+	if [ ! -f /var/lock/subsys/tokyotyrant ]; then
+		if [ ! -f /etc/tokyotyrant.d/* ]; then
+			nls "Error: no TokyoTyrant configuration files in %s, nothing to run" "/etc/tokyotyrant.d/"
+			exit 1
+		fi
+
+		# Check if we were called to start a particular instance
+                if [ -n "$1" ]; then
+                        files=/etc/tokyotyrant.d/$1
+                else
+                        files=/etc/tokyotyrant.d/*
+                fi
+		
+		for file in $files; do
+			if [ ! -f $file ]; then
+				nls "Error: configuration for instance '%s' not found" $file
+                                continue
+			fi
+			if [ ! -x $file ]; then
+				nls "Notice: ignored instance '%s' configuration, not executable" $file
+                                continue
+			fi
+			tt_start ${file##*/}
+			RETVAL=$?
+			if [ $RETVAL -eq 0 ]; then
+				let nstarted=$nstarted+1
+			else
+				let nfailed=$nfailed+1
+			fi
+		done
+		
+		if [ $nfailed -gt 0 ]; then
+			nls "Warning: some TokyoTyrant instances failed to start"
+		fi
+		
+		if [ $nstarted -gt 0 ]; then
+			touch /var/lock/subsys/tokyotyrant
+		fi
+				
+	else
+		msg_already_running "TokyoTyrant"
+	fi
+}
+
+stop() {
+	# Stop daemons.
+	local file
+	local files
+	if [ -f /var/lock/subsys/tokyotyrant ]; then
+
+		# Check if we were called to stop a particular instance
+		if [ -n "$1" ]; then
+			files=/etc/tokyotyrant.d/$1
+		else
+			files=/etc/tokyotyrant.d/*
+		fi
+
+		for file in $files; do
+			if [ ! -f $file ]; then
+				nls "Error: configuration for instance '%s' not found" $file
+				continue
+			fi
+			tt_stop ${file##*/}
+		done
+		rm -f /var/lock/subsys/tokyotyrant >/dev/null 2>&1
+	else
+		msg_not_running "TokyoTyrant"
+	fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+start)
+	start $2
+	;;
+stop)
+	stop $2
+	;;
+restart|force-reload)
+	stop $2
+	start $2
+	;;
+status)
+	# FIXME
+	;;
+*)
+	msg_usage "$0 {start|stop|restart|force-reload|status}"
+	exit 3
+esac
+
+exit $RETVAL

================================================================
Index: packages/tokyotyrant/tokyotyrant.spec
diff -u /dev/null packages/tokyotyrant/tokyotyrant.spec:1.1
--- /dev/null	Fri May 28 10:45:20 2010
+++ packages/tokyotyrant/tokyotyrant.spec	Fri May 28 10:45:14 2010
@@ -0,0 +1,153 @@
+# $Revision$, $Date$
+Summary:	Network interface for the Tokyo Cabinet database
+Summary(pl.UTF-8):	Interfejs sieciowy dla bazy danych Tokyo Cabinet
+Name:		tokyotyrant
+Version:	1.1.40
+Release:	0.4
+License:	LGPL
+Group:		Libraries
+Source0:	http://1978th.net/tokyotyrant/%{name}-%{version}.tar.gz
+# Source0-md5:	cc9b7f0c6764d37700ab43d29a5c6048
+Source1:	%{name}.init
+Source2:	%{name}-example-config
+URL:		http://1978th.net/tokyotyrant/
+BuildRequires:	tokyocabinet-devel
+BuildRequires:	zlib-devel
+Requires(post,preun):	/sbin/chkconfig
+Requires(postun):	/usr/sbin/groupdel
+Requires(pre):	/usr/sbin/groupadd
+Requires:	rc-scripts >= 0.4.1.23
+Provides:	group(tokyotyrant)
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+Tokyo Tyrant is a network interface daemon and client library for the
+Tokyo Cabinet database, intended for concurrent and/or remote access
+to a database file.
+
+%description -l pl.UTF-8
+Tokyo Tyrant to interfejs sieciowy - demon oraz biblioteka kliencka -
+dla bazy danych Tokyo Cabinet, służący do zapewnienia równoległego
+i/lub zdalnego dostępu do pliku bazy danych.
+
+%package devel
+Summary:	Header files for tokyotyrant client library
+Summary(pl.UTF-8):	Pliki nagłówkowe biblioteki klienckiej tokyoryrant
+Group:		Development/Libraries
+Requires:	%{name}-libs = %{version}-%{release}
+
+%description devel
+Header files for tokyotyrant client library.
+
+%description devel -l pl.UTF-8
+Pliki nagłówkowe biblioteki klienckiej tokyotyrant.
+
+%package libs
+Summary:	Tokyotyrant client library
+Summary(pl.UTF-8):	Biblioteka kliencka tokyotyrant
+Group:		Development/Libraries
+
+%description libs
+Tokyotyrant client library.
+
+%description libs -l pl.UTF-8
+Biblioteka kliencka tokyotyrant.
+
+%package static
+Summary:	Static tokyotyrant client library
+Summary(pl.UTF-8):	Statyczna biblioteka kliencka tokyotyrant
+Group:		Development/Libraries
+Requires:	%{name}-devel = %{version}-%{release}
+
+%description static
+Static tokyotyrant client library.
+
+%description static -l pl.UTF-8
+Statyczna biblioteka kliencka tokyotyrant.
+
+%prep
+%setup -q
+
+%build
+%{__libtoolize}
+%{__aclocal}
+%{__autoconf}
+%configure
+
+%{__make}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT%{_sysconfdir}/{tokyotyrant.d,rc.d/init.d}
+install -d $RPM_BUILD_ROOT/var/run/tokyotyrant
+
+%{__make} install \
+	DESTDIR=$RPM_BUILD_ROOT
+
+# Remove the provided init script, it is useless. SOURCE1 replaces it.
+rm -f $RPM_BUILD_ROOT%{_sbindir}/ttservctl
+
+install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
+install %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/tokyotyrant.d/example
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%pre
+%groupadd -g 252 %{name}
+
+%post
+/sbin/chkconfig --add %{name}
+%service %{name} restart
+
+%preun
+if [ "$1" = "0" ]; then
+	%service -q %{name} stop
+	/sbin/chkconfig --del %{name}
+fi
+
+%postun
+if [ "$1" = "0" ]; then
+	%groupremove %{name}
+fi
+
+%post libs	-p /sbin/ldconfig
+%postun libs	-p /sbin/ldconfig
+
+%files
+%defattr(644,root,root,755)
+%doc ChangeLog README
+%attr(755,root,root) %{_bindir}/*
+%attr(755,root,root) %{_libdir}/tt*.so
+%dir %attr(751,root,root) %{_sysconfdir}/tokyotyrant.d
+%{_sysconfdir}/tokyotyrant.d/example
+%attr(754,root,root) /etc/rc.d/init.d/%{name}
+%{_datadir}/%{name}
+%{_mandir}/man1/*.1*
+%{_mandir}/man8/*.8*
+%dir %attr(770,root,tokyotyrant) /var/run/tokyotyrant
+
+%files devel
+%defattr(644,root,root,755)
+%{_libdir}/libtokyotyrant.so
+%{_includedir}/t*.h
+%{_pkgconfigdir}/*.pc
+%{_mandir}/man3/*.3*
+
+%files libs
+%defattr(644,root,root,755)
+%attr(755,root,root) %ghost %{_libdir}/libtokyotyrant.so.3
+%attr(755,root,root) %{_libdir}/libtokyotyrant.so.*.*.*
+
+%files static
+%defattr(644,root,root,755)
+%{_libdir}/libtokyotyrant.a
+
+%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  2010/05/28 08:45:14  gotar
+- initial PLD release by Remigiusz 'Enleth' Marcinkiewicz enleth at enleth.com
+
================================================================


More information about the pld-cvs-commit mailing list