[DRE-commits] r3274 - in packages/mongrel-cluster/trunk/debian: . patches

sharky at alioth.debian.org sharky at alioth.debian.org
Sat Mar 14 08:54:24 UTC 2009


Author: sharky
Date: 2009-03-14 08:54:24 +0000 (Sat, 14 Mar 2009)
New Revision: 3274

Added:
   packages/mongrel-cluster/trunk/debian/patches/
   packages/mongrel-cluster/trunk/debian/patches/01_default_user_and_group.patch
Modified:
   packages/mongrel-cluster/trunk/debian/changelog
   packages/mongrel-cluster/trunk/debian/mongrel-cluster.init
   packages/mongrel-cluster/trunk/debian/rules
Log:
add fix for bug 500424, thanks to Gunnar Wolf


Modified: packages/mongrel-cluster/trunk/debian/changelog
===================================================================
--- packages/mongrel-cluster/trunk/debian/changelog	2009-03-10 22:55:43 UTC (rev 3273)
+++ packages/mongrel-cluster/trunk/debian/changelog	2009-03-14 08:54:24 UTC (rev 3274)
@@ -1,3 +1,9 @@
+mongrel-cluster (1.0.5-2) UNRELEASED; urgency=low
+
+  * Make it possible to specify user/group to run the mongrels (Closes: #500424).
+
+ -- Jeremy Lainé <jeremy.laine at m4x.org>  Sat, 14 Mar 2009 09:53:48 +0100
+
 mongrel-cluster (1.0.5-1) unstable; urgency=low
 
   * Initial upload to Debian (Closes: #460063).

Modified: packages/mongrel-cluster/trunk/debian/mongrel-cluster.init
===================================================================
--- packages/mongrel-cluster/trunk/debian/mongrel-cluster.init	2009-03-10 22:55:43 UTC (rev 3273)
+++ packages/mongrel-cluster/trunk/debian/mongrel-cluster.init	2009-03-14 08:54:24 UTC (rev 3274)
@@ -44,30 +44,34 @@
 TOTAL_CONFS=$(ls $CONF_DIR | wc -l)
 test $TOTAL_CONFS -ne 0 || exit 0
 
+# Add user and group information, if specified
+if [ -n "$USER" ]; then DAEMON_OPTS="$DAEMON_OPTS --user $USER"; fi
+if [ -n "$GROUP" ]; then DAEMON_OPTS="$DAEMON_OPTS --group $GROUP"; fi
+
 case "$1" in
   start)
 	mkdir -p $PID_DIR
         chown $USER:$GROUP $PID_DIR
 	echo -n "Starting $DESC: "
-	start-stop-daemon --start --quiet --chuid $USER:$GROUP \
+	start-stop-daemon --start --quiet \
 		--exec $DAEMON -- start $DAEMON_OPTS
 	echo "$NAME."
 	;;
   stop)
 	echo -n "Stopping $DESC: "
-	start-stop-daemon --start --quiet --chuid $USER:$GROUP \
+	start-stop-daemon --start --quiet \
 		--exec $DAEMON -- stop $DAEMON_OPTS
 	echo "$NAME."
 	;;
   restart)
 	echo -n "Restarting $DESC: "
-	start-stop-daemon --start --quiet --chuid $USER:$GROUP \
+	start-stop-daemon --start --quiet \
 		--exec $DAEMON -- restart $DAEMON_OPTS
 	echo "$NAME."
 	;;
   status)
 	echo -n "Status for $DESC: "
-	start-stop-daemon --start --quiet --chuid $USER:$GROUP \
+	start-stop-daemon --start --quiet \
 		--exec $DAEMON -- status $DAEMON_OPTS
 	;;
   # actually jus calling restart

Added: packages/mongrel-cluster/trunk/debian/patches/01_default_user_and_group.patch
===================================================================
--- packages/mongrel-cluster/trunk/debian/patches/01_default_user_and_group.patch	                        (rev 0)
+++ packages/mongrel-cluster/trunk/debian/patches/01_default_user_and_group.patch	2009-03-14 08:54:24 UTC (rev 3274)
@@ -0,0 +1,71 @@
+diff --git a/bin/mongrel_cluster_ctl b/bin/mongrel_cluster_ctl
+--- a/bin/mongrel_cluster_ctl
++++ b/bin/mongrel_cluster_ctl
+@@ -3,12 +3,14 @@
+ 
+ require 'optparse'
+ 
+-def run(command, verbose, clean=false)
++def run(command, verbose, clean=false, user=nil, group=nil)
+   Dir.chdir @options[:conf_path] do
+     confs =  Dir.glob("*.yml")
+     confs += Dir.glob("*.conf")
+     confs.each do |conf|
+       cmd = "mongrel_rails cluster::#{command} -C #{conf}"
++      cmd += " --user #{user}" if user
++      cmd += " --group #{group}" if group
+       cmd += " -v" if verbose
+       cmd += " --clean" if clean
+       puts cmd if verbose || command == "status"
+@@ -30,6 +32,8 @@ OptionParser.new do |opts|
+   opts.on("-c", "--conf_path PATH", "Path to mongrel_cluster configuration files") { |value| @options[:conf_path] = value }
+   opts.on('-v', '--verbose', "Print all called commands and output.") { |value| @options[:verbose] = value }
+   opts.on('--clean', "Remove pid files if needed beforehand.") { |value| @options[:clean] = value }
++  opts.on('--user USER', "Default user to run process as, if not specified in configuration files") { |value| @options[:user] = value }
++  opts.on('--group GROUP', "Default group to run process as, if not specified in configuration files") { |value| @options[:group] = value }
+ 
+   if ARGV.empty?
+     puts opts
+@@ -52,14 +56,14 @@ end
+ case @cmd[0]
+ when "start": 
+   puts "Starting all mongrel_clusters..."
+-  run "start", @options[:verbose], @options[:clean]
++  run "start", @options[:verbose], @options[:clean], @options[:user], @options[:group]
+ when "stop":
+   puts "Stopping all mongrel_clusters..."
+   run "stop", @options[:verbose], @options[:clean]
+ when "restart":
+   puts "Restarting all mongrel_clusters..."
+   run "stop", @options[:verbose], @options[:clean]
+-  run "start", @options[:verbose], @options[:clean]
++  run "start", @options[:verbose], @options[:clean], @options[:user], @options[:group]
+ when "status":
+   puts "Checking all mongrel_clusters..."
+   run "status", @options[:verbose]
+diff --git a/lib/mongrel_cluster/init.rb b/lib/mongrel_cluster/init.rb
+--- a/lib/mongrel_cluster/init.rb
++++ b/lib/mongrel_cluster/init.rb
+@@ -58,7 +58,9 @@ module Cluster
+       
+     def start
+       read_options
+-      
++      @options['user'] ||= @user
++      @options['group'] ||= @group
++
+       argv = [ "mongrel_rails" ]
+       argv << "start"
+       argv << "-d"
+@@ -230,6 +232,8 @@ module Cluster
+       options [ 
+         ['-C', '--config PATH', "Path to cluster configuration file", :@config_file, "config/mongrel_cluster.yml"],
+         ['-v', '--verbose', "Print all called commands and output.", :@verbose, false],
++        ['-u', '--user USER',  "Default user to run process as, if not specified in configuration files", :@user, nil],
++        ['-g', '--group GROUP',  "Default group to run process as, if not specified in configuration files", :@group, nil],
+         ['', '--clean', "Remove pid_file if needed before starting", :@clean, false],
+         ['', '--only PORT', "Port number of cluster member", :@only, nil]
+       ]
+-- 
+1.6.2
+

Modified: packages/mongrel-cluster/trunk/debian/rules
===================================================================
--- packages/mongrel-cluster/trunk/debian/rules	2009-03-10 22:55:43 UTC (rev 3273)
+++ packages/mongrel-cluster/trunk/debian/rules	2009-03-14 08:54:24 UTC (rev 3274)
@@ -1,3 +1,4 @@
 #!/usr/bin/make -f
  
 include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/rules/simple-patchsys.mk




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