# HG changeset patch # User Kim Alvefur # Date 1337105752 -7200 # Node ID eafed1728be363380acdfcc594afe337361ff0ef # Parent 6d96e2e717c1293d6fa66fdedf399aba54380113 prosodyctl: Add duplicate code for getting version of prosody diff -r 6d96e2e717c1 -r eafed1728be3 prosodyctl --- 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;