]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - win/inspircd.nsi
Make two sections "Binaries" and "command handlers" manditory - you won't have a...
[user/henk/code/inspircd.git] / win / inspircd.nsi
index 9242d4c6ae5d55932c476b2c8bf457082b99a855..9fb79c0dd876cda7a4aa192b213f93e97e90e67a 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
@@ -16,8 +24,8 @@ SetCompressor bzip2
 \r
 ; MUI Settings\r
 !define MUI_ABORTWARNING\r
-!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\arrow2-install.ico"\r
-!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\arrow2-uninstall.ico"\r
+!define MUI_ICON "inspircd.ico"\r
+!define MUI_UNICON "inspircd.ico"\r
 \r
 ; Welcome page\r
 !insertmacro MUI_PAGE_WELCOME\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
@@ -102,6 +170,7 @@ Section -Post
   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"\r
   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"\r
   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"\r
+  MessageBox MB_ICONINFORMATION|MB_OK "InspIRCd was successfully installed. Remember to edit your configuration file in $INSTDIR\conf!"\r
 SectionEnd\r
 \r
 ; Section descriptions\r
@@ -118,6 +187,11 @@ Function un.onUninstSuccess
   MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."\r
 FunctionEnd\r
 \r
+Function .onInit\r
+  SectionSetFlags ${SEC01} 17\r
+  SectionSetFlags ${SEC03} 17\r
+FunctionEnd\r
+\r
 Function un.onInit\r
   MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2\r
   Abort\r
@@ -126,88 +200,8 @@ FunctionEnd
 Section Uninstall\r
   Delete "$INSTDIR\${PRODUCT_NAME}.url"\r
   Delete "$INSTDIR\uninst.exe"\r
-  Delete "$INSTDIR\modules\m_spanningtree.so"\r
-  Delete "$INSTDIR\modules\m_alias.so"\r
-  Delete "$INSTDIR\modules\m_alltime.so"\r
-  Delete "$INSTDIR\modules\m_banexception.so"\r
-  Delete "$INSTDIR\modules\m_blockcolor.so"\r
-  Delete "$INSTDIR\modules\m_chghost.so"\r
-  Delete "$INSTDIR\modules\m_cloaking.so"\r
-  Delete "$INSTDIR\modules\m_conn_lusers.so"\r
-  Delete "$INSTDIR\modules\m_conn_umodes.so"\r
-  Delete "$INSTDIR\modules\m_devoice.so"\r
-  Delete "$INSTDIR\modules\m_globalload.so"\r
-  Delete "$INSTDIR\modules\m_globops.so"\r
-  Delete "$INSTDIR\modules\m_hidechans.so"\r
-  Delete "$INSTDIR\modules\m_hideoper.so"\r
-  Delete "$INSTDIR\modules\m_md5.so"\r
-  Delete "$INSTDIR\modules\m_noctcp.so"\r
-  Delete "$INSTDIR\modules\m_operchans.so"\r
-  Delete "$INSTDIR\modules\m_randquote.so"\r
-  Delete "$INSTDIR\modules\m_sajoin.so"\r
-  Delete "$INSTDIR\modules\m_samode.so"\r
-  Delete "$INSTDIR\modules\m_sanick.so"\r
-  Delete "$INSTDIR\modules\m_sapart.so"\r
-  Delete "$INSTDIR\modules\m_saquit.so"\r
-  Delete "$INSTDIR\modules\m_services_account.so"\r
-  Delete "$INSTDIR\modules\m_sethost.so"\r
-  Delete "$INSTDIR\modules\m_setident.so"\r
-  Delete "$INSTDIR\modules\m_setname.so"\r
-  Delete "$INSTDIR\modules\m_sha256.so"\r
-  Delete "$INSTDIR\modules\m_showwhois.so"\r
-  Delete "$INSTDIR\lib\cmd_admin.so"\r
-  Delete "$INSTDIR\lib\cmd_away.so"\r
-  Delete "$INSTDIR\lib\cmd_clearcache.so"\r
-  Delete "$INSTDIR\lib\cmd_commands.so"\r
-  Delete "$INSTDIR\lib\cmd_connect.so"\r
-  Delete "$INSTDIR\lib\cmd_die.so"\r
-  Delete "$INSTDIR\lib\cmd_eline.so"\r
-  Delete "$INSTDIR\lib\cmd_gline.so"\r
-  Delete "$INSTDIR\lib\cmd_info.so"\r
-  Delete "$INSTDIR\lib\cmd_invite.so"\r
-  Delete "$INSTDIR\lib\cmd_ison.so"\r
-  Delete "$INSTDIR\lib\cmd_join.so"\r
-  Delete "$INSTDIR\lib\cmd_kick.so"\r
-  Delete "$INSTDIR\lib\cmd_kill.so"\r
-  Delete "$INSTDIR\lib\cmd_kline.so"\r
-  Delete "$INSTDIR\lib\cmd_links.so"\r
-  Delete "$INSTDIR\lib\cmd_list.so"\r
-  Delete "$INSTDIR\lib\cmd_loadmodule.so"\r
-  Delete "$INSTDIR\lib\cmd_lusers.so"\r
-  Delete "$INSTDIR\lib\cmd_map.so"\r
-  Delete "$INSTDIR\lib\cmd_mode.so"\r
-  Delete "$INSTDIR\lib\cmd_modules.so"\r
-  Delete "$INSTDIR\lib\cmd_motd.so"\r
-  Delete "$INSTDIR\lib\cmd_names.so"\r
-  Delete "$INSTDIR\lib\cmd_nick.so"\r
-  Delete "$INSTDIR\lib\cmd_notice.so"\r
-  Delete "$INSTDIR\lib\cmd_oper.so"\r
-  Delete "$INSTDIR\lib\cmd_part.so"\r
-  Delete "$INSTDIR\lib\cmd_pass.so"\r
-  Delete "$INSTDIR\lib\cmd_ping.so"\r
-  Delete "$INSTDIR\lib\cmd_pong.so"\r
-  Delete "$INSTDIR\lib\cmd_privmsg.so"\r
-  Delete "$INSTDIR\lib\cmd_qline.so"\r
-  Delete "$INSTDIR\lib\cmd_quit.so"\r
-  Delete "$INSTDIR\lib\cmd_rehash.so"\r
-  Delete "$INSTDIR\lib\cmd_restart.so"\r
-  Delete "$INSTDIR\lib\cmd_rules.so"\r
-  Delete "$INSTDIR\lib\cmd_server.so"\r
-  Delete "$INSTDIR\lib\cmd_squit.so"\r
-  Delete "$INSTDIR\lib\cmd_stats.so"\r
-  Delete "$INSTDIR\lib\cmd_summon.so"\r
-  Delete "$INSTDIR\lib\cmd_time.so"\r
-  Delete "$INSTDIR\lib\cmd_topic.so"\r
-  Delete "$INSTDIR\lib\cmd_trace.so"\r
-  Delete "$INSTDIR\lib\cmd_unloadmodule.so"\r
-  Delete "$INSTDIR\lib\cmd_user.so"\r
-  Delete "$INSTDIR\lib\cmd_userhost.so"\r
-  Delete "$INSTDIR\lib\cmd_users.so"\r
-  Delete "$INSTDIR\lib\cmd_version.so"\r
-  Delete "$INSTDIR\lib\cmd_wallops.so"\r
-  Delete "$INSTDIR\lib\cmd_who.so"\r
-  Delete "$INSTDIR\lib\cmd_whois.so"\r
-  Delete "$INSTDIR\lib\cmd_zline.so"\r
+  Delete "$INSTDIR\modules\m_*.so"\r
+  Delete "$INSTDIR\lib\cmd_*.so"\r
   Delete "$INSTDIR\conf\inspircd.quotes.example"\r
   Delete "$INSTDIR\conf\inspircd.rules.example"\r
   Delete "$INSTDIR\conf\inspircd.censor.example"\r
@@ -220,7 +214,7 @@ Section Uninstall
   Delete "$INSTDIR\InspGUI.exe"\r
 \r
   Delete "$SMPROGRAMS\InspIRCd\Uninstall.lnk"\r
-  Delete "$SMPROGRAMS\InspIRCd\Website.lnk"\r
+  Delete "$SMPROGRAMS\InspIRCd\InspIRCd Website.lnk"\r
   Delete "$SMPROGRAMS\InspIRCd\InspIRCd.lnk"\r
 \r
   RMDir "$SMPROGRAMS\InspIRCd"\r
@@ -228,6 +222,7 @@ Section Uninstall
   RMDir "$INSTDIR\lib"\r
   RMDir "$INSTDIR\conf"\r
   RMDir "$INSTDIR\bin"\r
+  RMDir "$INSTDIR"\r
 \r
   DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"\r
   DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"\r