class Helpers::NewSystemd

Public Class Methods

new(string, name) click to toggle source
Calls superclass method Helpers::NewFile::new
# File lib/amnesie/helpers.rb, line 47
def initialize(string, name)
  super
  @systemd_dir = search_systemd_dir
  @dest = @systemd_dir + "/" + @name
end

Public Instance Methods

add() click to toggle source
Calls superclass method Helpers::NewFile#add
# File lib/amnesie/helpers.rb, line 53
def add
  @systemctl = Helpers::Exec.new("systemctl")
  super
  @systemctl.run("daemon-reload")
end

Private Instance Methods

search_systemd_dir() click to toggle source
# File lib/amnesie/helpers.rb, line 60
def search_systemd_dir
  if Dir.exist? "/lib/systemd/system"
    "/lib/systemd/system"
  elsif Dir.exist? "/usr/lib/systemd/system"
    "/usr/lib/systemd/system"
  else
    raise "Systemd is no found..."
  end
end