Sha256: f672714fab8f2d6a3defae252190888c24d497fe212be504a0347bbd8119548e

Contents?: true

Size: 533 Bytes

Versions: 77

Compression:

Stored size: 533 Bytes

Contents

module CFMicro::Switcher

  class Linux < Base
    def set_nameserver(domain, ip)
      CFMicro.run_command("sudo", "sed -i'.backup' '1 i nameserver #{ip}' /etc/resolv.conf")
      # lock resolv.conf so Network Manager doesn't clear out the file when offline
      CFMicro.run_command("sudo", "chattr +i /etc/resolv.conf")
    end

    def unset_nameserver(domain, ip)
      CFMicro.run_command("sudo", "chattr -i /etc/resolv.conf")
      CFMicro.run_command("sudo", "sed -i'.backup' '/#{ip}/d' /etc/resolv.conf")
    end
  end

end

Version data entries

77 entries across 77 versions & 3 rubygems

Version Path
cf-5.4.7 lib/micro/switcher/linux.rb
cf-5.4.7.rc1 lib/micro/switcher/linux.rb
cf-5.4.5 lib/micro/switcher/linux.rb
cf-5.4.4 lib/micro/switcher/linux.rb
trucker-cli-0.0.3 lib/micro/switcher/linux.rb
cf-5.4.3 lib/micro/switcher/linux.rb
cf-5.4.2 lib/micro/switcher/linux.rb
trucker-cli-0.0.2 lib/micro/switcher/linux.rb
trucker-cli-0.0.1 lib/micro/switcher/linux.rb
cf-5.4.1 lib/micro/switcher/linux.rb
cf-5.4.1.rc1 lib/micro/switcher/linux.rb
cf-5.4.0 lib/micro/switcher/linux.rb
cf-5.3.1 lib/micro/switcher/linux.rb
cf-5.3.0 lib/micro/switcher/linux.rb
cf-5.2.2 lib/micro/switcher/linux.rb
cf-5.2.1.rc15 lib/micro/switcher/linux.rb
cf-5.2.1.rc14 lib/micro/switcher/linux.rb
cf-5.2.1.rc13 lib/micro/switcher/linux.rb
cf-5.2.1.rc12 lib/micro/switcher/linux.rb
cf-5.2.1.rc11 lib/micro/switcher/linux.rb