[Fedora-directory-commits] setuputil/installer/unix installer.cc, 1.5, 1.6 product.cc, 1.5, 1.6

Noriko Hosoi (nhosoi) fedora-directory-commits at redhat.com
Wed Apr 4 22:29:48 UTC 2007


Author: nhosoi

Update of /cvs/dirsec/setuputil/installer/unix
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv16139

Modified Files:
	installer.cc product.cc 
Log Message:
Resolves: #234893
Summary: Build SetupUtil with autotools (Comment #13, #15)
Changes: 1) resource file and inf file could be an absolute path,
or they could be located in the same dir as dssetup binary or
in $datadir/setuputil.
2) dssetup does not issue "Notice: Your LD_LIBRARY_PATH variable is set to .."
since the library path is set in the wrapper script by the autotools.



Index: installer.cc
===================================================================
RCS file: /cvs/dirsec/setuputil/installer/unix/installer.cc,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- installer.cc	27 Mar 2006 21:18:35 -0000	1.5
+++ installer.cc	4 Apr 2007 22:29:46 -0000	1.6
@@ -27,6 +27,15 @@
 **
 ** HISTORY:
 ** $Log$
+** Revision 1.6  2007/04/04 22:29:46  nhosoi
+** Resolves: #234893
+** Summary: Build SetupUtil with autotools (Comment #13, #15)
+** Changes: 1) resource file and inf file could be an absolute path,
+** or they could be located in the same dir as dssetup binary or
+** in $datadir/setuputil.
+** 2) dssetup does not issue "Notice: Your LD_LIBRARY_PATH variable is set to .."
+** since the library path is set in the wrapper script by the autotools.
+**
 ** Revision 1.5  2006/03/27 21:18:35  nhosoi
 ** [186642] Directory Server Makefile updates for Internal build
 ** Changed the createSIE so that caller (Admin Server and Directory Server) passes
@@ -792,9 +801,42 @@
 
    if (filename)
    {
-      NSString resourceFile;
-      resourceFile = _baseDir + "/" + filename;
-      customResource.read(resourceFile);
+      /*
+       * resource file can be specified in the [General] section of setup.inf
+       * # All dialog strings can be defined in a resource file (optional).
+       * Resource = setup.res
+       *     The value can be an absolute path.
+       *     If the value is a relative path or just a file name,
+       *     first the code checks if the value starting from the
+       *     setup binary location exists.
+       *     If it does not exist, then it checks in PROPERTYDIR,
+       *     which is defined at the build time.
+       *     If the resource value is set and the file does not exist,
+       *     it issues an warning and steps forward.
+       */
+      NSString resourceFile = NULL;
+      if ('/' == *filename) /* absolute path */
+      {
+         resourceFile = filename;
+      }
+      else
+      {
+         resourceFile = _baseDir + "/" + filename;
+         if (InstUtil::fileExists(resourceFile) == False)
+         {
+            /* the file is not in _baseDir (where dssetup is located) */
+            resourceFile = NSString(PROPERTYDIR) + "/" + filename;
+         }
+      }
+      if (InstUtil::fileExists(resourceFile) == False)
+      {
+         setupLogMessage(WARN, "Setup",
+                         "Resource file %s does not exist.\n", resourceFile);
+      }
+      else
+      {
+         customResource.read(resourceFile);
+      }
    }
 
    // Even without resource file defined, we still want to
@@ -929,8 +971,6 @@
    /*
     * Start the first stage - common installer's questions
     */
-   
-   printNotice();
    prepreInstall();
 
    if (_installMode == Silent)
@@ -1430,20 +1470,44 @@
 {
   NSString infFile;
 
-  infFile = sourceDir + "/";
-  infFile = infFile + infName;
+  /*
+   * sourceDir: start point to look for inf file (infName)
+   * infName: 
+   *     The value can be an absolute path.
+   *     If the value is a relative path or just a file name,
+   *     first the code checks if the value starting from sourceDir.
+   *     If it does not exist, then it checks in PROPERTYDIR,
+   *     which is defined at the build time.
+   */
+  if ('/' == *infName) /* absolute path */
+  {
+    infFile = infName;
+  }
+  else
+  {
+    infFile = sourceDir + "/";
+    infFile = infFile + infName;
 
+    if (InstUtil::fileExists(infFile) == False)
+    {
+      /* the file is not in sourceDir, try PROPERTYDIR */
+      infFile = NSString(PROPERTYDIR) + "/" + infName;
+    }
+  }
+  /*
+   * If the resource value is set and the file does not exist, it returns -1.
+   */
   if (InstUtil::fileExists(infFile) == False)
   {
-     return -1;
+    return -1; /* infFile does not exist */
   }
-
+ 
   if (sourceDir == _sourceDir && _newSuiteSpot.numComponents())
   {
      return 0;
   }
 
-  if (_newSuiteSpot.retrieveSuiteSpot(sourceDir, infName) == 0 && _newSuiteSpot.numComponents())
+  if (_newSuiteSpot.retrieveSuiteSpot(sourceDir, infFile) == 0 && _newSuiteSpot.numComponents())
   {
      _newSuiteSpot.getComponents()->sortComponents();
      _newSuiteSpot.select();
@@ -3289,50 +3353,3 @@
 {
   return _checkDomainName;
 }
-
-
-
-void
-Installer::printNotice()
-{
-   /* Bug 408242: Check if the LD_LIBRARY_PATH/SHLIB_PATH is set.
-    * If so, display a warning. Also, unset ENV variable.
-    */
-
-    char *lib_name = NULL, *lib_path = NULL, tmp[XSM_BUF], *env_path = NULL;
-
-#if defined (HPUX)
-    lib_name = strdup("SHLIB_PATH");
-#else
-    lib_name = strdup("LD_LIBRARY_PATH");
-#endif
-
-    memset(tmp, '\0', XSM_BUF);
-    if (lib_path = getenv(lib_name))
-    {
-        DialogManager::disableWinMode();
-        printf("\n%s %s %s\n\n", "Notice: Your", lib_name, "variable is set to:");
-        printf("\t%s\n\n", lib_path);
-        printf("%s %s %s\n", "Please unset", lib_name, "or verify that the");
-        printf("%s\n", "above setting is correct before continuing with");
-        printf("%s\n", "the installation. An incorrect setting may cause");
-        printf("%s\n", "problems during the installation such as the wrong");
-        printf("%s\n\n", "copy of a shared library being used.");
-        if (_installMode != Silent) 
-        {
-            printf("%s", "Continue [n]? ");
-            fflush(stdout);
-            fgets(tmp, sizeof(tmp), stdin);
-            if (tmp[0] == 'n' || tmp[0] == 'N' || tmp[0] == '\0' || (tmp[0] < 0x20))
-            {
-                free(lib_name);
-                exit(0);
-            }
-        }
-    }
-
-    free(lib_name);
-
-    env_path = strdup("ENV=");
-    putenv(env_path);
-}


Index: product.cc
===================================================================
RCS file: /cvs/dirsec/setuputil/installer/unix/product.cc,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- product.cc	23 Mar 2006 15:59:17 -0000	1.5
+++ product.cc	4 Apr 2007 22:29:46 -0000	1.6
@@ -27,6 +27,15 @@
 **
 ** HISTORY:
 ** $Log$
+** Revision 1.6  2007/04/04 22:29:46  nhosoi
+** Resolves: #234893
+** Summary: Build SetupUtil with autotools (Comment #13, #15)
+** Changes: 1) resource file and inf file could be an absolute path,
+** or they could be located in the same dir as dssetup binary or
+** in $datadir/setuputil.
+** 2) dssetup does not issue "Notice: Your LD_LIBRARY_PATH variable is set to .."
+** since the library path is set in the wrapper script by the autotools.
+**
 ** Revision 1.5  2006/03/23 15:59:17  rmeggins
 ** Bug(s) fixed: 186280
 ** Bug Description: Close potential security vulnerabilities in CGI code
@@ -628,7 +637,29 @@
    // This is top level master configuration file
    init();
 
-   snprintf(tstr, sizeof(tstr), "%s/%s", sourceDir.data(), fileName);
+  /*
+   * sourceDir: start point to look for inf file (infName)
+   * infName: 
+   *     The value can be an absolute path.
+   *     If the value is a relative path or just a file name,
+   *     first the code checks if the value starting from sourceDir.
+   *     If it does not exist, then it checks in PROPERTYDIR,
+   *     which is defined at the build time.
+   */
+   if ('/' == *fileName) /* absolute path */
+   {
+      snprintf(tstr, sizeof(tstr), "%s", fileName);
+   }
+   else
+   {
+      NSString setupFile = sourceDir + "/" + fileName;
+      if (InstUtil::fileExists(setupFile) == False)
+      {
+         /* the file is not in sourceDir, try PROPERTYDIR */
+         setupFile = NSString(PROPERTYDIR) + "/" + fileName;
+      }
+      snprintf(tstr, sizeof(tstr), "%s", setupFile.data(), fileName);
+   }
    tstr[sizeof(tstr)-1] = 0;
    _packageInfo = new PackageInfo(tstr);
 
@@ -693,7 +724,29 @@
 
    init();
 
-   snprintf(tstr, sizeof(tstr), "%s/%s", sourceDir.data(), fileName);
+  /*
+   * sourceDir: start point to look for inf file (fileName)
+   * fileame: 
+   *     The value can be an absolute path.
+   *     If the value is a relative path or just a file name,
+   *     first the code checks if the value starting from sourceDir.
+   *     If it does not exist, then it checks in PROPERTYDIR,
+   *     which is defined at the build time.
+   */
+   if ('/' == *fileName) /* absolute path */
+   {
+      snprintf(tstr, sizeof(tstr), "%s", fileName);
+   }
+   else
+   {
+      NSString subFile = sourceDir + "/" + fileName;
+      if (InstUtil::fileExists(subFile) == False)
+      {
+         /* the file is not in sourceDir, try PROPERTYDIR */
+         subFile = NSString(PROPERTYDIR) + "/" + fileName;
+      }
+      snprintf(tstr, sizeof(tstr), "%s", subFile.data(), fileName);
+   }
    tstr[sizeof(tstr)-1] = 0;
    
    _packageInfo = new PackageInfo(tstr);




More information about the Fedora-directory-commits mailing list