[DRE-commits] [SCM] stompserver.git branch, master, updated. debian/0.9.9-1-2-ge9424a3

Paul van Tilburg paulvt at debian.org
Wed May 16 14:37:27 UTC 2012


The following commit has been merged in the master branch:
commit 459b90a9030ba84f26f82a8b85c4c92212754f3b
Author: Paul van Tilburg <paulvt at debian.org>
Date:   Wed May 16 16:33:46 2012 +0200

    Merged changes from the old stompserver package

diff --git a/debian/README.source b/debian/README.source
new file mode 100644
index 0000000..0cf4fcc
--- /dev/null
+++ b/debian/README.source
@@ -0,0 +1,5 @@
+This package uses quilt to manage all modifications to the upstream source. 
+Changes are stored in the source package as diffs in debian/patches and
+applied during the build.
+
+See /usr/share/doc/quilt/README.source for a detailed explanation.
diff --git a/debian/changelog b/debian/changelog
index 69a1dcc..1672a50 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,24 @@
-stompserver (0.9.9-1) UNRELEASED; urgency=low
+stompserver (0.9.9-2) UNRELEASED; urgency=low
 
-  * Initial release (Closes: #nnnn)
+  * Source packages adapted according to the new Ruby policy:
+    - Build for both ruby1.8 and ruby1.9.1.
+    - Migrated to pkg-ruby-extras git repos. Changed the Vcs-* fields in
+      debian/control accordingly.
+    - Changed the depends to follow the new Ruby library naming scheme.
+  * debian/control:
+    - Added a default DM-Upload-Allowed field set to yes.
+    - Standards-Version bumped to 3.9.3; no changes required.
+    - Set XS-Ruby-Versions to all.
+    - Changed the build-depends for using gem2deb instead of ruby-pkg-tools.
+    - Switched the maintainer with the uploaders field as per new
+      convention the team is the default maintainer.
+  * debian/copyright: reworked to fit the Debian copyright format version 1.0.
+  * debiwn/watch: updated to use gemwatch instead Rubyforge.
 
  -- Paul van Tilburg <paulvt at debian.org>  Wed, 16 May 2012 16:11:56 +0200
+
+stompserver (0.9.9-1) unstable; urgency=low
+
+  * Initial release (Closes: #537410)
+
+ -- Joshua Timberman <joshua at opscode.com>  Thu, 13 Aug 2009 12:25:59 -0600
diff --git a/debian/control b/debian/control
index 0bc56ff..f671002 100644
--- a/debian/control
+++ b/debian/control
@@ -2,19 +2,20 @@ Source: stompserver
 Section: ruby
 Priority: optional
 Maintainer: Debian Ruby Extras Maintainers <pkg-ruby-extras-maintainers at lists.alioth.debian.org>
-Uploaders: Paul van Tilburg <paulvt at debian.org>
+Uploaders: Bryan McLellan <btm at loftninjas.org>, Joshua Timberman <joshua at opscode.com>, Paul van Tilburg <paulvt at debian.org>
 DM-Upload-Allowed: yes
 Build-Depends: debhelper (>= 7.0.50~), gem2deb (>= 0.2.13~)
-Standards-Version: 3.9.2
-#Vcs-Git: git://git.debian.org/pkg-ruby-extras/stompserver.git
-#Vcs-Browser: http://git.debian.org/?p=pkg-ruby-extras/stompserver.git;a=summary
-Homepage:     by Patrick Hurley, Lionel Bouton
+Standards-Version: 3.9.3
+Vcs-Git: git://git.debian.org/pkg-ruby-extras/stompserver.git
+Vcs-Browser: http://git.debian.org/?p=pkg-ruby-extras/stompserver.git;a=summary
+Homepage: http://stompserver.rubyforge.org/
 XS-Ruby-Versions: all
 
 Package: stompserver
 Architecture: all
 XB-Ruby-Versions: ${ruby:Versions}
-Depends: ${shlibs:Depends}, ${misc:Depends}, ruby | ruby-interpreter
-# daemons (>= 1.0.2), eventmachine (>= 0.7.2), hoe (>= 1.1.1), hoe (>= 1.3.0)
-Description: A very light messaging server
- Stomp messaging server with file/dbm/memory/activerecord based FIFO queues, queue monitoring, and basic authentication.  == SYNOPSYS:  Handles basic message queue processing
+Depends: ${shlibs:Depends}, ${misc:Depends}, ruby | ruby-interpreter, ruby-daemons, ruby-eventmachine, adduser
+Description: stomp messaging server implemented in Ruby
+ Stompserver is a stomp messaging server with support for multiple FIFO
+ based queue backends including file, dbm, memory and activerecord.
+ It supports basic authentication and queue monitoring.
diff --git a/debian/copyright b/debian/copyright
index 573d553..c43659f 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -1,33 +1,45 @@
-Format: http://dep.debian.net/deps/dep5
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
 Upstream-Name: stompserver
-Source: FIXME <http://example.com/>
+Upstream-Contact: Lionel Bouton
+Source: http://rubyforge.org/projects/stompserver/
 
 Files: *
-Copyright: <years> <put author's name and email here>
-           <years> <likewise for another author>
-License: GPL-2+ (FIXME)
- This program is free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later
- version.
+Copyright: 2006, Patrick Hurley
+           2007, Lionel Bouton
+License: Expat
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ 'Software'), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
  .
- This program is distributed in the hope that it will be
- useful, but WITHOUT ANY WARRANTY; without even the implied
- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE.  See the GNU General Public License for more
- details.
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
  .
- You should have received a copy of the GNU General Public
- License along with this package; if not, write to the Free
- Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- Boston, MA  02110-1301 USA
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+Comment: Expat license referred to as MIT license
+
+Files: setup.rb
+Copyright: 2000-2004, Minero Aoki
+License: LGPL-2.1
+ This program is free software.
+ You can distribute/modify this program under the terms of
+ the GNU Lesser General Public License version 2.1.
  .
- On Debian systems, the full text of the GNU General Public
- License version 2 can be found in the file
- `/usr/share/common-licenses/GPL-2'.
+ On Debian systems, the full text of the GNU Lesser General Public License
+ version 2.1 can be found in the file `/usr/share/common-licenses/LGPL-2.1'.
 
 Files: debian/*
-Copyright: 2012 Paul van Tilburg <paulvt at debian.org>
-License:
- [LICENSE TEXT]
+Copyright: 2009, Bryan McLellan <btm at loftninjas.org>
+           2012, Paul van Tilburg <paulvt at debian.org>
+License: GPL-2
+ On Debian systems, the full text of the GNU General Public License
+ version 2 can be found in the file `/usr/share/common-licenses/GPL-2'.
diff --git a/debian/patches/fhs_paths.patch b/debian/patches/fhs_paths.patch
new file mode 100644
index 0000000..602ea6b
--- /dev/null
+++ b/debian/patches/fhs_paths.patch
@@ -0,0 +1,32 @@
+# Description: Check for absolute paths so we can enforce FHS in config.
+# No upstream patch/URL yet, will update package when one is open.
+# Author: Joshua Timberman <joshua at opscode.com>
+Index: stompserver-0.9.9/lib/stomp_server.rb
+===================================================================
+--- stompserver-0.9.9.orig/lib/stomp_server.rb	2009-08-19 16:43:04.368066674 -0600
++++ stompserver-0.9.9/lib/stomp_server.rb	2009-08-19 16:44:24.783974681 -0600
+@@ -28,6 +28,7 @@
+         :working_dir => Dir.getwd,
+         :storage => ".stompserver",
+         :logdir => 'log',
++        :etcdir => 'etc',
+         :configfile => 'stompserver.conf',
+         :logfile => 'stompserver.log',
+         :pidfile => 'stompserver.pid',
+@@ -63,10 +63,10 @@
+         opts = @defaults
+       end
+ 
+-      opts[:etcdir] = File.join(opts[:working_dir],'etc')
+-      opts[:storage] = File.join(opts[:working_dir],opts[:storage])
+-      opts[:logdir] = File.join(opts[:working_dir],opts[:logdir])
+-      opts[:logfile] = File.join(opts[:logdir],opts[:logfile])
+-      opts[:pidfile] = File.join(opts[:logdir],opts[:pidfile])
++      opts[:etcdir] = opts[:etcdir] =~ /^\// ? opts[:etcdir] : File.join(opts[:working_dir],opts[:etcdir])
++      opts[:storage] = opts[:storage] =~ /^\// ? opts[:storage] : File.join(opts[:working_dir],opts[:storage])
++      opts[:logdir] = opts[:logdir] =~ /^\// ? opts[:logdir] : File.join(opts[:working_dir],opts[:logdir])
++      opts[:logfile] = opts[:logfile] =~ /^\// ? opts[:logfile] : File.join(opts[:logdir],opts[:logfile])
++      opts[:pidfile] = opts[:pidfile] =~ /^\// ? opts[:pidfile] : File.join(opts[:logdir],opts[:pidfile])
+       if opts[:auth]
+         opts[:passwd] = File.join(opts[:etcdir],'.passwd')
+       end
diff --git a/debian/patches/fix_storagedir.patch b/debian/patches/fix_storagedir.patch
new file mode 100644
index 0000000..ff9f4d0
--- /dev/null
+++ b/debian/patches/fix_storagedir.patch
@@ -0,0 +1,15 @@
+# Description: Bug in initialize won't create the storage dir in FHS compliant location
+# No upstream bug yet, will update the package when there is one.
+Index: stompserver-0.9.9/lib/stomp_server/queue/activerecord_queue.rb
+===================================================================
+--- stompserver-0.9.9.orig/lib/stomp_server/queue/activerecord_queue.rb	2009-08-19 17:49:44.559625055 -0600
++++ stompserver-0.9.9/lib/stomp_server/queue/activerecord_queue.rb	2009-08-19 17:50:07.623903343 -0600
+@@ -15,7 +15,7 @@
+     # Default configuration, use SQLite for simplicity
+     db_params = {
+       'adapter' => 'sqlite3',
+-      'database' => "#{configdir}/stompserver_development"
++      'database' => "#{storagedir}/stompserver_development"
+     }
+     # Load DB configuration
+     db_config = "#{configdir}/database.yml"
diff --git a/debian/patches/remove_rubygems.patch b/debian/patches/remove_rubygems.patch
new file mode 100644
index 0000000..f25343d
--- /dev/null
+++ b/debian/patches/remove_rubygems.patch
@@ -0,0 +1,31 @@
+# Description: Remove requirement of rubygems
+# Requiring RubyGems is discouraged by the Debian Ruby Extras team
+# per http://pkg-ruby-extras.alioth.debian.org/upstream-devs.html
+# Author: Bryan McLellan <btm at loftninjas.org>
+Index: stompserver-0.9.9/bin/stompserver
+===================================================================
+--- stompserver-0.9.9.orig/bin/stompserver	2009-07-28 10:47:18.000000000 -0700
++++ stompserver-0.9.9/bin/stompserver	2009-07-28 10:47:26.000000000 -0700
+@@ -1,4 +1,3 @@
+-require 'rubygems'
+ require 'etc'
+ require 'yaml'
+ require 'daemons/daemonize'
+Index: stompserver-0.9.9/lib/stomp_server.rb
+===================================================================
+--- stompserver-0.9.9.orig/lib/stomp_server.rb	2009-07-28 10:47:37.000000000 -0700
++++ stompserver-0.9.9/lib/stomp_server.rb	2009-07-28 10:47:42.000000000 -0700
+@@ -1,4 +1,3 @@
+-require 'rubygems'
+ require 'eventmachine'
+ require 'stomp_server/stomp_frame'
+ require 'stomp_server/stomp_id'
+Index: stompserver-0.9.9/lib/stomp_server/test_server.rb
+===================================================================
+--- stompserver-0.9.9.orig/lib/stomp_server/test_server.rb	2009-07-28 10:47:48.000000000 -0700
++++ stompserver-0.9.9/lib/stomp_server/test_server.rb	2009-07-28 10:47:52.000000000 -0700
+@@ -1,4 +1,3 @@
+-require 'rubygems'
+ require 'eventmachine'
+ 
+ module StompServer
diff --git a/debian/patches/ruby_hashbang.patch b/debian/patches/ruby_hashbang.patch
new file mode 100644
index 0000000..69c3ed1
--- /dev/null
+++ b/debian/patches/ruby_hashbang.patch
@@ -0,0 +1,13 @@
+# Description: Add a ruby shebang to the stompserver binary per policy
+# Debian Policy Manual section 10.4 Scripts.
+# Author: Bryan McLellan <btm at loftninjas.org>
+Index: stompserver-0.9.9/bin/stompserver
+===================================================================
+--- stompserver-0.9.9.orig/bin/stompserver	2009-07-28 11:45:59.000000000 -0700
++++ stompserver-0.9.9/bin/stompserver	2009-07-28 11:46:08.000000000 -0700
+@@ -1,3 +1,5 @@
++#!/usr/bin/ruby1.8
++
+ require 'etc'
+ require 'yaml'
+ require 'daemons/daemonize'
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..92798ca
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,4 @@
+remove_rubygems.patch
+ruby_hashbang.patch
+fhs_paths.patch
+fix_storagedir.patch
diff --git a/debian/source/local-options b/debian/source/local-options
new file mode 100644
index 0000000..4aceb10
--- /dev/null
+++ b/debian/source/local-options
@@ -0,0 +1 @@
+unapply-patches
diff --git a/debian/stompserver.1 b/debian/stompserver.1
new file mode 100644
index 0000000..7e05ab5
--- /dev/null
+++ b/debian/stompserver.1
@@ -0,0 +1,138 @@
+.\"                                      Hey, EMACS: -*- nroff -*-
+.\" First parameter, NAME, should be all caps
+.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
+.\" other parameters are allowed: see man(7), man(1)
+.TH STOMPSERVER "1" "July 2009" "stompserver" "User Commands"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh        disable hyphenation
+.\" .hy        enable hyphenation
+.\" .ad l      left justify
+.\" .ad b      justify to both left and right margins
+.\" .nf        disable filling
+.\" .fi        enable filling
+.\" .br        insert line break
+.\" .sp <n>    insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+stompserver \- Stomp protocol messaging server
+.SH SYNOPSIS
+.B stompserver
+[\fIoptions\fR]
+.SH DESCRIPTION
+Stomp messaging server with file/dbm/memory/activerecord based FIFO
+queues, queue monitoring, and basic authentication.
+
+.SH OPTIONS
+.TP
+\fB\-C\fR, \fB\-\-config\fR=\fICONFIGFILE\fR
+Configuration File (default: stompserver.conf)
+.TP
+\fB\-p\fR, \fB\-\-port\fR=\fIPORT\fR
+Change the port (default: 61613)
+.TP
+\fB\-b\fR, \fB\-\-host\fR=\fIADDR\fR
+Change the host (default: localhost)
+.TP
+\fB\-q\fR, \fB\-\-queuetype\fR=\fIQUEUETYPE\fR
+Queue type (memory|dbm|activerecord|file) (default: memory)
+.TP
+\fB\-w\fR, \fB\-\-working_dir\fR=\fIDIR\fR
+Change the working directory (default: current directory)
+.TP
+\fB\-s\fR, \fB\-\-storage\fR=\fIDIR\fR
+Change the storage directory (default: .stompserver, relative to working_dir)
+.TP
+\fB\-d\fR, \fB\-\-debug\fR
+Turn on debug messages
+.TP
+\fB\-a\fR, \fB\-\-auth\fR
+Require client authorization
+.TP
+\fB\-c\fR, \fB\-\-checkpoint\fR=\fISECONDS\fR
+Time between checkpointing the queues in seconds (default: 0)
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+Show this message
+
+.SH QUEUES
+
+Stompserver handles basic message queue processing using memory, file, or dbm
+based queues. Messages are sent and consumed in FIFO order (unless a
+client error happens, this should be corrected in the future). Topics
+are memory-only storage.  You can select activerecord, file or dbm
+storage and the queues will use that, but topics will only be stored
+in memory.
+
+memory queues are of course the fastest ones but shouldn't be used if
+you want to ensure all messages are delivered.
+
+dbm queues will use berkeleydb if available, otherwise dbm or gdbm
+depending on the platform. sdbm does not work well with marshalled
+data. Note that these queues have not been tested in this release.
+
+For the file based storage, each frame is stored in a single file. The
+first 8 bytes contains the header length, the next 8 bytes contains
+the body length, then the headers are stored as a marshalled object
+followed by the body stored as a string. This storage is currently
+inefficient because queues are stored separately from messages, which
+forces a double write for data safety reasons on each message stored.
+
+The activerecord based storage expects to find a database.yml file in
+the configuration directory. It should be the most robust backend, but
+the slowest one. The database must have an ar_messages table which can
+be created with the following code (you are responsible to do so):
+
+  ActiveRecord::Schema.define do
+    create_table 'ar_messages' do |t|
+      t.column 'stomp_id', :string, :null => false
+      t.column 'frame', :text, :null => false
+    end
+  end
+
+You can read the frames with this model:
+
+  class ArMessage < ActiveRecord::Base
+    serialize :frame
+  end
+
+The ar_message implementation will certainly change in the future.
+
+This is meant to be easily readable by a Rails application (which
+could handle the ar_messages table creation with a migration).
+
+.SH ACCESS CONTROL
+
+Basic client authorization is also supported.  If the \-a flag is
+passed to stompserver on startup, and a .passwd file exists in the run
+directory, then clients will be required to provide a valid login and
+passcode.  See passwd.example for the password file format.
+
+.SH MONITORING
+
+Queues can be monitored via the monitor queue (this will probably not
+be supported this way in the future to avoid polluting the queue
+namespace). If you subscribe to /queue/monitor, you will receive a
+status message every 5 seconds that displays each queue, it's size,
+frames enqueued, and frames dequeued. Stats are sent in the same
+format of stomp headers, so they are easy to parse. Following is an
+example of a status message containing stats for 2 queues:
+
+Queue: /queue/client2
+size: 0
+dequeued: 400
+enqueued: 400
+
+Queue: /queue/test
+size: 50
+dequeued: 250
+enqueued: 300
+
+
+.SH AUTHOR
+stompserver was written by Patrick Hurley <phurley at gmail.com> and Lionel Bouton.
+.PP
+This manual page was compiled from the included documentation by 
+Bryan McLellan <btm at loftninjas.org> for the Debian project (and may be used by others).
+The existing documentation is distributed under the MIT license.
diff --git a/debian/stompserver.conf b/debian/stompserver.conf
new file mode 100644
index 0000000..57b7923
--- /dev/null
+++ b/debian/stompserver.conf
@@ -0,0 +1,14 @@
+---
+:daemon: true
+:working_dir: /var/lib/stompserver
+:logdir: /var/log/stompserver
+:pidfile: /var/run/stompserver/pid
+:storage: /var/lib/stompserver/storage
+:etcdir: /etc/stompserver
+:queue: memory
+:auth: false
+:debug: false
+:group: stompserver
+:user: stompserver
+:host: 127.0.0.1
+:port: 61613
diff --git a/debian/stompserver.dirs b/debian/stompserver.dirs
new file mode 100644
index 0000000..cf80d8b
--- /dev/null
+++ b/debian/stompserver.dirs
@@ -0,0 +1,3 @@
+var/log/stompserver
+var/lib/stompserver
+etc/stompserver
diff --git a/debian/stompserver.docs b/debian/stompserver.docs
index 23a54bd..71dfd5b 100644
--- a/debian/stompserver.docs
+++ b/debian/stompserver.docs
@@ -1,2 +1 @@
-# FIXME: READMEs found
-# README.txt
+README.txt
diff --git a/debian/stompserver.examples b/debian/stompserver.examples
new file mode 100644
index 0000000..ea48788
--- /dev/null
+++ b/debian/stompserver.examples
@@ -0,0 +1,2 @@
+config/stompserver.conf
+etc/passwd.example
diff --git a/debian/stompserver.init b/debian/stompserver.init
new file mode 100644
index 0000000..8068018
--- /dev/null
+++ b/debian/stompserver.init
@@ -0,0 +1,167 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides:          stompserver
+# Required-Start:    $network $local_fs
+# Required-Stop:     $network $local_fs
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: a stomp messaging server implemented in ruby
+### END INIT INFO
+#
+# Copyright (c) 2009 Joshua Timberman, <joshua at opscode.com>
+#
+# stompserver         Startup script for stompserver
+# chkconfig: - 80 20
+# description: starts up stompserver in daemon mode.
+
+DAEMON=/usr/bin/stompserver
+NAME=stompserver
+DESC=stompserver
+PIDFILE=/var/run/$NAME/pid
+
+test -x $DAEMON || exit 0
+
+. /lib/lsb/init-functions
+
+if [ ! -d /var/run/stompserver ]; then
+  mkdir -p /var/run/stompserver
+fi
+
+chown stompserver:stompserver /var/run/stompserver
+
+DAEMON_OPTS="-C /etc/stompserver.conf"
+
+running_pid() {                                                                 
+  pid=$1
+  name=$2                                                                     
+  [ -z "$pid" ] && return 1                                                   
+  [ ! -d /proc/$pid ] &&  return 1                                            
+  cmd=`awk '/Name:/ {print $2}' /proc/$pid/status`
+  [ "$cmd" != "$name" ] &&  return 1                                          
+  return 0 
+}   
+
+running() {                                                                     
+  [ ! -f "$PIDFILE" ] && return 1
+  pid=`cat $PIDFILE`
+  running_pid $pid $NAME || return 1                                        
+  return 0
+}   
+
+start_server() {                                                                
+  start_daemon -p $PIDFILE $DAEMON $DAEMON_OPTS                       
+  errcode=$?
+  return $errcode                                                         
+}       
+
+stop_server() {                                                                 
+   if [ -z "$DAEMONUSER" ] ; then                                          
+     killproc -p $PIDFILE $DAEMON                                        
+     errcode=$?
+   else
+     start-stop-daemon --stop --quiet --pidfile $PIDFILE \               
+       --user $DAEMONUSER \ 
+       --exec $DAEMON
+     errcode=$?  
+   fi  
+   return $errcode                                                         
+}       
+
+reload_server() {                                                               
+  [ ! -f "$PIDFILE" ] && return 1                                             
+  pid=pidofproc $PIDFILE # This is the daemon's pid                           
+  kill -1 $pid
+  return $?
+}   
+
+force_stop() {
+  [ ! -e "$PIDFILE" ] && return
+  if running ; then
+    kill -15 $pid
+    sleep "$DIETIME"s
+    if running ; then
+      kill -9 $pid
+      sleep "$DIETIME"s
+      if running ; then
+        echo "Cannot kill $NAME (pid=$pid)!"
+        exit 1
+      fi
+    fi
+  fi
+  rm -f $PIDFILE
+}
+
+case "$1" in
+  start)
+    log_daemon_msg "Starting $DESC " "$NAME"
+    if running ;  then
+        log_progress_msg "apparently already running"
+        log_end_msg 0
+        exit 0
+    fi
+    if start_server ; then
+        [ -n "$STARTTIME" ] && sleep $STARTTIME # Wait some time 
+        if  running ;  then
+            log_end_msg 0
+        else
+            log_end_msg 1
+        fi
+    else
+        log_end_msg 1
+    fi
+    ;;
+  stop)
+    log_daemon_msg "Stopping $DESC" "$NAME"
+    if running ; then
+      errcode=0
+      stop_server || errcode=$?
+      log_end_msg $errcode
+    else
+      log_progress_msg "apparently not running"
+      log_end_msg 0
+      exit 0
+    fi
+    ;;
+  force-stop)
+    $0 stop
+    if running; then
+      log_daemon_msg "Stopping (force) $DESC" "$NAME"
+      errcode=0
+      force_stop || errcode=$?
+      log_end_msg $errcode
+    fi
+    ;;
+  restart|force-reload)
+    log_daemon_msg "Restarting $DESC" "$NAME"
+    errcode=0
+    stop_server || errcode=$?
+    [ -n "$DIETIME" ] && sleep $DIETIME
+    start_server || errcode=$?
+    [ -n "$STARTTIME" ] && sleep $STARTTIME
+    running || errcode=$?
+    log_end_msg $errcode
+    ;;
+  status)
+    log_daemon_msg "Checking status of $DESC" "$NAME"
+    if running ;  then
+      log_progress_msg "running"
+      log_end_msg 0
+    else
+      log_progress_msg "apparently not running"
+      log_end_msg 1
+      exit 1
+    fi
+    ;;
+  reload)
+    log_warning_msg "Reloading $NAME daemon: not implemented, as the daemon"
+    log_warning_msg "cannot re-read the config file (use restart)."
+    ;;
+  *)
+    N=/etc/init.d/$NAME
+    echo "Usage: $N {start|stop|force-stop|restart|force-reload|status}" >&2
+    exit 1
+    ;;
+esac
+
+exit 0
+
diff --git a/debian/stompserver.logrotate b/debian/stompserver.logrotate
new file mode 100644
index 0000000..f956a64
--- /dev/null
+++ b/debian/stompserver.logrotate
@@ -0,0 +1,10 @@
+/var/log/stompserver/*log {
+  missingok
+  create 0644 stompserver stompserver
+  compress
+  rotate 12
+  weekly
+  postrotate
+  /etc/init.d/stompserver force-reload
+  endscript
+}
diff --git a/debian/stompserver.postinst b/debian/stompserver.postinst
new file mode 100644
index 0000000..bb8860f
--- /dev/null
+++ b/debian/stompserver.postinst
@@ -0,0 +1,34 @@
+#!/bin/sh
+# postinst script for stompserver
+#
+# see: dh_installdeb(1)
+
+set -e
+
+case "$1" in
+    configure)
+      if [ -z "`getent passwd stompserver`" ]; then
+        adduser --quiet --system --home /var/lib/stompserver --shell /bin/false \
+        --group --disabled-password --disabled-login --no-create-home \
+        --gecos "Stomp Server" stompserver 
+      fi
+      chown stompserver:stompserver /var/lib/stompserver
+      chown stompserver:stompserver /var/log/stompserver
+      chown stompserver:stompserver /etc/stompserver
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/stompserver.postrm b/debian/stompserver.postrm
new file mode 100644
index 0000000..8455d75
--- /dev/null
+++ b/debian/stompserver.postrm
@@ -0,0 +1,27 @@
+#!/bin/sh
+# postrm script for stompserver
+#
+# see: dh_installdeb(1)
+
+set -e
+
+case "$1" in
+    purge)
+      rm -rf /etc/stompserver
+      rm -rf /var/log/stompserver
+    ;;
+    remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+    ;;
+
+    *)
+        echo "postrm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0

-- 
stompserver.git



More information about the Pkg-ruby-extras-commits mailing list