aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2012-05-15 20:15:52 +0200
committerKim Alvefur <zash@zash.se>2012-05-15 20:15:52 +0200
commit0c3b73623b1fcb542c63800874134a2e0f79d7c2 (patch)
tree1414f1b93994496a26b3da2212d12943d10ee86e
parentdac7d9c03f6234c91dd67c98010931ede21ba2b7 (diff)
downloadprosody-0c3b73623b1fcb542c63800874134a2e0f79d7c2.tar.gz
prosody-0c3b73623b1fcb542c63800874134a2e0f79d7c2.zip
prosodyctl: Add duplicate code for getting version of prosody
-rwxr-xr-xprosodyctl16
1 files changed, 16 insertions, 0 deletions
diff --git a/prosodyctl b/prosodyctl
index 1819ddd1..45b5604a 100755
--- a/prosodyctl
+++ b/prosodyctl
@@ -233,6 +233,21 @@ require "util.prosodyctl"
require "socket"
-----------------------
+ -- FIXME: Duplicate code waiting for util.startup
+function read_version()
+ -- Try to determine version
+ local version_file = io.open((CFG_SOURCEDIR or ".").."/prosody.version");
+ if version_file then
+ prosody.version = version_file:read("*a"):gsub("%s*$", "");
+ version_file:close();
+ if #prosody.version == 12 and prosody.version:match("^[a-f0-9]+$") then
+ prosody.version = "hg:"..prosody.version;
+ end
+ else
+ prosody.version = "unknown";
+ end
+end
+
local show_message, show_warning = prosodyctl.show_message, prosodyctl.show_warning;
local show_usage = prosodyctl.show_usage;
local getchar, getpass = prosodyctl.getchar, prosodyctl.getpass;
@@ -488,6 +503,7 @@ function commands.restart(arg)
end
function commands.about(arg)
+ read_version();
if arg[1] == "--help" then
show_usage([[about]], [[Show information about this Prosody installation]]);
return 1;