Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue 213 - tell user to install proper erlang version if crypto module not present #240

Merged
merged 1 commit into from May 26, 2011
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/agner.erl
Expand Up @@ -28,6 +28,7 @@ start() ->
[_|_] ->
ignore
end,
ensure_crypto_loaded(),
filelib:ensure_dir(os:getenv("AGNER_EXACT_PREFIX") ++ "/"),
inets:start(),
ssl:start(),
Expand Down Expand Up @@ -104,3 +105,20 @@ fetch(Name, Version, Directory) ->

versions(Name) ->
agner_server:versions(Name).


%%%===================================================================
%%% private
%%%===================================================================
ensure_crypto_loaded() ->
case code:load_file(crypto) of
{module, crypto} ->
ignore;
{error, _Err} ->
[io:format("~s~n", [Msg])
|| Msg <- ["Your local Erlang installation doesn't include the crypto module",
"Make sure you have erlang-crypto and erlang-dev if on Debian",
" have erlang-crypto and erlang-devel if on Redhat/Fedora",
" sudo port install erlang +ssl if on OS X",
"Or, let kerl (https://github.com/evax/kerl) take care of those for you"]]
end.