From dbc8bac37054f6fea50bd3c39241bdcf808b0b3f Mon Sep 17 00:00:00 2001 From: Azul Date: Mon, 31 Dec 2012 15:14:28 +0100 Subject: renaming binary to leap_ca_daemon --- bin/leap_ca | 59 ------------------------------------------------------ bin/leap_ca_daemon | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ leap_ca.gemspec | 2 +- 3 files changed, 60 insertions(+), 60 deletions(-) delete mode 100755 bin/leap_ca create mode 100755 bin/leap_ca_daemon diff --git a/bin/leap_ca b/bin/leap_ca deleted file mode 100755 index 13c0691..0000000 --- a/bin/leap_ca +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/ruby - -# -# LEAP Client Certificate Generation Daemon -# - -BASE_DIR = File.expand_path('../..', File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__) - -begin - # - # try without rubygems (might be already loaded or not present) - # - require 'leap_ca/version' -rescue LoadError - # - # try with rubygems - # - require "#{BASE_DIR}/lib/leap_ca/version.rb" - LeapCA::REQUIRE_PATHS.each do |path| - path = File.expand_path(path, BASE_DIR) - $LOAD_PATH.unshift path unless $LOAD_PATH.include?(path) - end - require 'rubygems' - require 'leap_ca/version' -end - -# Graceful Ctrl-C -Signal.trap("SIGINT") do - puts "\nQuit" - exit -end - -# this changes later, so save the initial current directory -CWD = Dir.pwd - -# handle --version ourselves -if ARGV.grep(/--version/).any? - puts "leap_ca #{LeapCA::VERSION}, ruby #{RUBY_VERSION}" - exit(0) -end - -# --fill-pool will fill the pool and then exit -if ARGV.grep(/--fill-pool/).any? - require 'leap_ca' - pool = LeapCA::Pool.new(:size => LeapCA::Config.max_pool_size) - pool.fill - exit(0) -end - -# -# Start the daemon -# -require 'daemons' -if ENV["USER"] == "root" - options = {:app_name => 'leap_ca', :dir_mode => :system} # this will put the pid file in /var/run -else - options = {:app_name => 'leap_ca', :dir_mode => :normal, :dir => '/tmp'} # this will put the pid file in /tmp -end -Daemons.run("#{BASE_DIR}/lib/leap_ca_daemon.rb", options) diff --git a/bin/leap_ca_daemon b/bin/leap_ca_daemon new file mode 100755 index 0000000..13c0691 --- /dev/null +++ b/bin/leap_ca_daemon @@ -0,0 +1,59 @@ +#!/usr/bin/ruby + +# +# LEAP Client Certificate Generation Daemon +# + +BASE_DIR = File.expand_path('../..', File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__) + +begin + # + # try without rubygems (might be already loaded or not present) + # + require 'leap_ca/version' +rescue LoadError + # + # try with rubygems + # + require "#{BASE_DIR}/lib/leap_ca/version.rb" + LeapCA::REQUIRE_PATHS.each do |path| + path = File.expand_path(path, BASE_DIR) + $LOAD_PATH.unshift path unless $LOAD_PATH.include?(path) + end + require 'rubygems' + require 'leap_ca/version' +end + +# Graceful Ctrl-C +Signal.trap("SIGINT") do + puts "\nQuit" + exit +end + +# this changes later, so save the initial current directory +CWD = Dir.pwd + +# handle --version ourselves +if ARGV.grep(/--version/).any? + puts "leap_ca #{LeapCA::VERSION}, ruby #{RUBY_VERSION}" + exit(0) +end + +# --fill-pool will fill the pool and then exit +if ARGV.grep(/--fill-pool/).any? + require 'leap_ca' + pool = LeapCA::Pool.new(:size => LeapCA::Config.max_pool_size) + pool.fill + exit(0) +end + +# +# Start the daemon +# +require 'daemons' +if ENV["USER"] == "root" + options = {:app_name => 'leap_ca', :dir_mode => :system} # this will put the pid file in /var/run +else + options = {:app_name => 'leap_ca', :dir_mode => :normal, :dir => '/tmp'} # this will put the pid file in /tmp +end +Daemons.run("#{BASE_DIR}/lib/leap_ca_daemon.rb", options) diff --git a/leap_ca.gemspec b/leap_ca.gemspec index d213748..427d316 100644 --- a/leap_ca.gemspec +++ b/leap_ca.gemspec @@ -16,7 +16,7 @@ Gem::Specification.new do |s| s.files = Dir["{config,lib}/**/*", 'bin/*'] + ["Rakefile", "README.md"] s.test_files = Dir["test/**/*"] s.bindir = 'bin' - s.executables << 'leap_ca' + s.executables << 'leap_ca_daemon' s.add_dependency "couchrest", "~> 1.1.3" s.add_dependency "couchrest_model", "~> 2.0.0.beta2" -- cgit v1.2.3