]> cygwin.com Git - cygwin-apps/setup.git/commitdiff
Implement option "-i/--ini-basename" to set the basename for setup
authorAchim Gratz <Stromeko@Stromeko.DE>
Sun, 28 Jun 2015 11:34:11 +0000 (13:34 +0200)
committerAchim Gratz <Stromeko@Stromeko.DE>
Sat, 11 Jul 2015 21:22:16 +0000 (23:22 +0200)
* ini.h: Declare extern SetupBaseName, SetupArch and SetupIniDir.
Redefine macros to use them.

* main.cc: Provide option "-i/--ini-basename" to set the basename
for setup, keep the default as "setup" and store in SetupBaseName.
Initialize SetupArch and SetupIniDir based on effective
architecture.

ChangeLog
ini.h
main.cc

index 1c50bfc2e2522524c219facccc1dc219f6bea0ac..cb49b7e9f98d44ef1daab9501df280cd7d2a0506 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2015-07-01  Achim Gratz  <Stromeko@NexGo.DE>
+
+       * ini.h: Declare extern SetupBaseName, SetupArch and SetupIniDir.
+       Redefine macros to use them.
+
+       * main.cc: Provide option "-i/--ini-basename" to set the basename
+       for setup, keep the default as "setup" and store in SetupBaseName.
+       Initialize SetupArch and SetupIniDir based on effective
+       architecture.
+
 2015-06-11  Achim Gratz  <Stromeko@NexGo.DE>
 
        * inilex.ll: Increase read buffer size for the lexer input buffer
diff --git a/ini.h b/ini.h
index ec09def359a4027a2e5ba85d227c0198a5d0c719..1969da9c10124a55220a30cecb60b433842c676b 100644 (file)
--- a/ini.h
+++ b/ini.h
 
 class io_stream;
 #include <string>
+#include <vector>
+
+typedef std::vector <std::string> IniList;
+extern IniList found_ini_list, setup_ext_list;
+const std::string setup_exts[] = { "xz", "bz2", "ini" };
+extern bool is_64bit;
+extern std::string SetupArch;
+extern std::string SetupIniDir;
+extern std::string SetupBaseName;
+
 class IniState;
 class IniDBBuilder;
 class IniParseFeedback;
@@ -38,10 +48,9 @@ typedef enum
   EXCLUDE_NOT_FOUND
 } excludes;
 
-extern bool is_64bit;
-#define SETUP_INI_DIR     (is_64bit ? "x86_64/" : "x86/")
-#define SETUP_INI_FILENAME "setup.ini"
-#define SETUP_BZ2_FILENAME "setup.bz2"
+#define SETUP_INI_DIR     (SetupIniDir.c_str ())
+#define SETUP_INI_FILENAME ((SetupBaseName+".ini").c_str ())
+#define SETUP_BZ2_FILENAME ((SetupBaseName+".bz2").c_str ())
 
 /* The following three vars are used to facilitate error handling between the
    parser/lexer and its callers, namely ini.cc:do_remote_ini() and
diff --git a/main.cc b/main.cc
index e968d9320e34711e50daf6eddcf76972b948773c..b0d78eb4b68d5d6b07b7ebaf31ec4e3762811125 100644 (file)
--- a/main.cc
+++ b/main.cc
@@ -86,6 +86,8 @@ extern char **_argv;
 #endif
 
 bool is_64bit;
+std::string SetupArch;
+std::string SetupIniDir;
 
 using namespace std;
 
@@ -97,6 +99,8 @@ static BoolOption PackageManagerOption (false, 'M', "package-manager", "Semi-att
 static BoolOption NoAdminOption (false, 'B', "no-admin", "Do not check for and enforce running as Administrator");
 static BoolOption WaitOption (false, 'W', "wait", "When elevating, wait for elevated child process");
 static BoolOption HelpOption (false, 'h', "help", "print help");
+static StringOption SetupBaseNameOpt ("setup", 'i', "ini-basename", "Use a different basename, e.g. \"foo\", instead of \"setup\"", false);
+std::string SetupBaseName;
 
 static void inline
 set_cout ()
@@ -262,6 +266,10 @@ WinMain (HINSTANCE h,
     if (unattended_mode || help_option)
       set_cout ();
 
+    SetupBaseName = SetupBaseNameOpt;
+    SetupArch = is_64bit ? "x86_64" : "x86";
+    SetupIniDir = SetupArch+"/";
+
     /* Get System info */
     OSVERSIONINFO version;
     version.dwOSVersionInfoSize = sizeof version;
This page took 0.048273 seconds and 5 git commands to generate.