2002-04-30 22:22:54 +00:00
|
|
|
<?php
|
|
|
|
|
2002-05-24 04:29:10 +00:00
|
|
|
//define("HOME", "home/david");
|
|
|
|
//define("DOWNLOAD_DIR", "$HOME/html/download");
|
|
|
|
//define("UPLOAD_DIR", "$HOME/html/upload");
|
|
|
|
//define("PLATFORM_NAME", "i686-pc-linux-gnu");
|
2002-04-30 22:22:54 +00:00
|
|
|
define("VERSION", "1");
|
2002-05-24 04:29:10 +00:00
|
|
|
define("CORE_CLIENT", "boinc_".VERSION."_$BOINC_PLATFORM");
|
2002-05-17 22:33:57 +00:00
|
|
|
define("PROJECTS", "localhost.localdomain zoot");
|
2002-04-30 22:22:54 +00:00
|
|
|
// directories to empty
|
2002-05-24 04:29:10 +00:00
|
|
|
//define("EMAIL_ADDR", "david@localhost.localdomain");
|
|
|
|
//define("URL_BASE", "http://localhost.localdomain/download");
|
2002-04-30 22:22:54 +00:00
|
|
|
// data server URL root
|
|
|
|
|
|
|
|
include_once("../html_user/db.inc");
|
|
|
|
|
|
|
|
function clear_db() {
|
|
|
|
PassThru("cd ../db; init_db");
|
|
|
|
}
|
|
|
|
|
2002-05-24 04:29:10 +00:00
|
|
|
$BOINC_DOWNLOAD_DIR = null;
|
|
|
|
$BOINC_UPLOAD_DIR = null;
|
|
|
|
$BOINC_PLATFORM = null;
|
|
|
|
$BOINC_EMAIL = null;
|
|
|
|
$BOINC_URL_BASE = null;
|
|
|
|
|
|
|
|
function check_env_vars() {
|
|
|
|
global $BOINC_DOWNLOAD_DIR;
|
|
|
|
global $BOINC_UPLOAD_DIR;
|
|
|
|
global $BOINC_PLATFORM;
|
|
|
|
global $BOINC_EMAIL;
|
|
|
|
global $BOINC_URL_BASE;
|
|
|
|
|
|
|
|
$bad = false;
|
|
|
|
$BOINC_DOWNLOAD_DIR = getenv("BOINC_DOWNLOAD_DIR");
|
|
|
|
if ($BOINC_DOWNLOAD_DIR == null) {
|
|
|
|
echo "Must define BOINC_DOWNLOAD_DIR\n";
|
|
|
|
$bad = true;
|
|
|
|
}
|
|
|
|
$BOINC_UPLOAD_DIR = getenv("BOINC_UPLOAD_DIR");
|
|
|
|
if ($BOINC_UPLOAD_DIR == null) {
|
|
|
|
echo "Must define BOINC_UPLOAD_DIR\n";
|
|
|
|
$bad = true;
|
|
|
|
}
|
|
|
|
$BOINC_PLATFORM = getenv("BOINC_PLATFORM");
|
|
|
|
if ($BOINC_PLATFORM == null) {
|
|
|
|
echo "Must define BOINC_PLATFORM\n";
|
|
|
|
$bad = true;
|
|
|
|
}
|
|
|
|
$BOINC_EMAIL = getenv("BOINC_EMAIL");
|
|
|
|
if ($BOINC_EMAIL == null) {
|
|
|
|
echo "Must define BOINC_EMAIL\n";
|
|
|
|
$bad = true;
|
|
|
|
}
|
|
|
|
$BOINC_URL_BASE = getenv("BOINC_URL_BASE");
|
|
|
|
if ($BOINC_URL_BASE == null) {
|
|
|
|
echo "Must define BOINC_URL_BASE\n";
|
|
|
|
$bad = true;
|
|
|
|
}
|
|
|
|
if ($bad) exit();
|
|
|
|
}
|
2002-04-30 22:22:54 +00:00
|
|
|
function clear_data_dirs() {
|
2002-05-24 04:29:10 +00:00
|
|
|
global $BOINC_DOWNLOAD_DIR;
|
|
|
|
global $BOINC_UPLOAD_DIR;
|
|
|
|
|
|
|
|
PassThru("rm -f $BOINC_DOWNLOAD_DIR/*");
|
|
|
|
PassThru("rm -f $BOINC_UPLOAD_DIR/*");
|
2002-04-30 22:22:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function init_client_dirs($account_file) {
|
|
|
|
PassThru("rm -f client_state.xml");
|
|
|
|
PassThru("rm -rf ".PROJECTS);
|
|
|
|
PassThru("rm -rf slots");
|
|
|
|
PassThru("cp $account_file account.xml");
|
|
|
|
}
|
|
|
|
|
|
|
|
function copy_to_download_dir($f) {
|
2002-05-24 04:29:10 +00:00
|
|
|
global $BOINC_DOWNLOAD_DIR;
|
|
|
|
|
|
|
|
PassThru("cp $f $BOINC_DOWNLOAD_DIR");
|
2002-04-30 22:22:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function add_user() {
|
2002-05-24 04:29:10 +00:00
|
|
|
global $BOINC_EMAIL;
|
|
|
|
|
|
|
|
PassThru("../tools/add user -email_addr $BOINC_EMAIL -user_name David -web_password foobar -authenticator 3f7b90793a0175ad0bda68684e8bd136");
|
2002-04-30 22:22:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function add_prefs($file) {
|
2002-05-24 04:29:10 +00:00
|
|
|
global $BOINC_EMAIL;
|
|
|
|
|
|
|
|
PassThru("../tools/add prefs -email_addr $BOINC_EMAIL -prefs_file $file");
|
2002-04-30 22:22:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function add_platform() {
|
2002-05-24 04:29:10 +00:00
|
|
|
global $BOINC_PLATFORM;
|
|
|
|
|
|
|
|
PassThru("../tools/add platform -platform_name $BOINC_PLATFORM");
|
2002-04-30 22:22:54 +00:00
|
|
|
}
|
|
|
|
|
2002-05-17 22:33:57 +00:00
|
|
|
function add_core_client_message($message, $priority) {
|
2002-05-24 04:29:10 +00:00
|
|
|
global $BOINC_DOWNLOAD_DIR;
|
|
|
|
global $BOINC_UPLOAD_DIR;
|
|
|
|
global $BOINC_PLATFORM;
|
|
|
|
|
2002-04-30 22:22:54 +00:00
|
|
|
PassThru("../tools/add app -app_name core_client -version ".VERSION);
|
2002-05-24 04:29:10 +00:00
|
|
|
PassThru("../tools/add app_version -app_name core_client -platform_name $BOINC_PLATFORM -version ".VERSION." -exec_dir ../client -exec_file ".CORE_CLIENT." -download_dir $BOINC_DOWNLOAD_DIR -url_base $BOINC_URL_BASE -message '$message' -message_priority '$priority'");
|
|
|
|
PassThru("cp ../client/".CORE_CLIENT." $BOINC_DOWNLOAD_DIR");
|
2002-04-30 22:22:54 +00:00
|
|
|
}
|
|
|
|
|
2002-05-17 22:33:57 +00:00
|
|
|
function add_core_client() {
|
|
|
|
add_core_client_message("", "");
|
|
|
|
}
|
|
|
|
|
2002-04-30 22:22:54 +00:00
|
|
|
function add_app($name) {
|
2002-05-24 04:29:10 +00:00
|
|
|
global $BOINC_DOWNLOAD_DIR;
|
|
|
|
global $BOINC_PLATFORM;
|
|
|
|
global $BOINC_URL_BASE;
|
|
|
|
|
2002-04-30 22:22:54 +00:00
|
|
|
PassThru("../tools/add app -app_name $name -version ".VERSION);
|
2002-05-24 04:29:10 +00:00
|
|
|
PassThru("../tools/add app_version -app_name $name -platform_name $BOINC_PLATFORM -version ".VERSION." -exec_dir ../apps -exec_file $name -download_dir $BOINC_DOWNLOAD_DIR -url_base $BOINC_URL_BASE");
|
|
|
|
PassThru("cp ../apps/$name $BOINC_DOWNLOAD_DIR");
|
2002-04-30 22:22:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function create_work($x) {
|
2002-05-17 22:33:57 +00:00
|
|
|
PassThru("../tools/create_work $x");
|
2002-04-30 22:22:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function run_client() {
|
|
|
|
PassThru("../client/".CORE_CLIENT." -exit_when_idle");
|
|
|
|
}
|
|
|
|
|
2002-05-24 04:29:10 +00:00
|
|
|
// TODO: make this work
|
|
|
|
function start_feeder() {
|
|
|
|
PassThru("../sched/feeder &");
|
|
|
|
}
|
|
|
|
|
2002-04-30 22:22:54 +00:00
|
|
|
function compare_file($out, $correct) {
|
2002-05-24 04:29:10 +00:00
|
|
|
global $BOINC_UPLOAD_DIR;
|
|
|
|
|
|
|
|
PassThru("diff $BOINC_UPLOAD_DIR/$out $correct", $retval);
|
2002-04-30 22:22:54 +00:00
|
|
|
if ($retval) {
|
|
|
|
echo "File mismatch: $out $correct\n";
|
|
|
|
} else {
|
|
|
|
echo "Files match: $out $correct\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function check_results_done() {
|
|
|
|
db_init();
|
|
|
|
$result = mysql_query("select * from result where state<>4");
|
|
|
|
while ($x = mysql_fetch_object($result)) {
|
|
|
|
echo "result $x->id is not done\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
?>
|