[7] | 1 | ; T3Q Installer
|
---|
| 2 | ;-----------------------------------------------------------------------------------------------------------------------------
|
---|
| 3 |
|
---|
| 4 | !define PRODUCT_NAME "T3Q"
|
---|
| 5 | !define AppName "T3Q"
|
---|
| 6 | !define AppVersion "1.0"
|
---|
| 7 | !define ShortName "T3Q"
|
---|
| 8 | !define Vendor "Software Engineering for Distributed Systems Group, University of G�ttingen"
|
---|
[59] | 9 | !define JRE_VERSION "1.7"
|
---|
[60] | 10 | !define JRE_URL "http://javadl.sun.com/webapps/download/AutoDL?BundleId=83383"
|
---|
[7] | 11 | !define ALL_USERS
|
---|
| 12 |
|
---|
| 13 | LangString ConfirmUninstall ${LANG_ENGLISH} "All existing \
|
---|
| 14 | files and folders under the $(^Name) installation directory \
|
---|
| 15 | '$INSTDIR' will be removed.$\r$\nThis includes any files and folders \
|
---|
| 16 | that have since been added after the installation of \
|
---|
| 17 | $(^Name).$\r$\n$\r$\nAre you sure you wish to continue?"
|
---|
| 18 |
|
---|
| 19 | !include "MUI2.nsh"
|
---|
| 20 | !include "StrFunc.nsh"
|
---|
| 21 | !include "EnvVarUpdate.nsh"
|
---|
| 22 | !include "WriteEnvStr.nsh"
|
---|
| 23 |
|
---|
| 24 | Name "T3Q"
|
---|
| 25 | OutFile "t3q-install-32bit.exe"
|
---|
| 26 |
|
---|
| 27 | InstallDir $PROGRAMFILES\ETSI\T3Q
|
---|
| 28 | InstallDirRegKey HKLM "Software\ETSI\T3Q" "Install_Dir"
|
---|
| 29 |
|
---|
| 30 | RequestExecutionLevel admin
|
---|
| 31 |
|
---|
| 32 | !define MUI_ABORTWARNING
|
---|
| 33 |
|
---|
| 34 | !insertmacro MUI_PAGE_COMPONENTS
|
---|
| 35 | !insertmacro MUI_PAGE_DIRECTORY
|
---|
| 36 | !insertmacro MUI_PAGE_INSTFILES
|
---|
| 37 | !insertmacro MUI_UNPAGE_CONFIRM
|
---|
| 38 | !insertmacro MUI_UNPAGE_INSTFILES
|
---|
| 39 |
|
---|
| 40 | !insertmacro MUI_LANGUAGE "English"
|
---|
| 41 |
|
---|
| 42 | Section ""
|
---|
| 43 | Call DetectJRE
|
---|
| 44 | SectionEnd
|
---|
| 45 |
|
---|
| 46 | ;-----------------------------------------------------------------------------------------------------------------------------
|
---|
| 47 | ; The stuff to install
|
---|
| 48 | Section "T3Q (required)"
|
---|
| 49 | SectionIn RO
|
---|
| 50 | SetOutPath $INSTDIR
|
---|
| 51 |
|
---|
| 52 | File "..\dist\t3q.bat"
|
---|
| 53 | File "..\doc\t3q-documentation.pdf"
|
---|
| 54 | SetOutPath $INSTDIR\lib
|
---|
| 55 | File /r "..\dist\lib\*.jar"
|
---|
| 56 | SetOutPath $INSTDIR
|
---|
| 57 |
|
---|
| 58 | ; CreateDirectory $APPDATA\T3Q
|
---|
| 59 |
|
---|
| 60 | WriteRegStr HKLM SOFTWARE\ETSI\T3Q "Install_Dir" "$INSTDIR"
|
---|
| 61 |
|
---|
| 62 | ${EnvVarUpdate} $0 "T3Q_HOME" "A" "HKLM" $INSTDIR
|
---|
| 63 | ${EnvVarUpdate} $0 "PATH" "A" "HKLM" $INSTDIR
|
---|
| 64 |
|
---|
[59] | 65 | ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Development Kit\1.7" "JavaHome"
|
---|
[7] | 66 | StrCmp $2 "" 0 registerJavaHome
|
---|
[59] | 67 | ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment\1.7" "JavaHome"
|
---|
[7] | 68 | StrCmp $2 "" 0 registerJavaHome
|
---|
| 69 | registerJavaHome:
|
---|
| 70 | Push JAVA_HOME
|
---|
| 71 | Push $2
|
---|
| 72 | Call WriteEnvStr
|
---|
| 73 |
|
---|
| 74 | ; Write the uninstall keys for Windows
|
---|
| 75 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${AppName}" "DisplayName" "${AppName}"
|
---|
| 76 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${AppName}" "UninstallString" '"$INSTDIR\uninstall.exe"'
|
---|
| 77 | WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${AppName}" "NoModify" 1
|
---|
| 78 | WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${AppName}" "NoRepair" 1
|
---|
| 79 | WriteUninstaller "uninstall.exe"
|
---|
| 80 | SectionEnd
|
---|
| 81 |
|
---|
| 82 | Section "T3Q Sample Files"
|
---|
| 83 | SetOutPath $INSTDIR\samples
|
---|
| 84 |
|
---|
| 85 | File /r /x ".svn" /x ".project" "..\..\t3q-examples\*.*"
|
---|
| 86 | SectionEnd
|
---|
| 87 |
|
---|
| 88 | ;-----------------------------------------------------------------------------------------------------------------------------
|
---|
| 89 | ; Start Menu Section
|
---|
| 90 | Section "Start Menu Shortcuts"
|
---|
| 91 | CreateDirectory "$SMPROGRAMS\${AppName}"
|
---|
| 92 | CreateShortCut "$SMPROGRAMS\${AppName}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
|
---|
| 93 | CreateShortCut "$SMPROGRAMS\${AppName}\T3Q Documentation.lnk" "$INSTDIR\t3q-documentation.pdf"
|
---|
| 94 |
|
---|
| 95 | SetOutPath $INSTDIR\samples
|
---|
| 96 | CreateShortCut "$SMPROGRAMS\${AppName}\Samples Folder.lnk" "$INSTDIR\samples"
|
---|
| 97 | ; CreateShortCut "$SMPROGRAMS\${AppName}\T3Q Configuration Directory.lnk" "$APPDATA\T3Q\"
|
---|
| 98 | CreateShortCut "$SMPROGRAMS\${AppName}\Samples Folder (Command-Line).lnk" "$WINDIR\system32\cmd.exe"
|
---|
| 99 | SectionEnd
|
---|
| 100 |
|
---|
| 101 | ;-----------------------------------------------------------------------------------------------------------------------------
|
---|
| 102 | ; Uninstaller
|
---|
| 103 | Section "Uninstall"
|
---|
| 104 | ; Remove registry keys
|
---|
| 105 | DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${AppName}"
|
---|
| 106 | DeleteRegKey HKLM SOFTWARE\ETSI\${AppName}
|
---|
| 107 |
|
---|
| 108 | MessageBox MB_OKCANCEL|MB_ICONINFORMATION $(ConfirmUninstall) IDOK +2
|
---|
| 109 | Abort
|
---|
| 110 | RMDir /r $INSTDIR
|
---|
| 111 |
|
---|
| 112 | ; Remove shortcuts, if any
|
---|
| 113 | Delete "$SMPROGRAMS\${AppName}\*.*"
|
---|
| 114 |
|
---|
| 115 | ; Remove directories used
|
---|
| 116 | RMDir "$SMPROGRAMS\${AppName}"
|
---|
| 117 | RMDir "$INSTDIR"
|
---|
| 118 | RMDir "$PROGRAMFILES\ETSI"
|
---|
| 119 |
|
---|
| 120 | ; Remove Environment Variables
|
---|
| 121 | ${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" $INSTDIR
|
---|
| 122 | Push T3Q_HOME
|
---|
| 123 | Call un.DeleteEnvStr
|
---|
| 124 | Push T3Q_HOME
|
---|
| 125 | Call un.DeleteEnvStr
|
---|
| 126 | SectionEnd
|
---|
| 127 |
|
---|
| 128 | ;-----------------------------------------------------------------------------------------------------------------------------
|
---|
| 129 | Function GetJRE
|
---|
| 130 | MessageBox MB_OK "${PRODUCT_NAME} uses Java ${JRE_VERSION}, it will now \
|
---|
| 131 | be downloaded and installed"
|
---|
| 132 |
|
---|
| 133 | StrCpy $2 "$TEMP\Java Runtime Environment.exe"
|
---|
| 134 | nsisdl::download /TIMEOUT=30000 ${JRE_URL} $2
|
---|
| 135 | Pop $R0 ;Get the return value
|
---|
| 136 | StrCmp $R0 "success" +3
|
---|
| 137 | MessageBox MB_OK "Download failed: $R0"
|
---|
| 138 | Quit
|
---|
| 139 | ExecWait $2
|
---|
| 140 | Delete $2
|
---|
| 141 | FunctionEnd
|
---|
| 142 |
|
---|
| 143 | ;-----------------------------------------------------------------------------------------------------------------------------
|
---|
| 144 | Function DetectJRE
|
---|
| 145 | ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" \
|
---|
| 146 | "CurrentVersion"
|
---|
| 147 | StrCmp $2 ${JRE_VERSION} done
|
---|
| 148 |
|
---|
| 149 | Call GetJRE
|
---|
| 150 |
|
---|
| 151 | done:
|
---|
| 152 | FunctionEnd
|
---|
| 153 |
|
---|
| 154 | ;-----------------------------------------------------------------------------------------------------------------------------
|
---|
| 155 | Function .onInstSuccess
|
---|
| 156 | MessageBox MB_OK "You have successfully installed ${PRODUCT_NAME}. You can now use 't3q' on the command-line!"
|
---|
| 157 | FunctionEnd
|
---|
| 158 |
|
---|
| 159 | ;-----------------------------------------------------------------------------------------------------------------------------
|
---|
| 160 | ;Function un.onUninstSuccess
|
---|
| 161 | ; MessageBox MB_OK "You have successfully uninstalled ${PRODUCT_NAME}."
|
---|
| 162 | ;FunctionEnd
|
---|
| 163 |
|
---|
| 164 | ;-----------------------------------------------------------------------------------------------------------------------------
|
---|
| 165 | Function .onInit
|
---|
| 166 | ReadRegStr $R0 HKLM \
|
---|
| 167 | "Software\Microsoft\Windows\CurrentVersion\Uninstall\${AppName}" \
|
---|
| 168 | "UninstallString"
|
---|
| 169 | StrCmp $R0 "" done
|
---|
| 170 |
|
---|
| 171 | MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
|
---|
| 172 | "${AppName} is already installed. $\n$\nClick `OK` to remove the \
|
---|
| 173 | previous version or `Cancel` to cancel this upgrade." \
|
---|
| 174 | IDOK uninst
|
---|
| 175 | Abort
|
---|
| 176 |
|
---|
| 177 | ;Run the uninstaller
|
---|
| 178 | uninst:
|
---|
| 179 | ClearErrors
|
---|
| 180 | ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
|
---|
| 181 |
|
---|
| 182 | IfErrors no_remove_uninstaller
|
---|
| 183 | ;You can either use Delete /REBOOTOK in the uninstaller or add some code
|
---|
| 184 | ;here to remove the uninstaller. Use a registry key to check
|
---|
| 185 | ;whether the user has chosen to uninstall. If you are using an uninstaller
|
---|
| 186 | ;components page, make sure all sections are uninstalled.
|
---|
| 187 | no_remove_uninstaller:
|
---|
| 188 |
|
---|
| 189 | done:
|
---|
| 190 | FunctionEnd |
---|