Class: AutomateIt::ServiceManager::RC_Update
- Defined in:
- lib/automateit/service_manager/rc_update.rb
Overview
ServiceManager::RC_Update
RC_Update implements the #enabled?, #enable and #disable features of the ServiceManager on Gentoo-like systems.
Instance Method Summary collapse
-
#disable(service, opts = {}) ⇒ Object
See ServiceManager#disable.
-
#enable(service, opts = {}) ⇒ Object
See ServiceManager#enable.
-
#enabled?(service) ⇒ Boolean
See ServiceManager#enabled?.
-
#suitability(method, *args) ⇒ Object
:nodoc:.
Instance Method Details
#disable(service, opts = {}) ⇒ Object
See ServiceManager#disable
32 33 34 35 36 |
# File 'lib/automateit/service_manager/rc_update.rb', line 32 def disable(service, opts={}) _raise_unless_available return false unless enabled?(service) interpreter.sh("rc-update del #{service} default > /dev/null 2>&1") end |
#enable(service, opts = {}) ⇒ Object
See ServiceManager#enable
25 26 27 28 29 |
# File 'lib/automateit/service_manager/rc_update.rb', line 25 def enable(service, opts={}) _raise_unless_available return false if enabled?(service) interpreter.sh("rc-update add #{service} default > /dev/null 2>&1") end |
#enabled?(service) ⇒ Boolean
See ServiceManager#enabled?
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/automateit/service_manager/rc_update.rb', line 13 def enabled?(service) _raise_unless_available # Do NOT use Gentoo's rc-update because the idiot that wrote that utility # truncates service names to look "prettier" and provides no way to disable # this annoyance for people that need to query services by name. result = %w(boot default).select do |runlevel| File.exists?(File.join("/etc/runlevels", runlevel, service)) end return ! result.empty? end |
#suitability(method, *args) ⇒ Object
:nodoc:
8 9 10 |
# File 'lib/automateit/service_manager/rc_update.rb', line 8 def suitability(method, *args) # :nodoc: return available? ? 2 : 0 end |