2003-06-11 23:36:48 +00:00
|
|
|
// The contents of this file are subject to the BOINC Public License
|
2002-04-30 22:22:54 +00:00
|
|
|
// Version 1.0 (the "License"); you may not use this file except in
|
|
|
|
// compliance with the License. You may obtain a copy of the License at
|
2003-06-11 23:36:48 +00:00
|
|
|
// http://boinc.berkeley.edu/license_1.0.txt
|
2002-04-30 22:22:54 +00:00
|
|
|
//
|
|
|
|
// Software distributed under the License is distributed on an "AS IS"
|
|
|
|
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
|
|
|
// License for the specific language governing rights and limitations
|
|
|
|
// under the License.
|
|
|
|
//
|
|
|
|
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
|
|
|
//
|
|
|
|
// The Initial Developer of the Original Code is the SETI@home project.
|
|
|
|
// Portions created by the SETI@home project are Copyright (C) 2002
|
|
|
|
// University of California at Berkeley. All Rights Reserved.
|
|
|
|
//
|
|
|
|
// Contributor(s):
|
|
|
|
//
|
|
|
|
|
|
|
|
// add.C - add items to the DB
|
|
|
|
//
|
|
|
|
// usages:
|
2003-02-14 23:19:51 +00:00
|
|
|
// add project -project_short_name x -project_long_name x
|
2002-08-25 07:54:33 +00:00
|
|
|
// add project
|
2002-04-30 22:22:54 +00:00
|
|
|
// add app -app_name x
|
|
|
|
// add application
|
|
|
|
// create DB record
|
2003-02-12 18:51:05 +00:00
|
|
|
// add platform -platform_name x -user_friendly_name y
|
2002-04-30 22:22:54 +00:00
|
|
|
// create DB record
|
|
|
|
// add app_version
|
2002-07-29 00:39:45 +00:00
|
|
|
// -app_name x -platform_name y -version a
|
2002-08-14 20:31:27 +00:00
|
|
|
// -download_dir d -download_url e
|
2002-07-29 00:39:45 +00:00
|
|
|
// -exec_dir b
|
|
|
|
// [ -exec_files file1 file2 ... ]
|
|
|
|
// [ -signed_exec_files file1 sign1 file2 sign2 ... ]
|
2002-04-30 22:22:54 +00:00
|
|
|
// create DB record
|
|
|
|
// copy exec to data directory
|
2003-03-20 02:05:25 +00:00
|
|
|
// add user -email_addr x -name y -authenticator a
|
2002-09-27 06:12:50 +00:00
|
|
|
// [ -global_prefs_file y ]
|
2002-04-30 22:22:54 +00:00
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <time.h>
|
|
|
|
|
2003-04-07 19:06:00 +00:00
|
|
|
#include "boinc_db.h"
|
2002-04-30 22:22:54 +00:00
|
|
|
#include "backend_lib.h"
|
|
|
|
#include "md5_file.h"
|
2002-07-11 01:09:53 +00:00
|
|
|
#include "crypt.h"
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2003-06-04 17:21:26 +00:00
|
|
|
//APP app;
|
|
|
|
//PLATFORM platform;
|
|
|
|
//APP_VERSION app_version;
|
|
|
|
//USER user;
|
|
|
|
//PROJECT project;
|
2002-08-25 07:54:33 +00:00
|
|
|
|
2002-07-29 00:39:45 +00:00
|
|
|
int version, retval, nexec_files;
|
2002-05-29 23:25:21 +00:00
|
|
|
double nbytes;
|
2002-07-29 00:39:45 +00:00
|
|
|
bool signed_exec_files;
|
2002-05-29 23:25:21 +00:00
|
|
|
char buf[256], md5_cksum[64];
|
2003-02-14 23:19:51 +00:00
|
|
|
char *db_name=0, *db_passwd=0, *app_name=0, *platform_name=0;
|
|
|
|
char *project_short_name=0, *project_long_name=0;
|
2003-02-12 18:51:05 +00:00
|
|
|
char* user_friendly_name=0;
|
2002-07-29 00:39:45 +00:00
|
|
|
char* exec_dir=0, *exec_files[10], *signature_files[10];
|
2003-03-20 02:05:25 +00:00
|
|
|
char *email_addr=0, *user_name=0, *authenticator=0;
|
2002-09-27 06:12:50 +00:00
|
|
|
char *global_prefs_file=0, *download_dir, *download_url;
|
2002-10-03 18:33:46 +00:00
|
|
|
char* code_sign_keyfile=0;
|
2002-05-29 23:25:21 +00:00
|
|
|
char *message=0, *message_priority=0;
|
|
|
|
|
2002-08-25 07:54:33 +00:00
|
|
|
void add_project() {
|
|
|
|
int retval;
|
2003-06-04 17:21:26 +00:00
|
|
|
DB_PROJECT project;
|
2002-08-25 07:54:33 +00:00
|
|
|
|
2003-02-14 23:19:51 +00:00
|
|
|
if (!project_short_name || !project_long_name) {
|
|
|
|
fprintf( stderr, "Project name (long or short) not specified.\n" );
|
2002-11-19 19:37:01 +00:00
|
|
|
exit(1);
|
|
|
|
}
|
2003-06-04 17:21:26 +00:00
|
|
|
project.clear();
|
2003-02-14 23:19:51 +00:00
|
|
|
strcpy(project.short_name, project_short_name);
|
|
|
|
strcpy(project.long_name, project_long_name);
|
2003-06-04 17:21:26 +00:00
|
|
|
retval = project.insert();
|
2002-08-25 07:54:33 +00:00
|
|
|
if (retval) {
|
2003-06-04 17:21:26 +00:00
|
|
|
boinc_db_print_error("project.insert()");
|
2002-08-25 07:54:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-05-29 23:25:21 +00:00
|
|
|
void add_app() {
|
|
|
|
int retval;
|
2003-06-04 17:21:26 +00:00
|
|
|
DB_APP app;
|
2002-05-29 23:25:21 +00:00
|
|
|
|
2002-11-19 19:37:01 +00:00
|
|
|
if (!app_name) {
|
|
|
|
fprintf( stderr, "Application name not specified.\n" );
|
|
|
|
exit(1);
|
|
|
|
}
|
2003-06-04 17:21:26 +00:00
|
|
|
app.clear();
|
2002-05-29 23:25:21 +00:00
|
|
|
strcpy(app.name, app_name);
|
|
|
|
app.create_time = time(0);
|
2002-07-29 00:39:45 +00:00
|
|
|
app.min_version = version;
|
2003-06-04 17:21:26 +00:00
|
|
|
retval = app.insert();
|
2002-05-29 23:25:21 +00:00
|
|
|
if (retval) {
|
2003-06-04 17:21:26 +00:00
|
|
|
boinc_db_print_error("app.insert()");
|
2002-05-29 23:25:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void add_platform() {
|
|
|
|
int retval;
|
2003-06-04 17:21:26 +00:00
|
|
|
DB_PLATFORM platform;
|
2002-05-29 23:25:21 +00:00
|
|
|
|
2003-02-20 21:38:11 +00:00
|
|
|
if (!user_friendly_name) {
|
|
|
|
fprintf( stderr, "User friendly name not specified.\n" );
|
|
|
|
exit(1);
|
|
|
|
}
|
2002-11-19 19:37:01 +00:00
|
|
|
if (!platform_name) {
|
|
|
|
fprintf( stderr, "Platform name not specified.\n" );
|
|
|
|
exit(1);
|
|
|
|
}
|
2003-06-04 17:21:26 +00:00
|
|
|
platform.clear();
|
2002-05-29 23:25:21 +00:00
|
|
|
strcpy(platform.name, platform_name);
|
2003-02-12 18:51:05 +00:00
|
|
|
strcpy(platform.user_friendly_name, user_friendly_name);
|
2002-05-29 23:25:21 +00:00
|
|
|
platform.create_time = time(0);
|
2003-06-04 17:21:26 +00:00
|
|
|
retval = platform.insert();
|
2002-05-29 23:25:21 +00:00
|
|
|
if (retval) {
|
2003-06-04 17:21:26 +00:00
|
|
|
boinc_db_print_error("platform.insert()");
|
2002-05-29 23:25:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-29 00:39:45 +00:00
|
|
|
int sign_executable(char* path, char* signature_text) {
|
2002-07-07 20:39:24 +00:00
|
|
|
DATA_BLOCK signature;
|
2002-07-09 00:10:58 +00:00
|
|
|
unsigned char signature_buf[SIGNATURE_SIZE_BINARY];
|
2002-07-29 00:39:45 +00:00
|
|
|
R_RSA_PRIVATE_KEY code_sign_key;
|
2002-10-14 23:10:12 +00:00
|
|
|
retval = read_key_file(code_sign_keyfile, code_sign_key);
|
2002-07-29 00:39:45 +00:00
|
|
|
if (retval) {
|
2002-10-14 23:10:12 +00:00
|
|
|
fprintf(stderr, "add: can't read key\n");
|
2002-07-29 00:39:45 +00:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
signature.data = signature_buf;
|
|
|
|
sign_file(path, code_sign_key, signature);
|
|
|
|
sprint_hex_data(signature_text, signature);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2003-06-05 18:16:37 +00:00
|
|
|
// copy executable file to the download dir, generate XML
|
|
|
|
//
|
|
|
|
static int process_executable_file(
|
|
|
|
char* filename, char* signature_text, char* xml_doc
|
|
|
|
) {
|
|
|
|
char longbuf[MAX_BLOB_SIZE];
|
|
|
|
char path[256];
|
|
|
|
|
|
|
|
sprintf(path, "%s/%s", exec_dir, filename);
|
|
|
|
sprintf(
|
|
|
|
buf,
|
|
|
|
"cp %s %s/%s",
|
|
|
|
path, download_dir, filename
|
|
|
|
);
|
|
|
|
retval = system(buf);
|
|
|
|
if (retval) {
|
|
|
|
printf("failed: %s\n", buf);
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
retval = md5_file(path, md5_cksum, nbytes);
|
|
|
|
if (retval) return retval;
|
|
|
|
|
|
|
|
// generate the XML doc directly.
|
|
|
|
// TODO: use a template, as in create_work (??)
|
|
|
|
//
|
|
|
|
sprintf(longbuf,
|
|
|
|
"<file_info>\n"
|
|
|
|
" <name>%s</name>\n"
|
|
|
|
" <url>%s/%s</url>\n"
|
|
|
|
" <executable/>\n",
|
|
|
|
filename,
|
|
|
|
download_url, filename
|
|
|
|
);
|
|
|
|
strcat(xml_doc, longbuf);
|
|
|
|
if (signature_text) {
|
|
|
|
sprintf(longbuf,
|
|
|
|
" <file_signature>\n%s"
|
|
|
|
" </file_signature>\n",
|
|
|
|
signature_text
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
sprintf(longbuf,
|
|
|
|
" <md5_cksum>%s</md5_cksum>\n",
|
|
|
|
md5_cksum
|
|
|
|
);
|
|
|
|
}
|
|
|
|
strcat(xml_doc, longbuf);
|
|
|
|
sprintf(longbuf,
|
|
|
|
" <nbytes>%f</nbytes>\n"
|
|
|
|
"</file_info>\n",
|
|
|
|
nbytes
|
|
|
|
);
|
|
|
|
strcat(xml_doc, longbuf);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void add_core_version() {
|
|
|
|
DB_CORE_VERSION core_version;
|
|
|
|
DB_PLATFORM platform;
|
|
|
|
|
|
|
|
core_version.clear();
|
|
|
|
sprintf(buf, "where name='%s'", platform_name);
|
|
|
|
retval = platform.lookup(buf);
|
|
|
|
if (retval) {
|
|
|
|
fprintf(stderr, "add_core_version(): can't find platform %s\n", platform_name);
|
|
|
|
boinc_db_print_error("platform.lookup()");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
core_version.platformid = platform.id;
|
|
|
|
core_version.version_num = version;
|
|
|
|
if (message) strcpy(core_version.message, message);
|
|
|
|
if (message_priority) strcpy(core_version.message, message_priority);
|
|
|
|
if (nexec_files != 1) {
|
|
|
|
fprintf(stderr, "add_core_version(): multiple files not allowed\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
strcpy(core_version.xml_doc, "");
|
|
|
|
process_executable_file(exec_files[0], NULL, core_version.xml_doc);
|
|
|
|
core_version.create_time = time(0);
|
|
|
|
retval = core_version.insert();
|
|
|
|
if (retval) {
|
|
|
|
boinc_db_print_error("core_version.insert()");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-29 00:39:45 +00:00
|
|
|
void add_app_version() {
|
|
|
|
char path[256];
|
2003-06-05 18:16:37 +00:00
|
|
|
char longbuf[MAX_BLOB_SIZE];
|
|
|
|
char signature_text[1024];
|
2002-07-29 00:39:45 +00:00
|
|
|
int i;
|
2003-06-04 17:21:26 +00:00
|
|
|
DB_APP app;
|
|
|
|
DB_APP_VERSION app_version;
|
|
|
|
DB_PLATFORM platform;
|
2002-07-07 20:39:24 +00:00
|
|
|
|
2003-06-04 17:21:26 +00:00
|
|
|
app_version.clear();
|
2002-05-29 23:25:21 +00:00
|
|
|
|
2002-11-19 19:37:01 +00:00
|
|
|
if (!app_name) {
|
|
|
|
fprintf( stderr, "Application name not specified.\n" );
|
|
|
|
exit(1);
|
|
|
|
}
|
2003-06-04 17:21:26 +00:00
|
|
|
sprintf(buf, "where name='%s'", app_name);
|
|
|
|
retval = app.lookup(buf);
|
2002-05-29 23:25:21 +00:00
|
|
|
if (retval) {
|
2002-06-10 06:14:18 +00:00
|
|
|
fprintf(stderr, "add_app_version(): can't find app %s\n", app_name);
|
2003-06-04 17:21:26 +00:00
|
|
|
boinc_db_print_error("app.lookup()");
|
2002-05-29 23:25:21 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
app_version.appid = app.id;
|
2003-06-04 17:21:26 +00:00
|
|
|
sprintf(buf, "where name='%s'", platform_name);
|
|
|
|
retval = platform.lookup(buf);
|
2002-05-29 23:25:21 +00:00
|
|
|
if (retval) {
|
2002-06-10 06:14:18 +00:00
|
|
|
fprintf(stderr, "add_app_version(): can't find platform %s\n", platform_name);
|
2003-06-04 17:21:26 +00:00
|
|
|
boinc_db_print_error("platform.lookup()");
|
2002-05-29 23:25:21 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
app_version.platformid = platform.id;
|
|
|
|
app_version.version_num = version;
|
|
|
|
|
2002-07-29 00:39:45 +00:00
|
|
|
strcpy(app_version.xml_doc, "");
|
2002-05-29 23:25:21 +00:00
|
|
|
|
2002-07-29 00:39:45 +00:00
|
|
|
// copy executables to download directory and sign them
|
2002-05-29 23:25:21 +00:00
|
|
|
//
|
2002-07-29 00:39:45 +00:00
|
|
|
for (i=0; i<nexec_files; i++) {
|
|
|
|
if (signed_exec_files) {
|
|
|
|
read_filename(signature_files[i], signature_text);
|
|
|
|
} else {
|
|
|
|
sprintf(path, "%s/%s", exec_dir, exec_files[i]);
|
|
|
|
sign_executable(path, signature_text);
|
|
|
|
}
|
2003-06-05 18:16:37 +00:00
|
|
|
retval = process_executable_file(
|
|
|
|
exec_files[i], signature_text, app_version.xml_doc
|
2002-07-29 00:39:45 +00:00
|
|
|
);
|
2003-06-05 18:16:37 +00:00
|
|
|
if (retval) {
|
|
|
|
fprintf(stderr, "process_executable_file(): %d\n", retval);
|
|
|
|
exit(1);
|
|
|
|
}
|
2002-07-29 00:39:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sprintf(longbuf,
|
2002-05-29 23:25:21 +00:00
|
|
|
"<app_version>\n"
|
|
|
|
" <app_name>%s</app_name>\n"
|
2002-07-29 00:39:45 +00:00
|
|
|
" <version_num>%d</version_num>\n",
|
2002-05-29 23:25:21 +00:00
|
|
|
app_name,
|
2002-07-29 00:39:45 +00:00
|
|
|
version
|
2002-05-29 23:25:21 +00:00
|
|
|
);
|
2002-07-29 00:39:45 +00:00
|
|
|
strcat(app_version.xml_doc, longbuf);
|
|
|
|
for (i=0; i<nexec_files; i++) {
|
|
|
|
sprintf(longbuf,
|
|
|
|
" <file_ref>\n"
|
|
|
|
" <file_name>%s</file_name>\n"
|
|
|
|
"%s"
|
|
|
|
" </file_ref>\n",
|
|
|
|
exec_files[i],
|
|
|
|
i?"":" <main_program/>\n"
|
|
|
|
);
|
|
|
|
strcat(app_version.xml_doc, longbuf);
|
|
|
|
}
|
|
|
|
strcat(app_version.xml_doc, "</app_version>\n");
|
2002-05-29 23:25:21 +00:00
|
|
|
|
|
|
|
app_version.create_time = time(0);
|
2003-06-04 17:21:26 +00:00
|
|
|
retval = app_version.insert();
|
2002-05-29 23:25:21 +00:00
|
|
|
if (retval) {
|
2003-06-04 17:21:26 +00:00
|
|
|
boinc_db_print_error("app_version.insert()");
|
2002-05-29 23:25:21 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void add_user() {
|
2003-06-04 17:21:26 +00:00
|
|
|
DB_USER user;
|
|
|
|
|
|
|
|
user.clear();
|
2002-05-29 23:25:21 +00:00
|
|
|
user.create_time = time(0);
|
|
|
|
strcpy(user.email_addr, email_addr);
|
|
|
|
strcpy(user.name, user_name);
|
|
|
|
strcpy(user.authenticator, authenticator);
|
|
|
|
strcpy(user.country, "United States");
|
|
|
|
strcpy(user.postal_code, "94703");
|
2002-09-27 06:12:50 +00:00
|
|
|
if (global_prefs_file) {
|
|
|
|
retval = read_filename(global_prefs_file, user.global_prefs);
|
2002-05-29 23:25:21 +00:00
|
|
|
if (retval) {
|
2002-09-27 06:12:50 +00:00
|
|
|
printf("read_file: %s", global_prefs_file);
|
2002-05-29 23:25:21 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2003-06-04 17:21:26 +00:00
|
|
|
retval = user.insert();
|
2002-05-29 23:25:21 +00:00
|
|
|
if (retval) {
|
2003-06-04 17:21:26 +00:00
|
|
|
boinc_db_print_error("user.insert()");
|
2002-05-29 23:25:21 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-04-30 22:22:54 +00:00
|
|
|
int main(int argc, char** argv) {
|
2002-08-14 05:26:51 +00:00
|
|
|
int i, retval;
|
2002-04-30 22:22:54 +00:00
|
|
|
|
|
|
|
for (i=2; i<argc; i++) {
|
2002-10-03 18:33:46 +00:00
|
|
|
if (!strcmp(argv[i], "-db_name")) {
|
|
|
|
db_name = argv[++i];
|
|
|
|
} else if (!strcmp(argv[i], "-db_passwd")) {
|
|
|
|
db_passwd = argv[++i];
|
2003-02-14 23:19:51 +00:00
|
|
|
} else if (!strcmp(argv[i], "-project_long_name")) {
|
2003-03-20 02:05:25 +00:00
|
|
|
project_long_name = argv[++i];
|
2003-02-14 23:19:51 +00:00
|
|
|
} else if (!strcmp(argv[i], "-project_short_name")) {
|
2003-03-20 02:05:25 +00:00
|
|
|
project_short_name = argv[++i];
|
2002-08-25 07:54:33 +00:00
|
|
|
} else if (!strcmp(argv[i], "-app_name")) {
|
2003-03-20 02:05:25 +00:00
|
|
|
app_name = argv[++i];
|
2002-04-30 22:22:54 +00:00
|
|
|
} else if (!strcmp(argv[i], "-platform_name")) {
|
2003-02-12 18:51:05 +00:00
|
|
|
platform_name = argv[++i];
|
|
|
|
} else if (!strcmp(argv[i], "-user_friendly_name")) {
|
|
|
|
user_friendly_name = argv[++i];
|
2002-04-30 22:22:54 +00:00
|
|
|
} else if (!strcmp(argv[i], "-exec_dir")) {
|
2003-03-20 02:05:25 +00:00
|
|
|
exec_dir = argv[++i];
|
2002-07-29 00:39:45 +00:00
|
|
|
} else if (!strcmp(argv[i], "-exec_files")) {
|
|
|
|
signed_exec_files = false;
|
|
|
|
i++;
|
|
|
|
nexec_files = 0;
|
|
|
|
while (i < argc) {
|
|
|
|
exec_files[nexec_files++] = argv[i++];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
} else if (!strcmp(argv[i], "-signed_exec_files")) {
|
|
|
|
signed_exec_files = true;
|
2002-04-30 22:22:54 +00:00
|
|
|
i++;
|
2002-07-29 00:39:45 +00:00
|
|
|
nexec_files = 0;
|
|
|
|
while (i < argc) {
|
|
|
|
exec_files[nexec_files] = argv[i++];
|
|
|
|
signature_files[nexec_files] = argv[i++];
|
|
|
|
nexec_files++;
|
|
|
|
}
|
|
|
|
break;
|
2002-04-30 22:22:54 +00:00
|
|
|
} else if (!strcmp(argv[i], "-exec_dir")) {
|
2003-03-20 02:05:25 +00:00
|
|
|
exec_dir = argv[++i];
|
2002-04-30 22:22:54 +00:00
|
|
|
} else if (!strcmp(argv[i], "-email_addr")) {
|
2003-03-20 02:05:25 +00:00
|
|
|
email_addr = argv[++i];
|
2002-04-30 22:22:54 +00:00
|
|
|
} else if (!strcmp(argv[i], "-user_name")) {
|
2003-03-20 02:05:25 +00:00
|
|
|
user_name = argv[++i];
|
2002-04-30 22:22:54 +00:00
|
|
|
} else if (!strcmp(argv[i], "-authenticator")) {
|
2003-03-20 02:05:25 +00:00
|
|
|
authenticator = argv[++i];
|
2002-09-27 06:12:50 +00:00
|
|
|
} else if (!strcmp(argv[i], "-global_prefs_file")) {
|
2003-03-20 02:05:25 +00:00
|
|
|
global_prefs_file = argv[++i];
|
2002-08-14 20:31:27 +00:00
|
|
|
} else if (!strcmp(argv[i], "-download_url")) {
|
2003-03-20 02:05:25 +00:00
|
|
|
download_url = argv[++i];
|
2002-04-30 22:22:54 +00:00
|
|
|
} else if (!strcmp(argv[i], "-download_dir")) {
|
2003-03-20 02:05:25 +00:00
|
|
|
download_dir = argv[++i];
|
2002-04-30 22:22:54 +00:00
|
|
|
} else if (!strcmp(argv[i], "-version")) {
|
2003-03-20 02:05:25 +00:00
|
|
|
version = atoi(argv[++i]);
|
2002-05-17 22:33:57 +00:00
|
|
|
} else if (!strcmp(argv[i], "-message")) {
|
2003-03-20 02:05:25 +00:00
|
|
|
message = argv[++i];
|
2002-05-17 22:33:57 +00:00
|
|
|
} else if (!strcmp(argv[i], "-message_priority")) {
|
2003-03-20 02:05:25 +00:00
|
|
|
message_priority = argv[++i];
|
2002-07-07 20:39:24 +00:00
|
|
|
} else if (!strcmp(argv[i], "-code_sign_keyfile")) {
|
2003-03-20 02:05:25 +00:00
|
|
|
code_sign_keyfile = argv[++i];
|
2002-04-30 22:22:54 +00:00
|
|
|
}
|
|
|
|
}
|
2003-01-09 07:24:27 +00:00
|
|
|
retval = boinc_db_open(db_name, db_passwd);
|
2002-10-03 18:33:46 +00:00
|
|
|
if (retval) {
|
|
|
|
fprintf(stderr, "can't open DB %s\n", db_name);
|
|
|
|
exit(1);
|
|
|
|
}
|
2002-08-25 07:54:33 +00:00
|
|
|
if (!strcmp(argv[1], "project")) {
|
|
|
|
add_project();
|
|
|
|
} else if (!strcmp(argv[1], "app")) {
|
2002-05-29 23:25:21 +00:00
|
|
|
add_app();
|
2002-04-30 22:22:54 +00:00
|
|
|
} else if (!strcmp(argv[1], "platform")) {
|
2002-05-29 23:25:21 +00:00
|
|
|
add_platform();
|
2003-06-05 18:16:37 +00:00
|
|
|
} else if (!strcmp(argv[1], "core_version")) {
|
|
|
|
add_core_version();
|
2002-04-30 22:22:54 +00:00
|
|
|
} else if (!strcmp(argv[1], "app_version")) {
|
2002-05-29 23:25:21 +00:00
|
|
|
add_app_version();
|
2002-04-30 22:22:54 +00:00
|
|
|
} else if (!strcmp(argv[1], "user")) {
|
2002-05-29 23:25:21 +00:00
|
|
|
add_user();
|
2002-04-30 22:22:54 +00:00
|
|
|
} else {
|
|
|
|
printf("Unrecognized command\n");
|
|
|
|
}
|
2003-01-09 07:24:27 +00:00
|
|
|
boinc_db_close();
|
2002-04-30 22:22:54 +00:00
|
|
|
exit(0);
|
|
|
|
}
|