[7] | 1 | ; T3D Installer
|
---|
| 2 | ;-----------------------------------------------------------------------------------------------------------------------------
|
---|
| 3 |
|
---|
| 4 | !define PRODUCT_NAME "T3D"
|
---|
| 5 | !define AppName "T3D"
|
---|
| 6 | !define AppVersion "1.0"
|
---|
| 7 | !define ShortName "T3D"
|
---|
| 8 | !define Vendor "Software Engineering for Distributed Systems Group, University of G�ttingen"
|
---|
| 9 | !define JRE_VERSION "1.6"
|
---|
| 10 | !define JRE_URL "http://javadl.sun.com/webapps/download/AutoDL?BundleId=26223"
|
---|
| 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 "T3D"
|
---|
| 25 | OutFile "t3d-install-32bit.exe"
|
---|
| 26 |
|
---|
| 27 | InstallDir $PROGRAMFILES\ETSI\T3D
|
---|
| 28 | InstallDirRegKey HKLM "Software\ETSI\T3D" "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 "T3D (required)"
|
---|
| 49 | SectionIn RO
|
---|
| 50 | SetOutPath $INSTDIR
|
---|
| 51 | File "..\dist\t3d.bat"
|
---|
| 52 | File "..\doc\t3d-documentation.pdf"
|
---|
| 53 | SetOutPath $INSTDIR\css
|
---|
| 54 | File "..\css\*.css"
|
---|
| 55 | SetOutPath $INSTDIR\js
|
---|
| 56 | File "..\js\*.js"
|
---|
| 57 | SetOutPath $INSTDIR\xsd
|
---|
| 58 | File "..\xsd\*.*"
|
---|
| 59 | SetOutPath $INSTDIR\xslt
|
---|
| 60 | File "..\xslt\*.xsl"
|
---|
| 61 | SetOutPath $INSTDIR\lib
|
---|
| 62 | File /r "..\dist\lib\*.jar"
|
---|
| 63 | SetOutPath $INSTDIR
|
---|
| 64 |
|
---|
| 65 | ;CreateDirectory $APPDATA\T3D
|
---|
| 66 |
|
---|
| 67 | WriteRegStr HKLM SOFTWARE\ETSI\T3D "Install_Dir" "$INSTDIR"
|
---|
| 68 |
|
---|
| 69 | ${EnvVarUpdate} $0 "T3D_HOME" "A" "HKLM" $INSTDIR
|
---|
| 70 | ${EnvVarUpdate} $0 "PATH" "A" "HKLM" $INSTDIR
|
---|
| 71 |
|
---|
| 72 | ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Development Kit\1.6" "JavaHome"
|
---|
| 73 | StrCmp $2 "" 0 registerJavaHome
|
---|
| 74 | ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment\1.6" "JavaHome"
|
---|
| 75 | StrCmp $2 "" 0 registerJavaHome
|
---|
| 76 | registerJavaHome:
|
---|
| 77 | Push JAVA_HOME
|
---|
| 78 | Push $2
|
---|
| 79 | Call WriteEnvStr
|
---|
| 80 |
|
---|
| 81 | ; Write the uninstall keys for Windows
|
---|
| 82 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${AppName}" "DisplayName" "${AppName}"
|
---|
| 83 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${AppName}" "UninstallString" '"$INSTDIR\uninstall.exe"'
|
---|
| 84 | WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${AppName}" "NoModify" 1
|
---|
| 85 | WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${AppName}" "NoRepair" 1
|
---|
| 86 | WriteUninstaller "uninstall.exe"
|
---|
| 87 | SectionEnd
|
---|
| 88 |
|
---|
| 89 | Section "T3D Sample Files"
|
---|
| 90 | SetOutPath $INSTDIR\samples
|
---|
| 91 |
|
---|
| 92 | File /r /x ".svn" /x ".project" "..\..\t3d-examples\*.*"
|
---|
| 93 | SectionEnd
|
---|
| 94 |
|
---|
| 95 | ;-----------------------------------------------------------------------------------------------------------------------------
|
---|
| 96 | ; Start Menu Section
|
---|
| 97 | Section "Start Menu Shortcuts"
|
---|
| 98 | CreateDirectory "$SMPROGRAMS\${AppName}"
|
---|
| 99 | CreateShortCut "$SMPROGRAMS\${AppName}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
|
---|
| 100 | CreateShortCut "$SMPROGRAMS\${AppName}\T3D Documentation.lnk" "$INSTDIR\t3d-documentation.pdf"
|
---|
| 101 | CreateShortCut "$SMPROGRAMS\${AppName}\T3D Default CSS File.lnk" "$INSTDIR\css\doc.css"
|
---|
| 102 |
|
---|
| 103 | SetOutPath $INSTDIR\samples
|
---|
| 104 | CreateShortCut "$SMPROGRAMS\${AppName}\Samples Folder.lnk" "$INSTDIR\samples"
|
---|
| 105 | ; CreateShortCut "$SMPROGRAMS\${AppName}\T3D Configuration Directory.lnk" "$APPDATA\T3D\"
|
---|
| 106 | CreateShortCut "$SMPROGRAMS\${AppName}\Samples Folder (Command-Line).lnk" "$WINDIR\system32\cmd.exe"
|
---|
| 107 | SectionEnd
|
---|
| 108 |
|
---|
| 109 | ;-----------------------------------------------------------------------------------------------------------------------------
|
---|
| 110 | ; Uninstaller
|
---|
| 111 | Section "Uninstall"
|
---|
| 112 | ; Remove registry keys
|
---|
| 113 | DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${AppName}"
|
---|
| 114 | DeleteRegKey HKLM SOFTWARE\ETSI\${AppName}
|
---|
| 115 |
|
---|
| 116 | MessageBox MB_OKCANCEL|MB_ICONINFORMATION $(ConfirmUninstall) IDOK +2
|
---|
| 117 | Abort
|
---|
| 118 | RMDir /r $INSTDIR
|
---|
| 119 |
|
---|
| 120 | ; Remove shortcuts, if any
|
---|
| 121 | Delete "$SMPROGRAMS\${AppName}\*.*"
|
---|
| 122 |
|
---|
| 123 | ; Remove directories used
|
---|
| 124 | RMDir "$SMPROGRAMS\${AppName}"
|
---|
| 125 | RMDir "$INSTDIR"
|
---|
| 126 | RMDir "$PROGRAMFILES\ETSI"
|
---|
| 127 |
|
---|
| 128 | ; Remove Environment Variables
|
---|
| 129 | ${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" $INSTDIR
|
---|
| 130 | Push T3D_HOME
|
---|
| 131 | Call un.DeleteEnvStr
|
---|
| 132 | Push T3D_HOME
|
---|
| 133 | Call un.DeleteEnvStr
|
---|
| 134 | SectionEnd
|
---|
| 135 |
|
---|
| 136 | ;-----------------------------------------------------------------------------------------------------------------------------
|
---|
| 137 | Function GetJRE
|
---|
| 138 | MessageBox MB_OK "${PRODUCT_NAME} uses Java ${JRE_VERSION}, it will now \
|
---|
| 139 | be downloaded and installed"
|
---|
| 140 |
|
---|
| 141 | StrCpy $2 "$TEMP\Java Runtime Environment.exe"
|
---|
| 142 | nsisdl::download /TIMEOUT=30000 ${JRE_URL} $2
|
---|
| 143 | Pop $R0 ;Get the return value
|
---|
| 144 | StrCmp $R0 "success" +3
|
---|
| 145 | MessageBox MB_OK "Download failed: $R0"
|
---|
| 146 | Quit
|
---|
| 147 | ExecWait $2
|
---|
| 148 | Delete $2
|
---|
| 149 | FunctionEnd
|
---|
| 150 |
|
---|
| 151 | ;-----------------------------------------------------------------------------------------------------------------------------
|
---|
| 152 | Function DetectJRE
|
---|
| 153 | ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" \
|
---|
| 154 | "CurrentVersion"
|
---|
| 155 | StrCmp $2 ${JRE_VERSION} done
|
---|
| 156 |
|
---|
| 157 | Call GetJRE
|
---|
| 158 |
|
---|
| 159 | done:
|
---|
| 160 | FunctionEnd
|
---|
| 161 |
|
---|
| 162 | ;-----------------------------------------------------------------------------------------------------------------------------
|
---|
| 163 | Function .onInstSuccess
|
---|
| 164 | MessageBox MB_OK "You have successfully installed ${PRODUCT_NAME}. You can now use 't3d' on the command-line!"
|
---|
| 165 | FunctionEnd
|
---|
| 166 |
|
---|
| 167 | ;-----------------------------------------------------------------------------------------------------------------------------
|
---|
| 168 | ;Function un.onUninstSuccess
|
---|
| 169 | ; MessageBox MB_OK "You have successfully uninstalled ${PRODUCT_NAME}."
|
---|
| 170 | ;FunctionEnd
|
---|
| 171 |
|
---|
| 172 | ;-----------------------------------------------------------------------------------------------------------------------------
|
---|
| 173 | Function .onInit
|
---|
| 174 | ReadRegStr $R0 HKLM \
|
---|
| 175 | "Software\Microsoft\Windows\CurrentVersion\Uninstall\${AppName}" \
|
---|
| 176 | "UninstallString"
|
---|
| 177 | StrCmp $R0 "" done
|
---|
| 178 |
|
---|
| 179 | MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
|
---|
| 180 | "${AppName} is already installed. $\n$\nClick `OK` to remove the \
|
---|
| 181 | previous version or `Cancel` to cancel this upgrade." \
|
---|
| 182 | IDOK uninst
|
---|
| 183 | Abort
|
---|
| 184 |
|
---|
| 185 | ;Run the uninstaller
|
---|
| 186 | uninst:
|
---|
| 187 | ClearErrors
|
---|
| 188 | ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
|
---|
| 189 |
|
---|
| 190 | IfErrors no_remove_uninstaller
|
---|
| 191 | ;You can either use Delete /REBOOTOK in the uninstaller or add some code
|
---|
| 192 | ;here to remove the uninstaller. Use a registry key to check
|
---|
| 193 | ;whether the user has chosen to uninstall. If you are using an uninstaller
|
---|
| 194 | ;components page, make sure all sections are uninstalled.
|
---|
| 195 | no_remove_uninstaller:
|
---|
| 196 |
|
---|
| 197 | done:
|
---|
| 198 | FunctionEnd |
---|