Changeset - 8e6d4ae5152b
[Not reviewed]
default
0 2 0
ethanzonca - 16 years ago 2009-10-10 17:41:21

Converted updater to use datadir rather than SYSCONFDIR
2 files changed with 17 insertions and 8 deletions:
0 comments (0 inline, 0 general)
src/server/slave.c
Show inline comments
 
@@ -59,7 +59,7 @@ if(argc>1 && (strcmp("-c", argv[1]) == 0
 

	
 
    if(!strchr(email, '@'))
 
      {
 
        fprintf(stderr, "I want to see an '@' in your email address!\n%s may be good enough for you, but I need more!\n", email);
 
        fprintf(stderr, "I want to see an '@' in your email address!\n\"%s\" may be good enough for you, but I need more!\n", email);
 
        return 235;
 
      }
 
    if( register_user(username, email) == 1)
 
@@ -92,7 +92,7 @@ username = NULL;
 
options_init(argc,argv,&my_cfg, myopts, "slave", &commonopts);
 
/* End option getter */
 

	
 
software_updatecheck(); // Should be run every day-ish, if the slave is constantly running.
 
software_updatecheck(datadir); // Should be run every day-ish, if the slave is constantly running.
 

	
 
/* Notifies the user if there is no username in the conf file */
 
if(username == NULL || strcmp(username, "!username") == 0 ){
src/server/slavefuncs.c
Show inline comments
 
@@ -65,8 +65,17 @@ xmlNodePtr xml_quickxpath(xmlXPathContex
 
}
 

	
 
/** Ensures that rendering engines on the computer are up-to-date */
 
int software_updatecheck(){
 
  curlget("http://protofusion.org/srv/version.info", SYSCONFDIR "/serverEngineVersion.info");
 
int software_updatecheck(char *datadir){
 
  char *pathtoserverVersion;
 
  _distren_asprintf(&pathtoserverVersion, "%s/serverEngineVersion.info",datadir);
 

	
 
  char *engineDownloadPath;
 
  _distren_asprintf(&engineDownloadPath, "%s/engines/blender.tgz",datadir);
 

	
 
  char *pathtolocalVersion;
 
  _distren_asprintf(&pathtolocalVersion, "%s/envines/blender/version.info",datadir);
 

	
 
  curlget("http://protofusion.org/srv/version.info",  pathtoserverVersion);
 
  struct stat buffer;
 
  char serverVersion[5]; // Version numbers are nice and short
 
  char localVersion[5]; // Version numbers are nice and short
 
@@ -75,7 +84,7 @@ int software_updatecheck(){
 
  // Read server version
 
  {
 
    FILE * serverVersionFile;
 
    serverVersionFile = fopen(SYSCONFDIR "/serverEngineVersion.info","r");
 
    serverVersionFile = fopen(pathtoserverVersion, "r");
 
    fscanf(serverVersionFile, "%s",serverVersion);
 
    fclose(serverVersionFile);
 
  }
 
@@ -83,7 +92,7 @@ int software_updatecheck(){
 
  // Read local version
 
  {
 
    FILE * localVersionFile;
 
    localVersionFile = fopen(SYSCONFDIR "/engines/blender/version.info","r");
 
    localVersionFile = fopen(pathtolocalVersion, "r");
 
    fscanf(localVersionFile, "%s",localVersion);
 
    fclose(localVersionFile);
 
  }
 
@@ -92,14 +101,14 @@ int software_updatecheck(){
 
  // If a rendering engine was never downloaded
 
  if( stat(SYSCONFDIR "/engines/blender", &buffer) == -1){
 
    fprintf(stderr,"You don't have the blender engine. Preparing to download...");
 
    curlget("http://protofusion.org/distren/srv/blender-lin32-dist.tgz", SYSCONFDIR "/engines/blender.tgz"); // Add calls for operating system info
 
    curlget("http://protofusion.org/distren/srv/blender-lin32-dist.tgz", engineDownloadPath); // Add calls for operating system info
 
    // untar(SYSCONFDIR "/engines/blender.tgz");
 
  }
 

	
 
  // If a rendering engine is out-of-date
 
  else if( serverVersion != localVersion){
 
    fprintf(stderr,"You don't have the latest blender engine. Preparing to download...");
 
    curlget("http://protofusion.org/distren/srv/blender-lin32-dist.tgz", SYSCONFDIR "/engines/blender.tgz"); // Add calls for operating system info
 
    curlget("http://protofusion.org/distren/srv/blender-lin32-dist.tgz", engineDownloadPath); // Add calls for operating system info
 
    // untar(SYSCONFDIR "/engines/blender.tgz");
 
  }
 

	
0 comments (0 inline, 0 general)