Sha256: 6083a8b2a07e4cc10109deaa377d72c38d35da2b0ded40f55ad7d0646b054cab

Contents?: true

Size: 724 Bytes

Versions: 9

Compression:

Stored size: 724 Bytes

Contents

require 'nito'

module Getch
  module Config
    class PreNetwork
      include NiTo

      def initialize
        @log = Log.new
        x
      end

      protected

      def x
        @log.info "Configuring pre-network...\n"
        hostname
        copy_dns
      end

      private

      def hostname
        @log.info 'Writing /etc/hostname...'
        echo "#{OPTIONS[:mountpoint]}/etc/hostname", 'host'
        @log.result_ok
      end

      def copy_dns
        @log.info 'Copying DNS from current host...'
        cp '/etc/resolv.conf', "#{OPTIONS[:mountpoint]}/etc/resolv.conf"
        echo_a "#{OPTIONS[:mountpoint]}/etc/resolv.conf", 'nameserver 127.0.0.1'
        @log.result_ok
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
getch-0.11.0 lib/getch/config/pre_network.rb
getch-0.7.3 lib/getch/config/pre_network.rb
getch-0.7.0 lib/getch/config/pre_network.rb
getch-0.5.0 lib/getch/config/pre_network.rb
getch-0.3.6 lib/getch/config/pre_network.rb
getch-0.3.5 lib/getch/config/pre_network.rb
getch-0.3.4 lib/getch/config/pre_network.rb
getch-0.3.3 lib/getch/config/pre_network.rb
getch-0.3.0 lib/getch/config/pre_network.rb