diff --git a/lib/vintage_net_wifi.ex b/lib/vintage_net_wifi.ex index 24790e7..8f0a0da 100644 --- a/lib/vintage_net_wifi.ex +++ b/lib/vintage_net_wifi.ex @@ -3,6 +3,7 @@ defmodule VintageNetWiFi do require Logger + alias VintageNet.Command alias VintageNet.Interface.RawConfig alias VintageNet.IP.{DhcpdConfig, DnsdConfig, IPv4Config} alias VintageNetWiFi.{WPA2, WPASupplicant} @@ -310,9 +311,14 @@ defmodule VintageNetWiFi do end @impl true - def check_system(_opts) do - # TODO - :ok + def check_system(opts) do + with :ok <- Command.verify_program(opts, :bin_wpa_supplicant), + :ok <- Command.verify_program(opts, :bin_udhcpc), + :ok <- Command.verify_program(opts, :bin_udhcpd), + :ok <- Command.verify_program(opts, :bin_dnsd), + :ok <- Command.verify_program(opts, :bin_ip) do + :ok + end end defp wifi_to_supplicant_contents(wifi, control_interface_dir, regulatory_domain) do diff --git a/mix.exs b/mix.exs index 158fdeb..795b645 100644 --- a/mix.exs +++ b/mix.exs @@ -65,7 +65,7 @@ defmodule VintageNetWiFi.MixProject do defp deps do [ - {:vintage_net, "~> 0.8.0"}, + {:vintage_net, github: "nerves-networking/vintage_net", branch: "verify-system"}, {:credo, "~> 1.2", only: :test, runtime: false}, {:dialyxir, "~> 1.0.0", only: [:dev, :test], runtime: false}, {:elixir_make, "~> 0.6", runtime: false}, diff --git a/mix.lock b/mix.lock index 94489a8..a63e8fd 100644 --- a/mix.lock +++ b/mix.lock @@ -21,5 +21,5 @@ "parse_trans": {:hex, :parse_trans, "3.3.0", "09765507a3c7590a784615cfd421d101aec25098d50b89d7aa1d66646bc571c1", [:rebar3], [], "hexpm", "17ef63abde837ad30680ea7f857dd9e7ced9476cdd7b0394432af4bfc241b960"}, "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"}, "unicode_util_compat": {:hex, :unicode_util_compat, "0.5.0", "8516502659002cec19e244ebd90d312183064be95025a319a6c7e89f4bccd65b", [:rebar3], [], "hexpm", "d48d002e15f5cc105a696cf2f1bbb3fc72b4b770a184d8420c8db20da2674b38"}, - "vintage_net": {:hex, :vintage_net, "0.8.0", "6d8788c3a6cfddb8b98bacd30d1c58edf29ddb61130667496828129577dca790", [:make, :mix], [{:busybox, "~> 0.1.5", [hex: :busybox, repo: "hexpm", optional: true]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}, {:gen_state_machine, "~> 2.0.0 or ~> 2.1.0", [hex: :gen_state_machine, repo: "hexpm", optional: false]}, {:muontrap, "~> 0.5.1 or ~> 0.6.0", [hex: :muontrap, repo: "hexpm", optional: false]}], "hexpm", "492cdec21b8ee9c2a3bb0dfd6fa12d1f2aadb19875c1bf3f780dc5b899dde9eb"}, + "vintage_net": {:git, "https://github.com/nerves-networking/vintage_net.git", "625dfb95e2d11387fd1dcc784daf36a43a6ee4cc", [branch: "verify-system"]}, } diff --git a/test/vintage_net_wifi_test.exs b/test/vintage_net_wifi_test.exs index 9dca74e..6e50e85 100644 --- a/test/vintage_net_wifi_test.exs +++ b/test/vintage_net_wifi_test.exs @@ -1821,4 +1821,17 @@ defmodule VintageNetWiFiTest do assert output == VintageNetWiFi.to_raw_config("wlan0", input, default_opts()) end + + test "check_system" do + result = + VintageNetWiFi.check_system( + bin_wpa_supplicant: "/bin/[", + bin_udhcpc: "/bin/[", + bin_udhcpd: "/bin/[", + bin_dnsd: "/bin/[", + bin_ip: "/bin/[" + ) + + assert result == :ok + end end