diff --git a/html/user/get_project_config.php b/html/user/get_project_config.php index 91e2e27071..2fb20cdb67 100644 --- a/html/user/get_project_config.php +++ b/html/user/get_project_config.php @@ -18,6 +18,8 @@ require_once("../inc/util.inc"); require_once("../inc/xml.inc"); +if(file_exists('../inc/release.inc')) + include '../inc/release.inc'; BoincDb::get(true); xml_header(); @@ -63,6 +65,14 @@ echo " ".secure_url_base()." "; +if ( isset($git_commit) ) { + echo "$git_commit\n"; +} + +if ( isset($server_version) ) { + echo "$server_version\n"; +} + if (parse_config($config, "")) { echo " \n"; } diff --git a/html/user/server_status.php b/html/user/server_status.php index f814dbd510..1770a8ccdb 100644 --- a/html/user/server_status.php +++ b/html/user/server_status.php @@ -30,6 +30,8 @@ require_once("../inc/cache.inc"); require_once("../inc/util.inc"); require_once("../inc/xml.inc"); require_once("../inc/boinc_db.inc"); +if(file_exists('../inc/release.inc')) + include '../inc/release.inc'; if (!defined('STATUS_PAGE_TTL')) { define('STATUS_PAGE_TTL', 3600); @@ -183,6 +185,11 @@ function show_status_html($x) { "; } end_table(); + + if ( isset($server_version) && isset($git_commit) ) { + echo "Server version: $server_version ($git_commit)\n"; + } + if ($j->db_revision) { echo tra("Database schema version: "), $j->db_revision; } diff --git a/py/Boinc/setup_project.py b/py/Boinc/setup_project.py index 9251321b38..140ef3cdc3 100644 --- a/py/Boinc/setup_project.py +++ b/py/Boinc/setup_project.py @@ -9,6 +9,7 @@ import boinc_path_config from Boinc import database, db_mid, configxml, tools from Boinc.boinc_db import * import os, sys, glob, time, shutil, re, random +import subprocess class Options: pass @@ -339,6 +340,28 @@ def install_boinc_files(dest_dir, install_web_files, install_server_files): shutil.copy(srcdir('html/user/sample_motd.php'), dir('html/user/motd.php')) os.system("rm -f "+dir('html/languages/translations/*')) install_glob(srcdir('html/languages/translations/*.po'), dir('html/languages/translations/')) + os.remove(srcdir('html/inc/release.inc')) + try: + s = subprocess.Popen(["git", "rev-parse", "HEAD"], stdout=subprocess.PIPE, stderr=open(os.devnull, 'w')) + commit = s.stdout.read()[:7] + s = subprocess.Popen(["git", "branch"], stdout=subprocess.PIPE, stderr=open(os.devnull, 'w')) + branch = s.stdout.read().split('*')[1].split('\n')[0].strip() + s = subprocess.Popen(["git", "tag", "-l", "--points-at", "HEAD"], stdout=subprocess.PIPE, stderr=open(os.devnull, 'w')) + version = s.stdout.read().split("/")[-1].strip() + content = ''' +'''.format(commit=commit, branch=branch, version=version) + f = open(srcdir('html/inc/release.inc'), 'w') + f.write(content) + f.close() + except Exception, e: + print 'Not running from git source, no version or commit detected.' + # copy Python stuff map(lambda (s): install(srcdir('sched',s), dir('bin',s)),