lib/getch/config/iwd.rb in getch-0.3.6 vs lib/getch/config/iwd.rb in getch-0.5.0

- old
+ new

@@ -1,11 +1,15 @@ +# frozen_string_literal: true + module Getch module Config + # Configure iwd if wifi is detected class Iwd include NiTo def initialize + @options = "[General]\nUseDefaultInterface=true\n" x end protected @@ -42,17 +46,16 @@ end # https://docs.voidlinux.org/config/network/iwd.html#troubleshooting def iwd_conf conf = "#{OPTIONS[:mountpoint]}/etc/iwd/main.conf" - content = "[General]\n" - content << "UseDefaultInterface=true\n" + content = @options.dup content << "[Network]\n" - Helpers.systemd? ? - content << "NameResolvingService=systemd\n" : - content << "NameResolvingService=resolvconf\n" - content << "[Scan]\n" - content << "DisablePeriodicScan=true\n" + content << if Helpers.systemd? + "NameResolvingService=systemd\n" + else + "NameResolvingService=resolvconf\n" + end mkdir "#{OPTIONS[:mountpoint]}/etc/iwd" echo conf, "#{content}\n" end end end