null+****@clear*****
null+****@clear*****
2010年 8月 25日 (水) 12:14:40 JST
Kouhei Sutou 2010-08-25 03:14:40 +0000 (Wed, 25 Aug 2010) New Revision: 3b95a79cd49580fa4aa24b023596880ceb896415 Log: split munin package. Added files: debian/groonga-munin-plugin.conf debian/groonga-munin-plugins.postinst debian/groonga-munin-plugins.postrm debian/groonga.default debian/groonga.init debian/groonga.logrotate debian/groonga.postinst debian/groonga.postrm Modified files: debian/changelog debian/control debian/rules Modified: debian/changelog (+6 -0) =================================================================== --- debian/changelog 2010-08-25 02:43:24 +0000 (b554716) +++ debian/changelog 2010-08-25 03:14:40 +0000 (3e4107c) @@ -1,3 +1,9 @@ +groonga (0.7.6-2) unstable; urgency=low + + * Split packages. + + -- Kouhei Sutou <kou****@clear*****> Thu, 25 Aug 2010 22:11:14 +0900 + groonga (0.7.6) unstable; urgency=low * New upstream release. Modified: debian/control (+10 -0) =================================================================== --- debian/control 2010-08-25 02:43:24 +0000 (74a3b65) +++ debian/control 2010-08-25 03:14:40 +0000 (8a5a8a5) @@ -43,3 +43,13 @@ Description: Documentation of groonga. It lets you write high-performance applications that requires fulltext search. . This package provides documentation of groonga. + +Package: groonga-munin-plugins +Section: net +Architecture: any +Depends: ${misc:Depends}, groonga (= ${binary:Version}), munin-node, ruby +Description: munin-node plugins for groonga. + Groonga is an open-source fulltext search engine and column store. + It lets you write high-performance applications that requires fulltext search. + . + This package provides munin-node plugins to monitor groonga. Added: debian/groonga-munin-plugin.conf (+9 -0) 100644 =================================================================== --- /dev/null +++ debian/groonga-munin-plugin.conf 2010-08-25 03:14:40 +0000 (6e06336) @@ -0,0 +1,9 @@ +[groonga_*] + user groonga + group groonga + env.PATH /usr/bin:/bin:/usr/local/bin + env.pid_file /var/run/groonga/groonga.pid + env.path /var/lib/groonga/db/db + env.host 127.0.0.1 + env.port 10041 + env.log_path /var/log/groonga/query.log Added: debian/groonga-munin-plugins.postinst (+27 -0) 100755 =================================================================== --- /dev/null +++ debian/groonga-munin-plugins.postinst 2010-08-25 03:14:40 +0000 (67ccb90) @@ -0,0 +1,27 @@ +#! /bin/sh + +set -e + +prevver="$2" + +init_plugins() { + munin-node-configure --shell --remove-also | \ + grep -e 'groonga_' | \ + sh + invoke-rc.d munin-node restart +} + +case "$1" in + configure) + init_plugins + ;; + abort-upgrade|abort-deconfigure|abort-remove) + : + ;; + *) + echo "Called with unknown argument $1, bailing out." + exit 1 + ;; +esac + +#DEBHELPER# Added: debian/groonga-munin-plugins.postrm (+10 -0) 100755 =================================================================== --- /dev/null +++ debian/groonga-munin-plugins.postrm 2010-08-25 03:14:40 +0000 (a63cf42) @@ -0,0 +1,10 @@ +#! /bin/sh + +set -e + +if [ "$1" = "purge" ]; then + rm /etc/munin/plugins/groonga_* > /dev/null 2>&1 + invoke-rc.d munin-node restart +fi + +#DEBHELPER# Added: debian/groonga.default (+11 -0) 100644 =================================================================== --- /dev/null +++ debian/groonga.default 2010-08-25 03:14:40 +0000 (c5c13de) @@ -0,0 +1,11 @@ +# Default +#USER=groonga +#GROUP=groonga +#ADDRESS=127.0.0.1 +#DATABASE=/var/lib/groonga/db/db +#LOG_PATH=/var/log/groonga/groonga.log +#QUERY_LOG_PATH=/var/log/groonga/query.log +#PROTOCOL=gqtp + +# Comment out this to disable groonga daemon. +ENABLE=yes Added: debian/groonga.init (+202 -0) 100755 =================================================================== --- /dev/null +++ debian/groonga.init 2010-08-25 03:14:40 +0000 (0e8ad50) @@ -0,0 +1,202 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: groonga +# Required-Start: $local_fs $remote_fs $network $syslog +# Required-Stop: $local_fs $remote_fs $network $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: groonga's init script +# Description: groonga is a full-text search engine and column store. +### END INIT INFO + +# Author: Kouhei Sutou <kou****@clear*****> + +# Do NOT "set -e" + +# PATH should only include /usr/* if it runs after the mountnfs.sh script +PATH=/sbin:/usr/sbin:/bin:/usr/bin +DESC="a full-text search engine and column store" +NAME=groonga +DAEMON=/usr/bin/$NAME +USER=groonga +GROUP=groonga +DATABASE=/var/lib/groonga/db/db +ADDRESS=127.0.0.1 +PROTOCOL= +LOG_PATH= +QUERY_LOG_PATH= +PIDFILE=/var/run/groonga/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME +OPTION_ARGS="" +START_STOP_DAEMON_ARGS="" +ENABLE="no" + +# 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 + +[ "$ENABLE" = "yes" ] || exit 0 + +DAEMON_ARGS="-d --pid-path ${PIDFILE}" +if [ -n "${ADDRESS}" ]; then + DAEMON_ARGS="${DAEMON_ARGS} -a ${ADDRESS}" +fi +if [ -n "${LOG_PATH}" ]; then + DAEMON_ARGS="${DAEMON_ARGS} --log-path ${LOG_PATH}" +fi +if [ -n "${QUERY_LOG_PATH}" ]; then + DAEMON_ARGS="${DAEMON_ARGS} --query-log-path ${QUERY_LOG_PATH}" +fi +if [ -n "${PROTOCOL}" ]; then + DAEMON_ARGS="${DAEMON_ARGS} --protocol ${PROTOCOL}" +fi +if [ -n "${USER}" ]; then + if ! getent passwd | grep -q "^${USER}:"; then + echo "$0: user for running groonga doesn't exist: ${USER}" >&2 + exit 1 + fi + mkdir -p $(dirname ${PIDFILE}) + chown -R ${USER} $(dirname ${PIDFILE}) + START_STOP_DAEMON_ARGS="${START_STOP_DAEMON_ARGS} --user ${USER}" +fi +if [ -n "${GROUP}" ]; then + if ! getent group | grep -q "^${GROUP}:"; then + echo "$0: group for running groonga doesn't exist: ${GROUP}" >&2 + exit 1 + fi + START_STOP_DAEMON_ARGS="${START_STOP_DAEMON_ARGS} --group ${GROUP}" +fi +DAEMON_ARGS="${DAEMON_ARGS} ${OPTION_ARGS}" + +if [ -z "${DATABASE}" ]; then + echo "$0: DATABASE should not be empty" >&2 + exit 1 +fi + +if [ -f "${DATABASE}" ]; then + DAEMON_ARGS="${DAEMON_ARGS} ${DATABASE}" +else + mkdir -p $(dirname ${DATABASE}) + if [ -n "${USER}" ]; then + chown -R ${USER} $(dirname ${DATABASE}) + fi + if [ -n "${GROUP}" ]; then + chgrp -R ${GROUP} $(dirname ${DATABASE}) + fi + DAEMON_ARGS="${DAEMON_ARGS} -n ${DATABASE}" +fi + +# 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 + +# +# 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 + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \ + ${START_STOP_DAEMON_ARGS} --test > /dev/null || return 1 + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \ + ${START_STOP_DAEMON_ARGS} -- $DAEMON_ARGS || return 2 + # 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 + start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 \ + --pidfile $PIDFILE --name $NAME + 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. + start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON + [ "$?" = 2 ] && return 2 + # Many daemons don't delete their pidfiles when they exit. + rm -f $PIDFILE + 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 + ;; + reload|force-reload) + log_daemon_msg "Reloading $DESC" "$NAME" + do_reload + log_end_msg $? + ;; + restart) + 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 + exit 3 + ;; +esac + +: Added: debian/groonga.logrotate (+13 -0) 100644 =================================================================== --- /dev/null +++ debian/groonga.logrotate 2010-08-25 03:14:40 +0000 (2e23756) @@ -0,0 +1,13 @@ +/var/log/groonga/*.log { + daily + missingok + rotate 30 + compress + delaycompress + notifempty + create 640 groonga groonga + sharedscripts + postrotate + /usr/bin/groonga -c 127.0.0.1 log_reopen > /dev/null + endscript +} Added: debian/groonga.postinst (+38 -0) 100755 =================================================================== --- /dev/null +++ debian/groonga.postinst 2010-08-25 03:14:40 +0000 (cad2d57) @@ -0,0 +1,38 @@ +#! /bin/sh + +set -e + +prevver="$2" + +add_system_user() { + if ! getent passwd groonga >/dev/null; then + adduser --group --system --home /var/lib/groonga groonga + fi +} + +fixperms() { + dpkg-statoverride --list /var/run/groonga >/dev/null || \ + dpkg-statoverride --update --add groonga groonga 0755 /var/run/groonga + dpkg-statoverride --list /var/lib/groonga >/dev/null || \ + dpkg-statoverride --update --add groonga groonga 0755 /var/lib/groonga + dpkg-statoverride --list /etc/groonga >/dev/null || \ + dpkg-statoverride --update --add groonga groonga 0755 /etc/groonga + dpkg-statoverride --list /var/log/groonga >/dev/null || \ + dpkg-statoverride --update --add groonga groonga 0755 /var/log/groonga +} + +case "$1" in + configure) + add_system_user + fixperms + ;; + abort-upgrade|abort-deconfigure|abort-remove) + : + ;; + *) + echo "Called with unknown argument $1, bailing out." + exit 1 + ;; +esac + +#DEBHELPER# Added: debian/groonga.postrm (+12 -0) 100644 =================================================================== --- /dev/null +++ debian/groonga.postrm 2010-08-25 03:14:40 +0000 (52db59a) @@ -0,0 +1,12 @@ +#! /bin/sh + +set -e + +if [ "$1" = "purge" ]; then + rm -f /var/run/milter-manager/* + dpkg-statoverride --remove /var/run/milter-manager + rm -f /var/spool/postfix/milter-manager/* + dpkg-statoverride --remove /var/spool/postfix/milter-manager +fi + +#DEBHELPER# Modified: debian/rules (+20 -4) =================================================================== --- debian/rules 2010-08-25 02:43:24 +0000 (c7a0127) +++ debian/rules 2010-08-25 03:14:40 +0000 (a27efb2) @@ -6,8 +6,12 @@ include /usr/share/cdbs/1/class/autotools.mk DEB_INSTALL_DIRS_groonga = \ /usr/bin \ - /usr/share/groonga \ - /usr/share/man/man1 + /usr/share/groonga/admin_html \ + /usr/share/man/man1 \ + /etc/groonga \ + /var/run/groonga \ + /var/log/groonga \ + /var/lib/groonga DEB_INSTALL_DOCS_groonga-doc = \ doc/ja/html \ @@ -20,12 +24,18 @@ DEB_INSTALL_DIRS_libgroonga-dev = \ /usr/include/groonga \ /usr/lib/pkgconfig +DEB_INSTALL_DIRS_groonga-munin-plugins = \ + /usr/share/munin/plugins \ + /etc/munin/plugin-conf.d + install/groonga:: cp -ar debian/tmp/usr/bin/* debian/groonga/usr/bin/ - cp -ar debian/tmp/usr/share/groonga/* \ - debian/groonga/usr/share/groonga/ + cp -ar debian/tmp/usr/share/groonga/admin_html/* \ + debian/groonga/usr/share/groonga/admin_html/ cp -ar debian/tmp/usr/share/man/man1/* \ debian/groonga/usr/share/man/man1/ + cp -ar debian/tmp/etc/groonga/* \ + debian/groonga/etc/groonga/ install/libgroonga:: cp -ar debian/tmp/usr/lib/*groonga* debian/libgroonga/usr/lib/ @@ -35,3 +45,9 @@ install/libgroonga-dev:: debian/libgroonga-dev/usr/include/groonga/ cp -ar debian/tmp/usr/lib/pkgconfig/* \ debian/libgroonga-dev/usr/lib/pkgconfig/ + +install/groonga-munin-plugins:: + cp -ar debian/groonga-munin-plugin.conf \ + debian/groonga-munin-plugins/etc/munin/plugin-conf.d/groonga + cp -ar debian/tmp/usr/share/groonga/munin/plugins/* \ + debian/groonga-munin-plugins/usr/share/munin/plugins/