Sha256: c137adb35ec1bbd542d4087380b301e840b9de21ee59a05af92b709a98b4faa3

Contents?: true

Size: 1.31 KB

Versions: 5

Compression:

Stored size: 1.31 KB

Contents

module Getch
  module Config
    class Iwd
      include NiTo

      def initialize
        x
      end

      protected

      def x
        runit
        systemd
        openrc
      end

      private

      # https://docs.voidlinux.org/config/network/iwd.html
      def runit
        Helpers.runit? || return

        iwd_conf
        service = '/etc/runit/runsvdir/default/'
        Chroot.new("ln -fs /etc/sv/dbus #{service}")
        Chroot.new("ln -fs /etc/sv/iwd #{service}")
      end

      def systemd
        Helpers.systemd? || return

        iwd_conf
        Chroot.new('systemctl enable iwd')
      end

      def openrc
        Helpers.openrc? || return

        iwd_conf
        Chroot.new('rc-update add iwd default')
      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 << "[Network]\n"
        Helpers.systemd? ?
          content << "NameResolvingService=systemd\n" :
          content << "NameResolvingService=resolvconf\n"
        content << "[Scan]\n"
        content << "DisablePeriodicScan=true\n"
        mkdir "#{OPTIONS[:mountpoint]}/etc/iwd"
        echo conf, "#{content}\n"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
getch-0.3.6 lib/getch/config/iwd.rb
getch-0.3.5 lib/getch/config/iwd.rb
getch-0.3.4 lib/getch/config/iwd.rb
getch-0.3.3 lib/getch/config/iwd.rb
getch-0.3.0 lib/getch/config/iwd.rb