Skip to content

Commit

Permalink
Add real check_system values
Browse files Browse the repository at this point in the history
  • Loading branch information
ConnorRigby committed Jun 7, 2020
1 parent 10294ca commit 4d56e33
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
12 changes: 9 additions & 3 deletions lib/vintage_net_wifi.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
2 changes: 1 addition & 1 deletion mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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", "b4891040cef1d77432a6ba3709440d11f9cec5ab", [branch: "verify-system"]},
}
13 changes: 13 additions & 0 deletions test/vintage_net_wifi_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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/pwd",
bin_udhcpc: "/bin/pwd",
bin_udhcpd: "/bin/pwd",
bin_dnsd: "/bin/pwd",
bin_ip: "/bin/pwd"
)

assert result == :ok
end
end

0 comments on commit 4d56e33

Please sign in to comment.