Software /
code /
prosody
Annotate
util/dependencies.lua @ 409:2269e9cbe153
Add MD5 to the list of checked dependencies
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 25 Nov 2008 02:30:25 +0000 |
parent | 408:eb1a0960cefb |
child | 410:5ce6801ad2e4 |
rev | line source |
---|---|
408
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1 local fatal; |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2 |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3 local function softreq(...) local ok, lib = pcall(require, ...); if ok then return lib; else return nil; end end |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
4 |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
5 local function missingdep(name, sources, msg) |
409
2269e9cbe153
Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents:
408
diff
changeset
|
6 print(""); |
2269e9cbe153
Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents:
408
diff
changeset
|
7 print("**************************"); |
408
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
8 print("Prosody was unable to find "..tostring(name)); |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
9 print("This package can be obtained in the following ways:"); |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
10 print(""); |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
11 for k,v in pairs(sources) do |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
12 print("", k, v); |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
13 end |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
14 print(msg or (name.." is required for Prosody to run, so we will now exit.")); |
409
2269e9cbe153
Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents:
408
diff
changeset
|
15 print("More help can be found on our website, at http://.../doc/depends"); |
2269e9cbe153
Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents:
408
diff
changeset
|
16 print("**************************"); |
2269e9cbe153
Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents:
408
diff
changeset
|
17 print(""); |
408
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
18 end |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
19 |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
20 local lxp = softreq "lxp" |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
21 |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
22 if not lxp then |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
23 missingdep("luaexpat", { ["Ubuntu 8.04 (Hardy)"] = "sudo apt-get install liblua5.1-expat0"; ["luarocks"] = "luarocks install luaexpat"; }); |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
24 fatal = true; |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
25 end |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
26 |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
27 local socket = softreq "socket" |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
28 |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
29 if not socket then |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
30 missingdep("luasocket", { ["Ubuntu 8.04 (Hardy)"] = "sudo apt-get install liblua5.1-socket2"; ["luarocks"] = "luarocks install luasocket"; }); |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
31 fatal = true; |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
32 end |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
33 |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
34 local ssl = softreq "ssl" |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
35 |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
36 if not ssl then |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
37 missingdep("LuaSec", { ["Source"] = "http://www.inf.puc-rio.br/~brunoos/luasec/" }, "SSL/TLS support will not be available"); |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
38 end |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
39 |
409
2269e9cbe153
Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents:
408
diff
changeset
|
40 |
2269e9cbe153
Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents:
408
diff
changeset
|
41 local md5 = softreq "md5"; |
2269e9cbe153
Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents:
408
diff
changeset
|
42 |
2269e9cbe153
Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents:
408
diff
changeset
|
43 if not md5 then |
2269e9cbe153
Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents:
408
diff
changeset
|
44 missingdep("MD5", { ["luarocks"] = "luarocks install md5"; ["Source"] = "http://luaforge.net/frs/?group_id=155" }); |
2269e9cbe153
Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents:
408
diff
changeset
|
45 fatal = true; |
2269e9cbe153
Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents:
408
diff
changeset
|
46 end |
2269e9cbe153
Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents:
408
diff
changeset
|
47 |
2269e9cbe153
Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents:
408
diff
changeset
|
48 |
408
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
49 if fatal then os.exit(1); end |