aboutsummaryrefslogtreecommitdiffstats
path: root/prosodyctl
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
commit4ce79f0c27cc89f389afaeb8bf70cc16eff6c62a (patch)
tree1414f1b93994496a26b3da2212d12943d10ee86e /prosodyctl
parent1c363caf5d2c1d9ae1e850ad2499a59f68a9b0b2 (diff)
downloadprosody-4ce79f0c27cc89f389afaeb8bf70cc16eff6c62a.tar.gz
prosody-4ce79f0c27cc89f389afaeb8bf70cc16eff6c62a.zip
prosodyctl: Add duplicate code for getting version of prosody
Diffstat (limited to 'prosodyctl')
-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;