]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - win/inspircd.nsi
- Fix two minor warnings here (catch (ModuleException& e) -> catch (ModuleException...
[user/henk/code/inspircd.git] / win / inspircd.nsi
index 16c6dcd3eda6370af86f402fc9ca482de0f93fdb..40c15053de0faab13532923743aec05acaaad04d 100644 (file)
@@ -1,4 +1,10 @@
-; Script generated by the HM NIS Edit Script Wizard.\r
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\r
+\r
+                       ;;;; SET THE BUILD TO BE PACKAGED HERE ;;;;\r
+\r
+!define BUILD "release"\r
+\r
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\r
 \r
 ; HM NIS Edit Wizard helper defines\r
 !define PRODUCT_NAME "InspIRCd"\r
@@ -8,6 +14,8 @@
 !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\inspircd.exe"\r
 !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"\r
 !define PRODUCT_UNINST_ROOT_KEY "HKLM"\r
+!define DOT_MAJOR "2"\r
+!define DOT_MINOR "0"\r
 \r
 SetCompressor bzip2\r
 \r
@@ -53,15 +61,75 @@ InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
 ShowInstDetails show\r
 ShowUnInstDetails show\r
 \r
+Function IsDotNetInstalled\r
\r
+  StrCpy $0 "0"\r
+  StrCpy $1 "SOFTWARE\Microsoft\.NETFramework" ;registry entry to look in.\r
+  StrCpy $2 0\r
\r
+  StartEnum:\r
+    ;Enumerate the versions installed.\r
+    EnumRegKey $3 HKLM "$1\policy" $2\r
+    \r
+    ;If we don't find any versions installed, it's not here.\r
+    StrCmp $3 "" noDotNet notEmpty\r
+    \r
+    ;We found something.\r
+    notEmpty:\r
+      ;Find out if the RegKey starts with 'v'.  \r
+      ;If it doesn't, goto the next key.\r
+      StrCpy $4 $3 1 0\r
+      StrCmp $4 "v" +1 goNext\r
+      StrCpy $4 $3 1 1\r
+      \r
+      ;It starts with 'v'.  Now check to see how the installed major version\r
+      ;relates to our required major version.\r
+      ;If it's equal check the minor version, if it's greater, \r
+      ;we found a good RegKey.\r
+      IntCmp $4 ${DOT_MAJOR} +1 goNext yesDotNetReg\r
+      ;Check the minor version.  If it's equal or greater to our requested \r
+      ;version then we're good.\r
+      StrCpy $4 $3 1 3\r
+      IntCmp $4 ${DOT_MINOR} yesDotNetReg goNext yesDotNetReg\r
\r
+    goNext:\r
+      ;Go to the next RegKey.\r
+      IntOp $2 $2 + 1\r
+      goto StartEnum\r
\r
+  yesDotNetReg:\r
+    ;Now that we've found a good RegKey, let's make sure it's actually\r
+    ;installed by getting the install path and checking to see if the \r
+    ;mscorlib.dll exists.\r
+    EnumRegValue $2 HKLM "$1\policy\$3" 0\r
+    ;$2 should equal whatever comes after the major and minor versions \r
+    ;(ie, v1.1.4322)\r
+    StrCmp $2 "" noDotNet\r
+    ReadRegStr $4 HKLM $1 "InstallRoot"\r
+    ;Hopefully the install root isn't empty.\r
+    StrCmp $4 "" noDotNet\r
+    ;build the actuall directory path to mscorlib.dll.\r
+    StrCpy $4 "$4$3.$2\mscorlib.dll"\r
+    IfFileExists $4 yesDotNet noDotNet\r
\r
+  noDotNet:\r
+    MessageBox MB_OK "You do not have have v${DOT_MAJOR}.${DOT_MINOR} or greater of the .NET framework installed. This is required for the InspIRCd Monitor, however you can still launch the IRCd manually."\r
\r
+  yesDotNet:\r
+    ;Everything checks out.  Go on with the rest of the installation.\r
+    \r
+FunctionEnd\r
+\r
 Section "Binary Executable" SEC01\r
+  Call IsDotNetInstalled\r
   SetOutPath "$INSTDIR"\r
   SetOverwrite ifnewer\r
-  File "..\bin\debug\InspGUI.exe"\r
+  File "..\bin\${BUILD}\InspGUI.exe"\r
   CreateDirectory "$SMPROGRAMS\InspIRCd"\r
   CreateShortCut "$SMPROGRAMS\InspIRCd\InspIRCd.lnk" "$INSTDIR\InspGUI.exe"\r
   SetOutPath "$INSTDIR\bin"\r
   SetOverwrite ifnewer\r
-  File "..\bin\debug\bin\inspircd.exe"\r
+  File "..\bin\${BUILD}\bin\inspircd.exe"\r
 SectionEnd\r
 \r
 Section "Config Files" SEC02\r
@@ -78,12 +146,12 @@ SectionEnd
 \r
 Section "Command Handlers" SEC03\r
   SetOutPath "$INSTDIR\lib"\r
-  File "..\bin\debug\lib\cmd_*.so"\r
+  File "..\bin\${BUILD}\lib\cmd_*.so"\r
 SectionEnd\r
 \r
 Section "Modules" SEC04\r
   SetOutPath "$INSTDIR\modules"\r
-  File "..\bin\debug\modules\*.so"\r
+  File "..\bin\${BUILD}\modules\*.so"\r
 SectionEnd\r
 \r
 Section -AdditionalIcons\r