diff options
author | Kim Alvefur <zash@zash.se> | 2012-05-15 20:15:52 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2012-05-15 20:15:52 +0200 |
commit | 0c3b73623b1fcb542c63800874134a2e0f79d7c2 (patch) | |
tree | 1414f1b93994496a26b3da2212d12943d10ee86e /prosodyctl | |
parent | dac7d9c03f6234c91dd67c98010931ede21ba2b7 (diff) | |
download | prosody-0c3b73623b1fcb542c63800874134a2e0f79d7c2.tar.gz prosody-0c3b73623b1fcb542c63800874134a2e0f79d7c2.zip |
prosodyctl: Add duplicate code for getting version of prosody
Diffstat (limited to 'prosodyctl')
-rwxr-xr-x | prosodyctl | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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; |