#!/usr/bin/env ruby # # @markup ruby # @title Installation Script # # = Jerbil Installation # # == Uses Jeni to install Jerbil Files # # Author:: Robert Sharp # Copyright:: Copyright (c) 2011 Robert Sharp # License:: Open Software Licence v3.0 # # This software is licensed for use under the Open Software Licence v. 3.0 # The terms of this licence can be found at http://www.opensource.org/licenses/osl-3.0.php # and in the file copyright.txt. Under the terms of this licence, all derivative works # must themselves be licensed under the Open Software Licence v. 3.0 # # # require 'rubygems' # jeni uses it anyway to find the jerbil gem so why not use it here? require 'jeni' Jeni::Installer.new_from_gem('jerbil') do |jeni| jeni.optparse(ARGV) #jeni.usr # force files to be relative to /usr jeni.message('warning', "executables will be installed relative to #{jeni.target_root}", :warning) jeni.message('warning', "use -u or -t to change", :warning) # create a user, if not already created, with its own group jeni.user('jerbil', :skip=>true, :user_group=>true, :home=>'/var/run/jerbil') # make the required directories, if they do not already exist jeni.empty_directory('/etc/jerbil') jeni.empty_directory('/var/log/jerbil', :chown=>'jerbil', :chgrp=>'jerbil', :chmod=>0775) jeni.empty_directory('/var/run/jerbil', :chown=>'jerbil', :chgrp=>'jerbil', :chmod=>0775) jeni.file('etc/jerbil/jerbil.rb', '/etc/jerbil/jerbil.rb', :chown=>'jerbil', :chgrp=>'jerbil', :chmod=>0640) jeni.file('etc/jerbil/jerbil-test.rb', '/etc/jerbil/jerbil-test.rb', :chown=>'jerbil', :chgrp=>'jerbil', :chmod=>0640) # configuration file to run the service jeni.file('etc/conf.d/jerbild', '/etc/conf.d/jerbild') # and the init script itself jeni.file('etc/init.d/jerbild', '/etc/init.d/jerbild', :chmod=>0755) # and init files for jservice jeni.file('etc/conf.d/jerbil', '/etc/conf.d/jerbil') jeni.file('etc/conf.d/jerbil.service', '/etc/conf.d/jerbil.service') jeni.file('etc/init.d/jerbil', '/etc/init.d/jerbil', :chmod=>0755) # the daemon itself, which is executable jeni.wrapper('sbin/jerbild', 'sbin/jerbild', :chmod=>0755) jeni.wrapper('sbin/jerbil-stop', 'sbin/jerbil-stop', :chmod=>0755) jeni.wrapper('sbin/jerbil-status', 'sbin/jerbil-status', :chmod=>0755) jeni.wrapper('sbin/jserviced', 'sbin/jserviced', :chmod=>0755) jeni.wrapper('sbin/jservice-stop', 'sbin/jservice-stop', :chmod=>0755) jeni.wrapper('sbin/jservice-status', 'sbin/jservice-status', :chmod=>0755) end.run!