"Fossies" - the Fresh Open Source Software Archive

Member "snort-2.9.17/src/win32/WIN32-Prj/snort_installer.nsi" (16 Oct 2020, 8314 Bytes) of package /linux/misc/snort-2.9.17.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) NSIS source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "snort_installer.nsi": 2.9.16.1_vs_2.9.17.

    1 ; $Id$
    2 ;
    3 ; NSIS Installation script for Snort 2.9.17 Win32
    4 ; Written by Chris Reid <chris.reid@codecraftconsultants.com>
    5 ; Updated by Steven Sturges <ssturges@sourcefire.com>
    6 ;
    7 ; This script will create a Win32 installer for Snort 2.9.17 (Win32 only).
    8 ; For more information about NSIS, see their homepage:
    9 ;     http://nsis.sourceforge.net/
   10 ;
   11 ; Note that this NSIS script is designed for NSIS version 2.09.
   12 ;
   13 
   14 Name "Snort 2.9.17"
   15 
   16 CRCCheck On
   17 
   18 !include "MUI.nsh"
   19 
   20 !define TEMP $R0
   21 
   22 ;--------------------------------
   23 ;Configuration
   24 
   25   ;General
   26   OutFile "Snort_2.9.17_Installer.x86.exe"  ; The name of the installer executable
   27 
   28   ;Folder selection page
   29   InstallDir "C:\Snort"
   30 
   31 
   32 ;--------------------------------
   33 ;Modern UI Configuration
   34 
   35   !define MUI_CUSTOMPAGECOMMANDS
   36 
   37   !define MUI_LICENSEPAGE
   38   !define MUI_COMPONENTSPAGE
   39   !define MUI_DIRECTORYPAGE
   40   
   41   !define MUI_ABORTWARNING
   42   
   43   !define MUI_UNINSTALLER
   44   !define MUI_UNCONFIRMPAGE
   45   
   46 ;--------------------------------
   47 ;Languages
   48  
   49   !insertmacro MUI_LANGUAGE "English"
   50   
   51 ;--------------------------------
   52 ;Language Strings
   53 
   54   ;Description
   55   LangString DESC_Snort   ${LANG_ENGLISH} "Install snort, configuration files, and rules."
   56   LangString DESC_Dynamic ${LANG_ENGLISH} "Install dynamic preprocessor and dynamic engine modules."
   57   LangString DESC_Doc     ${LANG_ENGLISH} "Install snort documentation."
   58   
   59 
   60 ;--------------------------------
   61 ;Data
   62   
   63   LicenseData "..\..\..\LICENSE"
   64 
   65 ;--------------------------------
   66 ;Pages
   67   
   68   !insertmacro MUI_PAGE_LICENSE "..\..\..\LICENSE"
   69   Page custom fnSetHeaderText
   70   !insertmacro MUI_PAGE_COMPONENTS
   71   Page custom fnSetHeaderText
   72   !insertmacro MUI_PAGE_DIRECTORY
   73   Page custom fnSetHeaderText
   74   !insertmacro MUI_PAGE_INSTFILES
   75 
   76   ; Call .onDirectoryLeave whenever user leaves
   77   ; the directory selection page
   78   ;!define MUI_CUSTOMFUNCTION_DIRECTORY_LEAVE  onDirectoryLeave
   79 
   80 ;--------------------------------
   81 ; Event Handlers
   82 
   83 Function .onInstSuccess
   84   StrCpy $0 "Snort has successfully been installed.$\r$\n"
   85   StrCpy $0 "$0$\r$\n"
   86   StrCpy $0 "$0$\r$\n"
   87   StrCpy $0 "$0Snort also requires WinPcap 4.1.1 or higher to be installed on this machine.$\r$\n"
   88   StrCpy $0 "$0WinPcap can be downloaded from:$\r$\n"
   89   StrCpy $0 "$0    http://www.winpcap.org/ $\r$\n"
   90   StrCpy $0 "$0$\r$\n"
   91   StrCpy $0 "$0$\r$\n"
   92   StrCpy $0 "$0It would also be wise to tighten the security on the Snort installation$\r$\n"
   93   StrCpy $0 "$0directory to prevent any malicious modification of the Snort executable.$\r$\n"
   94   StrCpy $0 "$0$\r$\n"
   95   StrCpy $0 "$0$\r$\n"
   96   StrCpy $0 "$0Next, you must manually edit the 'snort.conf' file to$\r$\n"
   97   StrCpy $0 "$0specify proper paths to allow Snort to find the rules files$\r$\n"
   98   StrCpy $0 "$0and classification files."
   99   MessageBox MB_OK $0
  100 FunctionEnd
  101 
  102 
  103 ;--------------------------------
  104 ;Installer Sections
  105 
  106 Section "Snort" Snort
  107   ; --------------------------------------------------------------------
  108   ; NOTE: The installer, as delivered here, will only allow the user
  109   ;       to install configurations which can optionally be run as a
  110   ;       Windows Service.
  111   ; --------------------------------------------------------------------
  112 
  113   ; Search for a space embedded within $INSTDIR
  114   StrCpy $R4 0  ; index within $INSTDIR
  115   searching_for_space:
  116     StrCpy $R5 $INSTDIR 1 $R4  ; copy 1 char from $INSTDIR[$R4] into $R5
  117     StrCmp $R5 " " found_space
  118     StrCmp $R5 "" done_searching_for_space
  119     IntOp $R4 $R4 + 1  ; increment index
  120     Goto searching_for_space
  121   found_space:
  122     StrCpy $0 "The installation directory appears to contain an$\r$\n"
  123     StrCpy $0 "$0embedded space character.  You need to be aware that$\r$\n"
  124     StrCpy $0 "$0because of this, all paths specified on the command-line$\r$\n"
  125     StrCpy $0 "$0and in the 'snort.conf' file must be enclosed within$\r$\n"
  126     StrCpy $0 "$0double-quotes.$\r$\n"
  127     MessageBox MB_OK $0
  128   done_searching_for_space:
  129 
  130 
  131   CreateDirectory "$INSTDIR"
  132 
  133   CreateDirectory "$INSTDIR\bin"
  134   SetOutPath "$INSTDIR\bin"
  135   ; File ".\LibnetNT.dll"
  136   File ".\pcre.dll"
  137   File ".\zlib1.dll"
  138   File ".\ntwdblib.dll"
  139   File ".\wpcap.dll"
  140   File ".\WanPacket.dll"
  141   File ".\npptools.dll"
  142   File ".\Packet.dll"
  143   
  144   CreateDirectory "$INSTDIR\etc"
  145   SetOutPath "$INSTDIR\etc"
  146   File "..\..\..\etc\*.conf"
  147   File "..\..\..\etc\*.config"
  148   File "..\..\..\etc\*.map"
  149 
  150   CreateDirectory "$INSTDIR\rules"
  151   SetOutPath "$INSTDIR\rules"
  152   ;Rules are no longer part of the distribution
  153   ;File /r "..\..\..\rules\*.rules"
  154 
  155   CreateDirectory "$INSTDIR\preproc_rules"
  156   SetOutPath "$INSTDIR\preproc_rules"
  157   File "..\..\..\preproc_rules\*.rules"
  158 
  159   CreateDirectory "$INSTDIR\log"
  160 
  161   SetOutPath "$INSTDIR\bin"
  162 
  163   ; --------------------------------------------------------------------
  164   ; Configurations
  165   ; --------------------------------------------------------------------
  166   File ".\snort___Win32_Release\snort.exe"
  167 
  168   ;Create uninstaller
  169   SetOutPath "$INSTDIR"
  170   WriteUninstaller "$INSTDIR\Uninstall.exe"
  171 SectionEnd
  172 
  173 Section "Dynamic Modules" Dynamic
  174   CreateDirectory "$INSTDIR\lib"
  175   CreateDirectory "$INSTDIR\lib\snort_dynamicpreprocessor"
  176   SetOutPath "$INSTDIR\lib\snort_dynamicpreprocessor"
  177 
  178   File "..\..\dynamic-preprocessors\ftptelnet\Release\sf_ftptelnet.dll"
  179   File "..\..\dynamic-preprocessors\smtp\Release\sf_smtp.dll"
  180   File "..\..\dynamic-preprocessors\ssh\Release\sf_ssh.dll"
  181   File "..\..\dynamic-preprocessors\dns\Release\sf_dns.dll"
  182   File "..\..\dynamic-preprocessors\ssl\Release\sf_ssl.dll"
  183   File "..\..\dynamic-preprocessors\dcerpc2\Release\sf_dce2.dll"
  184   File "..\..\dynamic-preprocessors\sdf\Release\sf_sdf.dll"
  185   File "..\..\dynamic-preprocessors\sip\Release\sf_sip.dll"
  186   File "..\..\dynamic-preprocessors\imap\Release\sf_imap.dll"
  187   File "..\..\dynamic-preprocessors\pop\Release\sf_pop.dll"
  188   File "..\..\dynamic-preprocessors\reputation\Release\sf_reputation.dll"
  189   File "..\..\dynamic-preprocessors\modbus\Release\sf_modbus.dll"
  190   File "..\..\dynamic-preprocessors\dnp3\Release\sf_dnp3.dll"
  191   File "..\..\dynamic-preprocessors\gtp\Release\sf_gtp.dll"
  192 
  193   CreateDirectory "$INSTDIR\lib\snort_dynamicengine"
  194   SetOutPath "$INSTDIR\lib\snort_dynamicengine"
  195   File ".\SF_Engine_Release\sf_engine.dll"
  196 
  197 SectionEnd
  198 
  199 Section "Documentation" Doc
  200   CreateDirectory "$INSTDIR\doc"
  201   SetOutPath "$INSTDIR\doc"
  202   File "..\..\..\ChangeLog"
  203   File "..\..\..\LICENSE"
  204   File "..\..\..\RELEASE.NOTES"
  205   File "..\..\..\doc\*.*"
  206   Delete "$INSTDIR\doc\.cvsignore"
  207 
  208   CreateDirectory "$INSTDIR\doc\signatures"
  209   SetOutPath "$INSTDIR\doc\signatures"
  210   ;Rules are no longer part of the distribution
  211   ;File "..\..\..\doc\signatures\*.*"
  212 
  213 SectionEnd
  214 
  215 
  216 ;Display the Finish header
  217 ;Insert this macro after the sections if you are not using a finish page
  218 ;!insertmacro MUI_SECTIONS_FINISHHEADER
  219 
  220 
  221 ;--------------------------------
  222 ;Descriptions
  223 
  224 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  225   !insertmacro MUI_DESCRIPTION_TEXT ${Snort}   $(DESC_Snort)
  226   !insertmacro MUI_DESCRIPTION_TEXT ${Dynamic} $(DESC_Dynamic)
  227   !insertmacro MUI_DESCRIPTION_TEXT ${Doc}     $(DESC_Doc)
  228 !insertmacro MUI_FUNCTION_DESCRIPTION_END
  229 
  230 ;--------------------------------
  231 ; Installer Functions
  232 
  233 Function fnSetHeaderText
  234   !insertmacro MUI_HEADER_TEXT "$(TEXT_IO_PAGETITLE_OPTIONS)" ""
  235 FunctionEnd
  236 
  237 ;--------------------------------
  238 ;Uninstaller Section
  239 
  240 Section "Uninstall"
  241 
  242   ; If Snort appears to already be installed as a Windows Service,
  243   ; then ask the user if the uninstall should unregister the
  244   ; Service.
  245 
  246   ReadRegStr $1 HKLM "Software\Snort" "CmdLineParamCount"
  247   StrCmp $1 "" service_not_registered
  248     MessageBox MB_YESNO "It appears that Snort is registered as a Windows Service.  Should it be unregistered now?" IDNO finished_unregistering_service
  249     ExecWait "net stop snortsvc"
  250     ExecWait "$INSTDIR\bin\snort.exe /SERVICE /UNINSTALL"
  251     GoTo finished_unregistering_service
  252 
  253   service_not_registered:
  254     MessageBox MB_OK "Snort not installed as a service" /SD IDOK 
  255    
  256   finished_unregistering_service:
  257     RMDir /r "$INSTDIR"
  258     ;!insertmacro MUI_UNFINISHHEADER
  259 
  260 SectionEnd