github.com/mattdotmatt/gauge@v0.3.2-0.20160421115137-425a4cdccb62/build/install/windows/gauge-install.nsi (about)

     1  ; This script builds gauge installation package
     2  ; It needs the following arguments to be set before calling compile
     3  ;    PRODUCT_VERSION -> Version of Gauge
     4  ;    GAUGE_DISTRIBUTABLES_DIR -> Directory where gauge distributables are available. It should not end with \
     5  ;    OUTPUT_FILE_NAME -> Name of the setup file
     6  
     7  ; HM NIS Edit Wizard helper defines
     8  !define PRODUCT_NAME "Gauge"
     9  !define PRODUCT_PUBLISHER "ThoughtWorks Inc."
    10  !define PRODUCT_WEB_SITE "http://getgauge.io"
    11  !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\gauge.exe"
    12  !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
    13  !define PRODUCT_UNINST_ROOT_KEY "HKLM"
    14  
    15  ; MUI 1.67 compatible ------
    16  !include "MUI.nsh"
    17  !include "MUI2.nsh"
    18  !include "MUI_EXTRAPAGES.nsh"
    19  !include "EnvVarUpdate.nsh"
    20  !include "x64.nsh"
    21  !include "winmessages.nsh"
    22  
    23  ; MUI Settings
    24  !define MUI_ABORTWARNING
    25  !define MUI_ICON "gauge-install.ico"
    26  !define MUI_UNICON "gauge-install.ico"
    27  !define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
    28  ; Welcome page
    29  !insertmacro MUI_PAGE_WELCOME
    30  ; License page
    31  !insertmacro MUI_PAGE_LICENSE "gpl.txt"
    32  ; Plugin options page
    33  !insertmacro MUI_PAGE_COMPONENTS
    34  ; Directory page
    35  !insertmacro MUI_PAGE_DIRECTORY
    36  ; Instfiles page
    37  !insertmacro MUI_PAGE_INSTFILES
    38  ;Readme page
    39  !insertmacro MUI_PAGE_README "readme.txt"
    40  ; Finish page
    41  ;!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\readme.txt"
    42  !insertmacro MUI_PAGE_FINISH
    43  
    44  ; Uninstaller pages
    45  !insertmacro MUI_UNPAGE_INSTFILES
    46  
    47  ; Language files
    48  !insertmacro MUI_LANGUAGE "English"
    49  
    50  ; MUI end ------
    51  
    52  Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
    53  OutFile "${OUTPUT_FILE_NAME}"
    54  InstallDir "$PROGRAMFILES\Gauge"
    55  InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
    56  ShowInstDetails show
    57  ShowUnInstDetails show
    58  
    59  function .onInit
    60    ${If} ${RunningX64}
    61      SetRegView 64
    62      StrCpy $INSTDIR "$PROGRAMFILES64\Gauge"
    63    ${EndIf}
    64  functionEnd
    65  
    66  Section "Gauge" SEC01
    67    IfFileExists "$INSTDIR\share\gauge\gauge.properties" 0 +3
    68    CreateDirectory $%temp%\Gauge
    69    CopyFiles "$INSTDIR\share\gauge\gauge.properties" "$%temp%\Gauge\gauge.properties.bak"
    70    SectionIn RO
    71    SetOutPath "$INSTDIR"
    72    SetOverwrite on
    73    File /r "${GAUGE_DISTRIBUTABLES_DIR}\*"
    74  SectionEnd
    75  
    76  SectionGroup /e "Language Plugins"
    77    Section "Java" SEC_JAVA
    78    SectionEnd
    79    Section /o "C#" SEC_CSHARP
    80    SectionEnd
    81    Section /o "Ruby" SEC_RUBY
    82    SectionEnd
    83  SectionGroupEnd
    84  
    85  Section -AdditionalIcons
    86    SetOutPath $INSTDIR
    87    CreateDirectory "$SMPROGRAMS\Gauge"
    88    CreateShortCut "$SMPROGRAMS\Gauge\Uninstall.lnk" "$INSTDIR\uninst.exe"
    89  SectionEnd
    90  
    91  Section -Post
    92    WriteUninstaller "$INSTDIR\uninst.exe"
    93    WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\bin\gauge.exe"
    94    WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
    95    WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
    96    WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\bin\gauge.exe"
    97    WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
    98    WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
    99    WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
   100    ${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR\bin"
   101    WriteRegExpandStr ${env_hklm} GAUGE_ROOT $INSTDIR
   102    SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
   103    ExecWait '"$INSTDIR\set_timestamp.bat" "$INSTDIR"'
   104    IfFileExists "$%temp%\Gauge\gauge.properties.bak" 0 +3
   105    CopyFiles "$%temp%\Gauge\gauge.properties.bak" "$INSTDIR\share\gauge"
   106    RMDir /r /REBOOTOK "$%temp%\Gauge"
   107  
   108    IfSilent +2 0
   109      ExecShell "open" "http://getgauge.io/documentation/user/current"
   110    ExecWait '"$INSTDIR\plugin-install.bat" "html-report"'
   111  
   112    SectionGetFlags ${SEC_JAVA} $R0
   113    SectionGetFlags ${SEC_CSHARP} $R1
   114    SectionGetFlags ${SEC_RUBY} $R2
   115  
   116    ${If} $R0 == 1
   117      ExecWait '"$INSTDIR\plugin-install.bat" "java"'
   118    ${EndIf}
   119  
   120    ${If} $R1 == 1
   121      ExecWait '"$INSTDIR\plugin-install.bat" "csharp"'
   122    ${EndIf}
   123  
   124    ${If} $R2 == 1
   125      ExecWait '"$INSTDIR\plugin-install.bat" "ruby"'
   126    ${EndIf}
   127  SectionEnd
   128  
   129  Function un.onUninstSuccess
   130    IfSilent +3 0
   131      HideWindow
   132        MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
   133  FunctionEnd
   134  
   135  Function un.onInit
   136    IfSilent +3 0
   137      MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
   138    Abort
   139  FunctionEnd
   140  
   141  Section Uninstall
   142    Delete "$INSTDIR\uninst.exe"
   143    Delete "$INSTDIR\plugin-install.bat"
   144    RMDir /r "$INSTDIR\bin"
   145    RMDir /r "$INSTDIR\share"
   146    Delete "$SMPROGRAMS\Gauge\Uninstall.lnk"
   147    DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
   148    DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
   149    DeleteRegValue ${env_hklm} GAUGE_ROOT
   150    RMDir "$INSTDIR"
   151    SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
   152    SetAutoClose true
   153  SectionEnd