[Gpg4win-commits] r475 - in trunk: . doc src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Aug 14 19:15:28 CEST 2007


Author: marcus
Date: 2007-08-14 19:15:27 +0200 (Tue, 14 Aug 2007)
New Revision: 475

Modified:
   trunk/ChangeLog
   trunk/doc/README.de.txt
   trunk/doc/README.en.txt
   trunk/src/g4wihelp.c
   trunk/src/inst-sections.nsi
   trunk/src/installer-finish.nsi
   trunk/src/installer.nsi
Log:
2007-08-14  Marcus Brinkmann  <marcus at g10code.de>

	* README.de.txt, README.en.txt: Document new features.
src/
2007-08-14  Marcus Brinkmann  <marcus at g10code.de>

	* src/g4wihelp.c (config_lookup, config_fetch_bool): New functions.
	* src/inst-sections.nsi (CalcDefaults): New function.
	(.onInit): Call CalcDefaults.
	* src/inst-sections.nsi (CalcDepends): New function.  Run it once.
	Support auto-config for link selection.
	* src/installer-finish.nsi: Support auto-config for start menu folder.


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-08-14 15:42:34 UTC (rev 474)
+++ trunk/ChangeLog	2007-08-14 17:15:27 UTC (rev 475)
@@ -1,5 +1,12 @@
 2007-08-14  Marcus Brinkmann  <marcus at g10code.de>
 
+	* src/g4wihelp.c (config_lookup, config_fetch_bool): New functions.
+	* src/inst-sections.nsi (CalcDefaults): New function.
+	(.onInit): Call CalcDefaults.
+	* src/inst-sections.nsi (CalcDepends): New function.  Run it once.
+	Support auto-config for link selection.
+	* src/installer-finish.nsi: Support auto-config for start menu folder.
+
 	* src/g4wihelp.c (service_create): Auto start service, install as
 	local service.
 	(service_start): Set argv to NULL if argc is zero.

Modified: trunk/doc/README.de.txt
===================================================================
--- trunk/doc/README.de.txt	2007-08-14 15:42:34 UTC (rev 474)
+++ trunk/doc/README.de.txt	2007-08-14 17:15:27 UTC (rev 475)
@@ -64,11 +64,35 @@
 Installer unterstützt die Option /S für automatischen Ablauf der
 Installation, und die Option /C=INIFILE, durch welche eine .ini Datei
 angegeben werden kann, die genau einen Abschnitt "[gpg4win]" enthalten
-sollte, in der absolute Pfade zu Konfigurationsdateien enthalten sein
-sollten, die mit installiert werden.  Hier ist eine Beispieldatei, die
-zugleich alle erlaubten Schlüssel zeigt:
+sollte.  In dieser Datei können diverse Einstellungen vorgenommen
+werden, inklusive absolute Pfade zu Konfigurationsdateien, die mit
+installiert werden.  Die meisten Einstellungen verändern nur die
+Standardeinstellungen.  Ausnahmen sind unten dokumentiert.  Hier ist
+eine Beispieldatei, die zugleich alle erlaubten Schlüssel zeigt:
 
 [gpg4win]
+  ; Installer Einstellungen.  Weg- oder leer-lassen fuer Standard.
+  inst_gnupg2 = false
+  inst_gpgol = true
+  inst_gpa = true
+  inst_winpt = true
+  inst_gpgee = true
+  inst_claws_mail = false
+  inst_man_novice_de = true
+  inst_man_novice_en = true
+  inst_man_advanced_de = true
+  inst_man_advanced_en = true
+
+  ; Die Stellen, an denen Verknüpfungen erzeugt werden sollen.
+  inst_start_menu = true
+  inst_desktop = false
+  inst_quick_launch_bar = false
+
+  ; Im Gegensatz zu den anderen Optionen überschreibt diese Option die
+  ; Einstellung des Benutzers im Installer.
+  inst_start_menu_folder = GnuPG for Windows
+
+  ; Standard-Konfigurationsdateien.
   gpg.conf = D:\config\gpg-site.conf
   gpg-agent.conf = D:\config\gpg-agent-site.conf
   trustlist.txt = D:\config\trustlist-site.txt

Modified: trunk/doc/README.en.txt
===================================================================
--- trunk/doc/README.en.txt	2007-08-14 15:42:34 UTC (rev 474)
+++ trunk/doc/README.en.txt	2007-08-14 17:15:27 UTC (rev 475)
@@ -57,11 +57,35 @@
 option, which must be last on the command line.  The installer
 supports the options /S for unattended installation, and the option
 /C=INIFILE to specify an .ini file which should contain exactly one
-section "[gpg4win]" which may specify absolute file paths to
-configuration files that should be preinstalled.  Here is an example
-file which shows all possible keys:
+section "[gpg4win]".  This section contains various installer settings
+and absolute file paths to configuration files that should be
+preinstalled.  Most options just set a different default value.
+Excetions are documented below.  Here is an example file which shows
+all possible keys:
 
 [gpg4win]
+  ; Installer settings.  Do not define or leave empty for defaults.
+  inst_gnupg2 = false
+  inst_gpgol = true
+  inst_gpa = true
+  inst_winpt = true
+  inst_gpgee = true
+  inst_claws_mail = false
+  inst_novice_manual_en = true
+  inst_novice_manual_de = true
+  inst_advanced_manual_de = true
+
+  ; Where to install short-cuts.
+  inst_start_menu = true
+  inst_desktop = false
+  inst_quick_launch_bar = false
+
+  ; Contrary to other settings in this file, the start menu folder
+  ; setting here will override the user selection at installation
+  ; time.
+  inst_start_menu_folder = GnuPG for Windows
+
+  ; Additional configuration files to install.
   gpg.conf = D:\config\gpg-site.conf
   gpg-agent.conf = D:\config\gpg-agent-site.conf
   trustlist.txt = D:\config\trustlist-site.txt
@@ -70,6 +94,7 @@
   scdaemon.conf = D:\config\scdaemon-site.txt
   gpa.conf = D:\config\gpa-site.conf
 
+  
 
 
 

Modified: trunk/src/g4wihelp.c
===================================================================
--- trunk/src/g4wihelp.c	2007-08-14 15:42:34 UTC (rev 474)
+++ trunk/src/g4wihelp.c	2007-08-14 17:15:27 UTC (rev 475)
@@ -631,9 +631,7 @@
    the beginning or end.  KEY can, for example, be "gpg.conf" (without
    the quotes).  */
 void
-config_init (HWND hwndParent, int string_size, char *variables, 
-	     stack_t **stacktop, extra_parameters_t *extra,
-	     char **keys, char **values, int max)
+config_init (char **keys, char **values, int max)
 {
   /* First, parse the command line.  */
   char *cmdline;
@@ -793,19 +791,52 @@
 }
 
 
+char *
+config_lookup (char *key)
+{
+#define MAX_KEYS 128
+  static int initialised = 0;
+  static char *keys[MAX_KEYS];
+  static char *values[MAX_KEYS];
+  int i;
+
+  if (initialised == 0)
+    {
+      initialised = 1;
+      config_init (keys, values, MAX_KEYS);
+
+#if 0
+      MessageBox(g_hwndParent, "Configuration File:", 0, MB_OK);
+      i = 0;
+      while (keys[i])
+	{
+	  char buf[256];
+	  sprintf (buf, "%s=%s\r\n", keys[i], values[i]);
+	  MessageBox (g_hwndParent, buf, 0, MB_OK);
+	  i++;
+	}
+#endif
+    }
+
+  i = 0;
+  while (keys[i])
+    {
+      if (!strcmp (keys[i], key))
+	return values[i];
+      i++;
+    }
+  
+  return NULL;
+}
+
+
 void __declspec(dllexport) 
 config_fetch (HWND hwndParent, int string_size, char *variables, 
 	      stack_t **stacktop, extra_parameters_t *extra)
 {
-  SC_HANDLE service;
-  const char *result = NULL;
   char key[256];
-#define MAX_KEYS 64
   int err = 0;
-  static int initialised = 0;
-  static char *keys[MAX_KEYS];
-  static char *values[MAX_KEYS];
-  int i;
+  char *value;
 
   g_hwndParent = hwndParent;
   EXDLL_INIT();
@@ -819,36 +850,47 @@
       return;
     }
 
-  if (initialised == 0)
-    {
-      initialised = 1;
-      config_init (hwndParent, string_size, variables, 
-		   stacktop, extra, keys, values, MAX_KEYS);
-    }
+  value = config_lookup (key);
 
-#if 0
-  MessageBox(g_hwndParent, "Configuration File:", 0, MB_OK);
-  i = 0;
-  while (keys[i])
+  setuservariable (INST_R0, value == NULL ? "" : value);
+  return;
+}
+
+
+void __declspec(dllexport) 
+config_fetch_bool (HWND hwndParent, int string_size, char *variables, 
+		   stack_t **stacktop, extra_parameters_t *extra)
+{
+  char key[256];
+  int err = 0;
+  char *value;
+  int result;
+
+  g_hwndParent = hwndParent;
+  EXDLL_INIT();
+
+  /* The expected stack layout: key.  */
+  if (popstring (key, sizeof (key)))
+    err = 1;
+  if (err)
     {
-      char buf[256];
-      sprintf (buf, "%s=%s\r\n", keys[i], values[i]);
-      MessageBox(g_hwndParent, buf, 0, MB_OK);
-      i++;
+      setuservariable (INST_R0, "");
+      return;
     }
-#endif
 
-  i = 0;
-  while (keys[i])
+  value = config_lookup (key);
+  if (value == NULL || *value == '\0')
     {
-      if (!strcmp (keys[i], key))
-	{
-	  setuservariable (INST_R0, values[i]);
-	  return;
-	}
-      i++;
+      setuservariable (INST_R0, "");
+      return;
     }
   
-  setuservariable (INST_R0, "");
+  result = 0;
+  if (!strcasecmp (value, "true")
+      || !strcasecmp (value, "yes")
+      || atoi (value) != 0)
+    result = 1;
+
+  setuservariable (INST_R0, result == 0 ? "0" : "1");
   return;
 }

Modified: trunk/src/inst-sections.nsi
===================================================================
--- trunk/src/inst-sections.nsi	2007-08-14 15:42:34 UTC (rev 474)
+++ trunk/src/inst-sections.nsi	2007-08-14 17:15:27 UTC (rev 475)
@@ -246,6 +246,140 @@
 
 !include "Sections.nsh"
 
+
+Function CalcDefaults
+
+# The defaults for the installer-options.ini file.
+g4wihelp::config_fetch_bool "inst_start_menu"
+StrCmp $R0 "" +2
+!insertmacro MUI_INSTALLOPTIONS_WRITE "installer-options.ini" \
+	"Field 2" "State" $R0
+
+g4wihelp::config_fetch_bool "inst_desktop"
+StrCmp $R0 "" +2
+!insertmacro MUI_INSTALLOPTIONS_WRITE "installer-options.ini" \
+	"Field 3" "State" $R0
+
+g4wihelp::config_fetch_bool "inst_quick_launch_bar"
+StrCmp $R0 "" +2
+!insertmacro MUI_INSTALLOPTIONS_WRITE "installer-options.ini" \
+	"Field 4" "State" $R0
+
+
+
+!ifdef HAVE_PKG_GNUPG2
+  g4wihelp::config_fetch_bool "inst_gnupg2"
+  StrCmp $R0 "1" 0 calc_defaults_gnupg2_not_one
+   !insertmacro SelectSection ${SEC_gnupg2}
+   Goto calc_defaults_gnupg2_done
+  calc_defaults_gnupg2_not_one:
+  StrCmp $R0 "0" 0 calc_defaults_gnupg2_done
+   !insertmacro UnselectSection ${SEC_gnupg2}
+calc_defaults_gnupg2_done:
+!endif
+
+!ifdef HAVE_PKG_GPGOL
+  g4wihelp::config_fetch_bool "inst_gpgol"
+  StrCmp $R0 "1" 0 calc_defaults_gpgol_not_one
+   !insertmacro SelectSection ${SEC_gpgol}
+   Goto calc_defaults_gpgol_done
+  calc_defaults_gpgol_not_one:
+  StrCmp $R0 "0" 0 calc_defaults_gpgol_done
+   !insertmacro UnselectSection ${SEC_gpgol}
+calc_defaults_gpgol_done:
+!endif
+
+!ifdef HAVE_PKG_GPA
+  g4wihelp::config_fetch_bool "inst_gpa"
+  StrCmp $R0 "1" 0 calc_defaults_gpa_not_one
+   !insertmacro SelectSection ${SEC_gpa}
+   Goto calc_defaults_gpa_done
+  calc_defaults_gpa_not_one:
+  StrCmp $R0 "0" 0 calc_defaults_gpa_done
+   !insertmacro UnselectSection ${SEC_gpa}
+calc_defaults_gpa_done:
+!endif
+
+!ifdef HAVE_PKG_WINPT
+  g4wihelp::config_fetch_bool "inst_winpt"
+  StrCmp $R0 "1" 0 calc_defaults_winpt_not_one
+   !insertmacro SelectSection ${SEC_winpt}
+   Goto calc_defaults_winpt_done
+  calc_defaults_winpt_not_one:
+  StrCmp $R0 "0" 0 calc_defaults_winpt_done
+   !insertmacro UnselectSection ${SEC_winpt}
+calc_defaults_winpt_done:
+!endif
+
+!ifdef HAVE_PKG_GPGEE
+  g4wihelp::config_fetch_bool "inst_gpgee"
+  StrCmp $R0 "1" 0 calc_defaults_gpgee_not_one
+   !insertmacro SelectSection ${SEC_gpgee}
+   Goto calc_defaults_gpgee_done
+  calc_defaults_gpgee_not_one:
+  StrCmp $R0 "0" 0 calc_defaults_gpgee_done
+   !insertmacro UnselectSection ${SEC_gpgee}
+calc_defaults_gpgee_done:
+!endif
+
+!ifdef HAVE_PKG_CLAWS_MAIL
+  g4wihelp::config_fetch_bool "inst_claws_mail"
+  StrCmp $R0 "1" 0 calc_defaults_claws_mail_not_one
+   !insertmacro SelectSection ${SEC_claws_mail}
+   Goto calc_defaults_claws_mail_done
+  calc_defaults_claws_mail_not_one:
+  StrCmp $R0 "0" 0 calc_defaults_claws_mail_done
+   !insertmacro UnselectSection ${SEC_claws_mail}
+calc_defaults_claws_mail_done:
+!endif
+
+!ifdef HAVE_PKG_MAN_NOVICE_DE
+  g4wihelp::config_fetch_bool "inst_man_novice_de"
+  StrCmp $R0 "1" 0 calc_defaults_man_novice_de_not_one
+   !insertmacro SelectSection ${SEC_man_novice_de}
+   Goto calc_defaults_man_novice_de_done
+  calc_defaults_man_novice_de_not_one:
+  StrCmp $R0 "0" 0 calc_defaults_man_novice_de_done
+   !insertmacro UnselectSection ${SEC_man_novice_de}
+calc_defaults_man_novice_de_done:
+!endif
+
+!ifdef HAVE_PKG_MAN_NOVICE_EN
+  g4wihelp::config_fetch_bool "inst_man_novice_en"
+  StrCmp $R0 "1" 0 calc_defaults_man_novice_en_not_one
+   !insertmacro SelectSection ${SEC_man_novice_en}
+   Goto calc_defaults_man_novice_en_done
+  calc_defaults_man_novice_en_not_one:
+  StrCmp $R0 "0" 0 calc_defaults_man_novice_en_done
+   !insertmacro UnselectSection ${SEC_man_novice_en}
+calc_defaults_man_novice_en_done:
+!endif
+
+!ifdef HAVE_PKG_MAN_ADVANCED_DE
+  g4wihelp::config_fetch_bool "inst_man_advanced_de"
+  StrCmp $R0 "1" 0 calc_defaults_man_advanced_de_not_one
+   !insertmacro SelectSection ${SEC_man_advanced_de}
+   Goto calc_defaults_man_advanced_de_done
+  calc_defaults_man_advanced_de_not_one:
+  StrCmp $R0 "0" 0 calc_defaults_man_advanced_de_done
+   !insertmacro UnselectSection ${SEC_man_advanced_de}
+calc_defaults_man_advanced_de_done:
+!endif
+
+!ifdef HAVE_PKG_MAN_ADVANCED_EN
+  g4wihelp::config_fetch_bool "inst_man_advanced_en"
+  StrCmp $R0 "1" 0 calc_defaults_man_advanced_en_not_one
+   !insertmacro SelectSection ${SEC_man_advanced_en}
+   Goto calc_defaults_man_advanced_en_done
+  calc_defaults_man_advanced_en_not_one:
+  StrCmp $R0 "0" 0 calc_defaults_man_advanced_en_done
+   !insertmacro UnselectSection ${SEC_man_advanced_en}
+calc_defaults_man_advanced_en_done:
+!endif
+
+FunctionEnd
+
+
 Function CalcDepends
   # This section could very well be autogenerated from the
   # information in configure.ac.  Note that it doesn't hurt to have
@@ -513,7 +647,7 @@
   SetOutPath $TEMP
 !ifdef SOURCES
   File /oname=gpgspltmp.bmp "${TOP_SRCDIR}/doc/logo/gpg4win-logo-400px.bmp"
-  # We play the tune only for the soruce installer
+  # We play the tune only for the source installer
   File /oname=gpgspltmp.wav "${TOP_SRCDIR}/src/gpg4win-splash.wav"
   g4wihelp::playsound $TEMP\gpgspltmp.wav
   g4wihelp::showsplash 2500 $TEMP\gpgspltmp.bmp
@@ -527,6 +661,7 @@
   # generate the file from a template.
   !insertmacro MUI_INSTALLOPTIONS_EXTRACT "installer-options.ini"
 
+  Call CalcDefaults
   Call CalcDepends
   Call CheckOtherGnuPGApps
 FunctionEnd

Modified: trunk/src/installer-finish.nsi
===================================================================
--- trunk/src/installer-finish.nsi	2007-08-14 15:42:34 UTC (rev 474)
+++ trunk/src/installer-finish.nsi	2007-08-14 17:15:27 UTC (rev 475)
@@ -50,6 +50,9 @@
   # Delete the menu entries and any empty parent menus
   #---------------------------------------------------
   !insertmacro MUI_STARTMENU_GETFOLDER Application $MYTMP
+  g4wihelp::config_fetch "inst_start_menu_folder"
+  StrCmp $R0 "" +2
+  StrCpy $MYTMP $R0
   Delete "$SMPROGRAMS\$MYTMP\*.lnk"
   StrCpy $MYTMP "$SMPROGRAMS\$MYTMP"
   startMenuDeleteLoop:

Modified: trunk/src/installer.nsi
===================================================================
--- trunk/src/installer.nsi	2007-08-14 15:42:34 UTC (rev 474)
+++ trunk/src/installer.nsi	2007-08-14 17:15:27 UTC (rev 475)
@@ -243,7 +243,7 @@
 Function CustomPageOptions
   !insertmacro MUI_HEADER_TEXT "$(T_InstallOptions)" "$(T_InstallOptLinks)"
 
-  # Note, that the default selection is done in the ini file
+  # Note that the default selection is done in the ini file.
   !insertmacro MUI_INSTALLOPTIONS_WRITE "installer-options.ini" \
 	"Field 1" "Text"  "$(T_InstOptLabelA)"
   !insertmacro MUI_INSTALLOPTIONS_WRITE "installer-options.ini" \



More information about the Gpg4win-commits mailing list