lib/invoker/power/setup/distro/base.rb in invoker-1.4.1 vs lib/invoker/power/setup/distro/base.rb in invoker-1.5.1

- old
+ new

@@ -1,54 +1,56 @@ module Invoker module Power module Distro class Base - RESOLVER_FILE = "/etc/dnsmasq.d/dev-tld" - RINETD_FILE = "/etc/rinetd.conf" + SOCAT_SHELLSCRIPT = "/usr/bin/invoker_forwarder.sh" + SOCAT_SYSTEMD = "/etc/systemd/system/socat_invoker.service" + RESOLVER_DIR = "/etc/dnsmasq.d" + attr_accessor :tld - def self.distro_installer + def resolver_file + File.join(RESOLVER_DIR, "#{tld}-tld") + end + + def self.distro_installer(tld) case Facter[:operatingsystem].value when "Ubuntu" require "invoker/power/setup/distro/ubuntu" - Ubuntu.new + Ubuntu.new(tld) when "Fedora" require "invoker/power/setup/distro/redhat" - Redhat.new + Redhat.new(tld) when "Archlinux" require "invoker/power/setup/distro/arch" - Arch.new + Arch.new(tld) when "Debian" require "invoker/power/setup/distro/debian" - Debian.new + Debian.new(tld) when "LinuxMint" require "invoker/power/setup/distro/mint" - Mint.new + Mint.new(tld) + when "OpenSuSE" + require "invoker/power/setup/distro/opensuse" + Opensuse.new(tld) else raise "Your selected distro is not supported by Invoker" end end - def resolver_file - RESOLVER_FILE + def initialize(tld) + self.tld = tld end - def rinetd_file - RINETD_FILE - end - # Install required software def install_required_software raise "Unimplemented" end def restart_services - if Facter[:systemctl] == "true" - system("systemctl restart rinetd") - system("systemctl restart dnsmasq") - else - system("service rinetd restart") - system("service dnsmasq restart") - end + system("systemctl enable socat_invoker.service") + system("systemctl enable dnsmasq") + system("systemctl start socat_invoker.service") + system("systemctl restart dnsmasq") end end end end end