Sha256: f9feb1854def5dc08da7046b5949a674d3d7730ff26e63e55d55848b8f42abc5

Contents?: true

Size: 1.62 KB

Versions: 6

Compression:

Stored size: 1.62 KB

Contents

module Invoker
  module Power
    module Distro
      class Base
        SOCAT_SHELLSCRIPT = "/usr/bin/invoker_forwarder.sh"
        SOCAT_SYSTEMD = "/etc/systemd/system/socat_invoker.service"
        RESOLVER_DIR = "/etc/dnsmasq.d"
        attr_accessor :tld

        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(tld)
          when "Fedora"
            require "invoker/power/setup/distro/redhat"
            Redhat.new(tld)
          when "Archlinux"
            require "invoker/power/setup/distro/arch"
            Arch.new(tld)
          when "Debian"
            require "invoker/power/setup/distro/debian"
            Debian.new(tld)
          when "LinuxMint"
            require "invoker/power/setup/distro/mint"
            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 initialize(tld)
          self.tld = tld
        end

        # Install required software
        def install_required_software
          raise "Unimplemented"
        end

        def restart_services
          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

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
invoker-1.5.6 lib/invoker/power/setup/distro/base.rb
invoker-1.5.5 lib/invoker/power/setup/distro/base.rb
invoker-1.5.4 lib/invoker/power/setup/distro/base.rb
invoker-1.5.3 lib/invoker/power/setup/distro/base.rb
meepo-1.5.2 lib/invoker/power/setup/distro/base.rb
invoker-1.5.1 lib/invoker/power/setup/distro/base.rb