Software /
code /
prosody
Changeset
4881:eafed1728be3
prosodyctl: Add duplicate code for getting version of prosody
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 15 May 2012 20:15:52 +0200 |
parents | 4880:6d96e2e717c1 |
children | 4882:0978ada808cc |
files | prosodyctl |
diffstat | 1 files changed, 16 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/prosodyctl Tue May 15 13:35:09 2012 +0100 +++ b/prosodyctl Tue May 15 20:15:52 2012 +0200 @@ -233,6 +233,21 @@ 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 @@ end function commands.about(arg) + read_version(); if arg[1] == "--help" then show_usage([[about]], [[Show information about this Prosody installation]]); return 1;