| 1 | ;; |
|---|
| 2 | ;; $Id$ |
|---|
| 3 | ;; |
|---|
| 4 | ;; This file is part of Vidalia, and is subject to the license terms in the |
|---|
| 5 | ;; LICENSE file, found in the top level directory of this distribution. If |
|---|
| 6 | ;; you did not receive the LICENSE file with this file, you may obtain it |
|---|
| 7 | ;; from the Vidalia source package distributed by the Vidalia Project at |
|---|
| 8 | ;; http://www.vidalia-project.net/. No part of Vidalia, including this file, |
|---|
| 9 | ;; may be copied, modified, propagated, or distributed except according to |
|---|
| 10 | ;; the terms described in the LICENSE file. |
|---|
| 11 | ;; |
|---|
| 12 | |
|---|
| 13 | !include "MUI.nsh" |
|---|
| 14 | |
|---|
| 15 | SetCompressor /SOLID lzma |
|---|
| 16 | !packhdr header.dat "upx --best header.dat" |
|---|
| 17 | |
|---|
| 18 | ;--------------------------------- |
|---|
| 19 | ; Global definitions |
|---|
| 20 | !define VIDALIA_NAME "Vidalia" |
|---|
| 21 | !define VIDALIA_EXEC "vidalia.exe" |
|---|
| 22 | !define VIDALIA_APPVERSION "@VERSION@" |
|---|
| 23 | !define VIDALIA_DESC "${VIDALIA_NAME} ${VIDALIA_APPVERSION}" |
|---|
| 24 | |
|---|
| 25 | !define TOR_NAME "Tor" |
|---|
| 26 | !define TOR_EXEC "tor.exe" |
|---|
| 27 | !define TOR_APPVERSION "0.2.0.30" |
|---|
| 28 | !define TOR_DESC "${TOR_NAME} ${TOR_APPVERSION}" |
|---|
| 29 | |
|---|
| 30 | !define PRIVOXY_NAME "Privoxy" |
|---|
| 31 | !define PRIVOXY_EXEC "privoxy.exe" |
|---|
| 32 | !define PRIVOXY_APPVERSION "3.0.6" |
|---|
| 33 | !define PRIVOXY_DESC "${PRIVOXY_NAME} ${PRIVOXY_APPVERSION}" |
|---|
| 34 | |
|---|
| 35 | !define TORBUTTON_NAME "Torbutton" |
|---|
| 36 | !define TORBUTTON_APPVERSION "1.2.0-fx" |
|---|
| 37 | !define TORBUTTON_DESC "${TORBUTTON_NAME} ${TORBUTTON_APPVERSION}" |
|---|
| 38 | |
|---|
| 39 | !define BUNDLE_NAME "Vidalia Bundle" |
|---|
| 40 | !define BUNDLE_APPVERSION "${TOR_APPVERSION}-${VIDALIA_APPVERSION}" |
|---|
| 41 | !define BUNDLE_REVISION "1" |
|---|
| 42 | !define BUNDLE_PRODVERSION "@VER_MAJOR@.@VER_MINOR@.@VER_PATCH@.${BUNDLE_REVISION}" |
|---|
| 43 | !define BUNDLE_DESC "${BUNDLE_NAME} ${BUNDLE_APPVERSION}" |
|---|
| 44 | !define INSTALLFILE "vidalia-bundle-${BUNDLE_APPVERSION}.exe" |
|---|
| 45 | !define UNINSTALLER "Uninstall.exe" |
|---|
| 46 | !define SHORTCUTS "$SMPROGRAMS\${BUNDLE_NAME}" |
|---|
| 47 | |
|---|
| 48 | ;-------------------------------- |
|---|
| 49 | ; Installer file details |
|---|
| 50 | VIAddVersionKey "ProductName" "${BUNDLE_NAME}" |
|---|
| 51 | VIAddVersionKey "Comments" "${BUNDLE_DESC}" |
|---|
| 52 | VIAddVersionKey "FileVersion" "${BUNDLE_APPVERSION}" |
|---|
| 53 | VIAddVersionKey "FileDescription" "${BUNDLE_DESC}" |
|---|
| 54 | VIProductVersion "${BUNDLE_PRODVERSION}" |
|---|
| 55 | |
|---|
| 56 | ;-------------------------------- |
|---|
| 57 | ; Basic installer information |
|---|
| 58 | Name "${BUNDLE_NAME}" |
|---|
| 59 | Caption "$(BundleSetupCaption)" |
|---|
| 60 | BrandingText "${BUNDLE_DESC} (Rev. ${BUNDLE_REVISION})" |
|---|
| 61 | OutFile "${INSTALLFILE}" |
|---|
| 62 | InstallDir "$PROGRAMFILES\Vidalia Bundle" |
|---|
| 63 | InstallDirRegKey HKCU "Software" "${BUNDLE_NAME}" |
|---|
| 64 | SetOverWrite ifnewer |
|---|
| 65 | AutoCloseWindow false |
|---|
| 66 | ShowInstDetails show |
|---|
| 67 | CRCCheck on |
|---|
| 68 | XPStyle on |
|---|
| 69 | |
|---|
| 70 | ;-------------------------------- |
|---|
| 71 | ; MUI Options |
|---|
| 72 | !define MUI_WELCOMEPAGE_TITLE "$(BundleWelcomeTitle)" |
|---|
| 73 | !define MUI_WELCOMEPAGE_TEXT "$(BundleWelcomeText)" |
|---|
| 74 | !define MUI_ABORTWARNING |
|---|
| 75 | !define MUI_FINISHPAGE_NOAUTOCLOSE |
|---|
| 76 | !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\win-install.ico" |
|---|
| 77 | !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\win-uninstall.ico" |
|---|
| 78 | !define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\win.bmp" |
|---|
| 79 | !define MUI_HEADERIMAGE |
|---|
| 80 | !define MUI_FINISHPAGE_TEXT "$(BundleFinishText)" |
|---|
| 81 | !define MUI_FINISHPAGE_RUN |
|---|
| 82 | !define MUI_FINISHPAGE_RUN_FUNCTION CustomFinishFn |
|---|
| 83 | !define MUI_FINISHPAGE_RUN_TEXT "$(BundleRunNow)" |
|---|
| 84 | !define MUI_FINISHPAGE_LINK "$(BundleLinkText)" |
|---|
| 85 | !define MUI_FINISHPAGE_LINK_LOCATION "https://www.torproject.org/docs/tor-doc-win32.html" |
|---|
| 86 | |
|---|
| 87 | ;-------------------------------- |
|---|
| 88 | ; Pages |
|---|
| 89 | !insertmacro MUI_PAGE_WELCOME |
|---|
| 90 | !insertmacro MUI_PAGE_COMPONENTS |
|---|
| 91 | !insertmacro MUI_PAGE_DIRECTORY |
|---|
| 92 | !insertmacro MUI_PAGE_INSTFILES |
|---|
| 93 | !insertmacro MUI_PAGE_FINISH |
|---|
| 94 | |
|---|
| 95 | !insertmacro MUI_UNPAGE_WELCOME |
|---|
| 96 | !insertmacro MUI_UNPAGE_COMPONENTS |
|---|
| 97 | !insertmacro MUI_UNPAGE_CONFIRM |
|---|
| 98 | !insertmacro MUI_UNPAGE_INSTFILES |
|---|
| 99 | !insertmacro MUI_UNPAGE_FINISH |
|---|
| 100 | |
|---|
| 101 | ;-------------------------------- |
|---|
| 102 | ; Available languages |
|---|
| 103 | !insertmacro MUI_LANGUAGE "Czech" |
|---|
| 104 | !insertmacro MUI_LANGUAGE "Dutch" |
|---|
| 105 | !insertmacro MUI_LANGUAGE "English" |
|---|
| 106 | !insertmacro MUI_LANGUAGE "Farsi" |
|---|
| 107 | !insertmacro MUI_LANGUAGE "Finnish" |
|---|
| 108 | !insertmacro MUI_LANGUAGE "French" |
|---|
| 109 | !insertmacro MUI_LANGUAGE "German" |
|---|
| 110 | !insertmacro MUI_LANGUAGE "Hebrew" |
|---|
| 111 | !insertmacro MUI_LANGUAGE "Italian" |
|---|
| 112 | !insertmacro MUI_LANGUAGE "Polish" |
|---|
| 113 | !insertmacro MUI_LANGUAGE "Portuguese" |
|---|
| 114 | !insertmacro MUI_LANGUAGE "Romanian" |
|---|
| 115 | !insertmacro MUI_LANGUAGE "Russian" |
|---|
| 116 | !insertmacro MUI_LANGUAGE "Spanish" |
|---|
| 117 | #!insertmacro MUI_LANGUAGE "SimpChinese" |
|---|
| 118 | !insertmacro MUI_LANGUAGE "Swedish" |
|---|
| 119 | #!insertmacro MUI_LANGUAGE "TradChinese" |
|---|
| 120 | !include "vidalia_cs.nsh" |
|---|
| 121 | !include "vidalia_de.nsh" |
|---|
| 122 | !include "vidalia_en.nsh" |
|---|
| 123 | !include "vidalia_es.nsh" |
|---|
| 124 | !include "vidalia_fa.nsh" |
|---|
| 125 | !include "vidalia_fi.nsh" |
|---|
| 126 | !include "vidalia_fr.nsh" |
|---|
| 127 | !include "vidalia_he.nsh" |
|---|
| 128 | !include "vidalia_it.nsh" |
|---|
| 129 | !include "vidalia_nl.nsh" |
|---|
| 130 | !include "vidalia_pl.nsh" |
|---|
| 131 | !include "vidalia_pt.nsh" |
|---|
| 132 | !include "vidalia_ro.nsh" |
|---|
| 133 | !include "vidalia_ru.nsh" |
|---|
| 134 | !include "vidalia_sv.nsh" |
|---|
| 135 | #!include "vidalia_zh-cn.nsh" |
|---|
| 136 | #!include "vidalia_zh-tw.nsh" |
|---|
| 137 | |
|---|
| 138 | ;-------------------------------- |
|---|
| 139 | ; Install types |
|---|
| 140 | !ifndef NOINSTTYPES ; only if not defined |
|---|
| 141 | InstType "Full" |
|---|
| 142 | InstType "Base" |
|---|
| 143 | ;InstType /COMPONENTSONLYONCUSTOM |
|---|
| 144 | !endif |
|---|
| 145 | |
|---|
| 146 | ;-------------------------------- |
|---|
| 147 | ; Vidalia |
|---|
| 148 | Var configfile |
|---|
| 149 | var bInstallVidalia |
|---|
| 150 | SectionGroup "${VIDALIA_DESC}" VidaliaGroup |
|---|
| 151 | ;-------------------------------- |
|---|
| 152 | ; Vidalia application binaries |
|---|
| 153 | Section "${VIDALIA_NAME}" Vidalia |
|---|
| 154 | SectionIn 1 2 |
|---|
| 155 | |
|---|
| 156 | ; Set output path to the installation directory. |
|---|
| 157 | SetOutPath "$INSTDIR\Vidalia" |
|---|
| 158 | File "Vidalia\${VIDALIA_APPVERSION}\${VIDALIA_EXEC}" |
|---|
| 159 | File "Vidalia\${VIDALIA_APPVERSION}\mingwm10.dll" |
|---|
| 160 | File "Vidalia\${VIDALIA_APPVERSION}\QtCore4.dll" |
|---|
| 161 | File "Vidalia\${VIDALIA_APPVERSION}\QtGui4.dll" |
|---|
| 162 | File "Vidalia\${VIDALIA_APPVERSION}\QtNetwork4.dll" |
|---|
| 163 | File "Vidalia\${VIDALIA_APPVERSION}\QtXml4.dll" |
|---|
| 164 | File "Vidalia\${VIDALIA_APPVERSION}\ssleay32.dll" |
|---|
| 165 | File "Vidalia\${VIDALIA_APPVERSION}\README" |
|---|
| 166 | File "Vidalia\${VIDALIA_APPVERSION}\CHANGELOG" |
|---|
| 167 | File "Vidalia\${VIDALIA_APPVERSION}\LICENSE" |
|---|
| 168 | File "Vidalia\${VIDALIA_APPVERSION}\LICENSE-GPLV2" |
|---|
| 169 | File "Vidalia\${VIDALIA_APPVERSION}\LICENSE-GPLV3" |
|---|
| 170 | File "Vidalia\${VIDALIA_APPVERSION}\LICENSE-LGPLV3" |
|---|
| 171 | File "Vidalia\${VIDALIA_APPVERSION}\LICENSE-OPENSSL" |
|---|
| 172 | File "Vidalia\${VIDALIA_APPVERSION}\CREDITS" |
|---|
| 173 | |
|---|
| 174 | ; Include a prebuilt GeoIP cache |
|---|
| 175 | SetShellVarContext current |
|---|
| 176 | CreateDirectory "$APPDATA\Vidalia" |
|---|
| 177 | SetOutPath "$APPDATA\Vidalia" |
|---|
| 178 | File "Vidalia\${VIDALIA_APPVERSION}\geoip-cache" |
|---|
| 179 | |
|---|
| 180 | ;If there's already a torrc config file, ask if they want to |
|---|
| 181 | ;overwrite it with the new one. |
|---|
| 182 | StrCpy $configfile "torrc" |
|---|
| 183 | IfFileExists "$APPDATA\Vidalia\torrc" "" endiftorrc |
|---|
| 184 | MessageBox MB_ICONQUESTION|MB_YESNO "$(TorAskOverwriteTorrc)" IDNO noreplace |
|---|
| 185 | Delete "$APPDATA\Vidalia\torrc" |
|---|
| 186 | Goto endiftorrc |
|---|
| 187 | noreplace: |
|---|
| 188 | StrCpy $configfile "torrc.sample" |
|---|
| 189 | endiftorrc: |
|---|
| 190 | File /oname=$configfile "tor\${TOR_APPVERSION}\torrc.sample" |
|---|
| 191 | |
|---|
| 192 | ; Tor gets installed to $INSTDIR\Tor, so let's remember it |
|---|
| 193 | ; But first, we have to replace all the '\'s with '\\'s in the $INSTDIR |
|---|
| 194 | ; Does NSIS make this easy by providing the ability to replace substrings? No. |
|---|
| 195 | Push $INSTDIR |
|---|
| 196 | Push "\" |
|---|
| 197 | Push "\\" |
|---|
| 198 | Call StrRep |
|---|
| 199 | Pop $R0 ; contains the modified version of $INSTDIR |
|---|
| 200 | WriteINIStr "$APPDATA\Vidalia\vidalia.conf" Tor TorExecutable "$R0\\Tor\\${TOR_EXEC}" |
|---|
| 201 | WriteINIStr "$APPDATA\Vidalia\vidalia.conf" General LanguageCode "$(LanguageCode)" |
|---|
| 202 | |
|---|
| 203 | ; Write the uninstall keys for Windows |
|---|
| 204 | SetShellVarContext all |
|---|
| 205 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Vidalia" "DisplayName" "${VIDALIA_DESC}" |
|---|
| 206 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Vidalia" "UninstallString" '"$INSTDIR\${UNINSTALLER}"' |
|---|
| 207 | WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Vidalia" "NoModify" 1 |
|---|
| 208 | WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Vidalia" "NoRepair" 1 |
|---|
| 209 | |
|---|
| 210 | IntOp $bInstallVidalia 0 + 1 |
|---|
| 211 | SectionEnd |
|---|
| 212 | |
|---|
| 213 | ;-------------------------------- |
|---|
| 214 | ; Vidalia Start menu shortcuts |
|---|
| 215 | Section "$(VidaliaShortcuts)" VidaliaShortcuts |
|---|
| 216 | SectionIn 1 |
|---|
| 217 | SetShellVarContext all ; (Add to "All Users" Start Menu if possible) |
|---|
| 218 | CreateDirectory "${SHORTCUTS}" |
|---|
| 219 | CreateShortCut "${SHORTCUTS}\Uninstall.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\${UNINSTALLER}" 0 |
|---|
| 220 | CreateShortCut "${SHORTCUTS}\Vidalia.lnk" "$INSTDIR\Vidalia\${VIDALIA_EXEC}" "" "$INSTDIR\Vidalia\${VIDALIA_EXEC}" 0 |
|---|
| 221 | |
|---|
| 222 | WriteIniStr "$INSTDIR\Vidalia\Vidalia Website.url" "InternetShortcut" "URL" "http://www.vidalia-project.net" |
|---|
| 223 | CreateShortCut "${SHORTCUTS}\Vidalia Website.lnk" "$INSTDIR\Vidalia\Vidalia Website.url" |
|---|
| 224 | SectionEnd |
|---|
| 225 | |
|---|
| 226 | ;-------------------------------- |
|---|
| 227 | ; Run Vidalia at startup |
|---|
| 228 | Section "$(VidaliaStartup)" VidaliaStartup |
|---|
| 229 | SectionIn 1 |
|---|
| 230 | WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "${VIDALIA_NAME}" '"$INSTDIR\Vidalia\${VIDALIA_EXEC}"' |
|---|
| 231 | SectionEnd |
|---|
| 232 | SectionGroupEnd |
|---|
| 233 | |
|---|
| 234 | |
|---|
| 235 | ;-------------------------------- |
|---|
| 236 | ; Tor |
|---|
| 237 | var bInstallTor |
|---|
| 238 | SectionGroup "${TOR_DESC}" TorGroup |
|---|
| 239 | ;-------------------------------- |
|---|
| 240 | ; Tor application binaries |
|---|
| 241 | Section "${TOR_NAME}" Tor |
|---|
| 242 | ;Files that have to be installed for tor to run and that the user |
|---|
| 243 | ;cannot choose not to install |
|---|
| 244 | SectionIn 1 2 |
|---|
| 245 | SetShellVarContext current |
|---|
| 246 | SetOutPath "$INSTDIR\Tor" |
|---|
| 247 | File "tor\${TOR_APPVERSION}\tor.exe" |
|---|
| 248 | File "tor\${TOR_APPVERSION}\tor-resolve.exe" |
|---|
| 249 | WriteIniStr "$INSTDIR\Tor\Tor Website.url" "InternetShortcut" "URL" "https://www.torproject.org" |
|---|
| 250 | |
|---|
| 251 | ; If the user is also installing Vidalia, then don't confuse them by |
|---|
| 252 | ; an extra torrc in %APPDATA%\Tor |
|---|
| 253 | SectionGetFlags ${Vidalia} $0 |
|---|
| 254 | IntOp $0 $0 & ${SF_SELECTED} |
|---|
| 255 | IntCmp $0 ${SF_SELECTED} skiptorrc |
|---|
| 256 | |
|---|
| 257 | StrCpy $configfile "torrc" |
|---|
| 258 | SetOutPath "$APPDATA\Tor" |
|---|
| 259 | |
|---|
| 260 | ; If there's already a torrc config file, ask if they want to |
|---|
| 261 | ; overwrite it with the new one. |
|---|
| 262 | IfFileExists "$APPDATA\Tor\torrc" "" endiftorrc |
|---|
| 263 | MessageBox MB_ICONQUESTION|MB_YESNO "$(TorAskOverwriteTorrc)" IDNO noreplace |
|---|
| 264 | Delete "$APPDATA\Tor\torrc" |
|---|
| 265 | Goto endiftorrc |
|---|
| 266 | noreplace: |
|---|
| 267 | StrCpy $configfile "torrc.sample" |
|---|
| 268 | endiftorrc: |
|---|
| 269 | File /oname=$configfile "tor\${TOR_APPVERSION}\torrc.sample" |
|---|
| 270 | |
|---|
| 271 | skiptorrc: |
|---|
| 272 | ; Write the uninstall keys for Windows |
|---|
| 273 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tor" "DisplayName" "${TOR_DESC}" |
|---|
| 274 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tor" "UninstallString" '"$INSTDIR\${UNINSTALLER}"' |
|---|
| 275 | WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tor" "NoModify" 1 |
|---|
| 276 | WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tor" "NoRepair" 1 |
|---|
| 277 | |
|---|
| 278 | IntOp $bInstallTor 0 + 1 |
|---|
| 279 | SectionEnd |
|---|
| 280 | |
|---|
| 281 | ;-------------------------------- |
|---|
| 282 | ; Tor documentation |
|---|
| 283 | Section "$(TorDocumentation)" TorDocs |
|---|
| 284 | SectionIn 1 |
|---|
| 285 | SetOutPath "$INSTDIR\Tor\Documents" |
|---|
| 286 | File "tor\${TOR_APPVERSION}\Documents\*.*" |
|---|
| 287 | SectionEnd |
|---|
| 288 | |
|---|
| 289 | ;-------------------------------- |
|---|
| 290 | ; Tor Start menu shortcuts |
|---|
| 291 | Section "$(TorShortcuts)" TorShortcuts |
|---|
| 292 | SectionIn 1 |
|---|
| 293 | SetShellVarContext all ; (Add to "All Users" Start Menu if possible) |
|---|
| 294 | SetOutPath "$INSTDIR\Tor" |
|---|
| 295 | IfFileExists "${SHORTCUTS}\Tor\*.*" "" +2 |
|---|
| 296 | RMDir /r "${SHORTCUTS}\Tor" |
|---|
| 297 | |
|---|
| 298 | CreateDirectory "${SHORTCUTS}\Tor" |
|---|
| 299 | CreateShortCut "${SHORTCUTS}\Tor\Tor.lnk" "$INSTDIR\Tor\tor.exe" |
|---|
| 300 | CreateShortCut "${SHORTCUTS}\Tor\Tor Website.lnk" "$INSTDIR\Tor\Tor Website.url" |
|---|
| 301 | CreateShortCut "${SHORTCUTS}\Uninstall.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\${UNINSTALLER}" 0 |
|---|
| 302 | |
|---|
| 303 | IfFileExists "$INSTDIR\Tor\Documents\*.*" "" endifdocs |
|---|
| 304 | CreateDirectory "${SHORTCUTS}\Tor\Documents" |
|---|
| 305 | CreateShortCut "${SHORTCUTS}\Tor\Documents\Tor Manual.lnk" "$INSTDIR\Tor\Documents\tor-reference.html" |
|---|
| 306 | CreateShortCut "${SHORTCUTS}\Tor\Documents\Tor Documentation.lnk" "$INSTDIR\Tor\Documents" |
|---|
| 307 | CreateShortCut "${SHORTCUTS}\Tor\Documents\Tor Specification.lnk" "$INSTDIR\Tor\Documents\tor-spec.txt" |
|---|
| 308 | endifdocs: |
|---|
| 309 | |
|---|
| 310 | ; If the user is installing Vidalia, then make the shortcut link to |
|---|
| 311 | ; %APPDATA%\Vidalia\torrc instead of %APPDATA%\Tor\torrc |
|---|
| 312 | SetShellVarContext current |
|---|
| 313 | SectionGetFlags ${Vidalia} $0 |
|---|
| 314 | IntOp $0 $0 & ${SF_SELECTED} |
|---|
| 315 | IntCmp $0 ${SF_SELECTED} use_vidalia_torrc use_tor_torrc |
|---|
| 316 | use_vidalia_torrc: |
|---|
| 317 | StrCpy $configfile "$APPDATA\Vidalia\torrc" |
|---|
| 318 | goto torrc_shortcut |
|---|
| 319 | use_tor_torrc: |
|---|
| 320 | StrCpy $configfile "$APPDATA\Tor\torrc" |
|---|
| 321 | torrc_shortcut: |
|---|
| 322 | SetShellVarContext all |
|---|
| 323 | CreateShortCut "${SHORTCUTS}\Tor\Torrc.lnk" "Notepad.exe" $configfile |
|---|
| 324 | SectionEnd |
|---|
| 325 | SectionGroupEnd |
|---|
| 326 | |
|---|
| 327 | |
|---|
| 328 | ;-------------------------------- |
|---|
| 329 | ; Privoxy |
|---|
| 330 | var bInstallPrivoxy |
|---|
| 331 | SectionGroup "${PRIVOXY_DESC}" PrivoxyGroup |
|---|
| 332 | ;-------------------------------- |
|---|
| 333 | ; Privoxy application binaries |
|---|
| 334 | Section "${PRIVOXY_NAME}" Privoxy |
|---|
| 335 | SectionIn 1 2 |
|---|
| 336 | ; add files / whatever that need to be installed here. |
|---|
| 337 | SetOutPath "$INSTDIR\Privoxy" |
|---|
| 338 | File /r Privoxy\${PRIVOXY_APPVERSION}\*.* |
|---|
| 339 | |
|---|
| 340 | WriteRegStr HKEY_CLASSES_ROOT "PrivoxyActionFile\shell\open\command" "" 'Notepad.exe "%1"' |
|---|
| 341 | WriteRegStr HKEY_CLASSES_ROOT ".action" "" "PrivoxyActionFile" |
|---|
| 342 | WriteRegStr HKEY_CLASSES_ROOT "PrivoxyFilterFile\shell\open\command" "" 'Notepad.exe "%1"' |
|---|
| 343 | WriteRegStr HKEY_CLASSES_ROOT ".filter" "" "PrivoxyFilterFile" |
|---|
| 344 | |
|---|
| 345 | ; Write the installation path into the registry |
|---|
| 346 | WriteRegStr HKCU SOFTWARE\Privoxy "Install_Dir" "$INSTDIR" |
|---|
| 347 | |
|---|
| 348 | ; Write the uninstall keys for Windows |
|---|
| 349 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Privoxy" "DisplayName" "${PRIVOXY_DESC}" |
|---|
| 350 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Privoxy" "UninstallString" '"$INSTDIR\${UNINSTALLER}"' |
|---|
| 351 | WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Privoxy" "NoModify" 1 |
|---|
| 352 | WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Privoxy" "NoRepair" 1 |
|---|
| 353 | |
|---|
| 354 | IntOp $bInstallPrivoxy 0 + 1 |
|---|
| 355 | SectionEnd |
|---|
| 356 | |
|---|
| 357 | ;-------------------------------- |
|---|
| 358 | ; Privoxy Start menu shortcuts |
|---|
| 359 | Section "$(PrivoxyShortcuts)" PrivoxyShortcuts |
|---|
| 360 | SectionIn 1 |
|---|
| 361 | SetShellVarContext all ; (Add to "All Users" Start Menu if possible) |
|---|
| 362 | RMDir /r "${SHORTCUTS}\Privoxy" |
|---|
| 363 | CreateDirectory "${SHORTCUTS}\Privoxy" |
|---|
| 364 | CreateShortCut "${SHORTCUTS}\Privoxy\Privoxy.lnk" "$INSTDIR\Privoxy\privoxy.exe" |
|---|
| 365 | CreateShortCut "${SHORTCUTS}\Privoxy\Web-based Feedback.lnk" "$INSTDIR\Privoxy\doc\user-manual\contact.html" |
|---|
| 366 | WriteINIStr "${SHORTCUTS}\Privoxy\Web-based Configuration.url" "InternetShortcut" "URL" "http://config.privoxy.org/" |
|---|
| 367 | |
|---|
| 368 | CreateDirectory "${SHORTCUTS}\Privoxy\Edit Config" |
|---|
| 369 | CreateShortCut "${SHORTCUTS}\Privoxy\Edit Config\Main Configuration.lnk" "Notepad.exe" '"$INSTDIR\Privoxy\config.txt"' |
|---|
| 370 | CreateShortCut "${SHORTCUTS}\Privoxy\Edit Config\Default Actions.lnk" "Notepad.exe" '"$INSTDIR\Privoxy\default.action"' |
|---|
| 371 | CreateShortCut "${SHORTCUTS}\Privoxy\Edit Config\User Actions.lnk" "Notepad.exe" '"$INSTDIR\Privoxy\user.action"' |
|---|
| 372 | CreateShortCut "${SHORTCUTS}\Privoxy\Edit Config\Filters.lnk" "Notepad.exe" '"$INSTDIR\Privoxy\default.filter"' |
|---|
| 373 | CreateShortCut "${SHORTCUTS}\Privoxy\Edit Config\Trust list.lnk" "Notepad.exe" '"$INSTDIR\Privoxy\trust.txt"' |
|---|
| 374 | |
|---|
| 375 | CreateDirectory "${SHORTCUTS}\Privoxy\Documentation" |
|---|
| 376 | CreateShortCut "${SHORTCUTS}\Privoxy\Documentation\User Manual.lnk" "$INSTDIR\Privoxy\doc\user-manual\index.html" |
|---|
| 377 | CreateShortCut "${SHORTCUTS}\Privoxy\Documentation\Frequently Asked Questions.lnk" "$INSTDIR\Privoxy\doc\faq\index.html" |
|---|
| 378 | CreateShortCut "${SHORTCUTS}\Privoxy\Documentation\Credits.lnk" "Notepad.exe" '"$INSTDIR\Privoxy\AUTHORS.txt"' |
|---|
| 379 | CreateShortCut "${SHORTCUTS}\Privoxy\Documentation\License.lnk" "Notepad.exe" '"$INSTDIR\Privoxy\LICENSE.txt"' |
|---|
| 380 | CreateShortCut "${SHORTCUTS}\Privoxy\Documentation\ReadMe file.lnk" "Notepad.exe" '"$INSTDIR\Privoxy\README.txt"' |
|---|
| 381 | WriteINIStr "$SMPROGRAMS\Privoxy\Documentation\Web Site.url" "InternetShortcut" "URL" "http://privoxy.org/" |
|---|
| 382 | |
|---|
| 383 | CreateShortCut "${SHORTCUTS}\Uninstall.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\${UNINSTALLER}" 0 |
|---|
| 384 | SectionEnd |
|---|
| 385 | |
|---|
| 386 | ;-------------------------------- |
|---|
| 387 | ; Run Privoxy at startup |
|---|
| 388 | Section "$(PrivoxyStartup)" PrivoxyStartup |
|---|
| 389 | SectionIn 1 |
|---|
| 390 | CreateShortCut "$SMSTARTUP\Privoxy.lnk" "$INSTDIR\Privoxy\privoxy.exe" "" "" 0 SW_SHOWMINIMIZED |
|---|
| 391 | SectionEnd |
|---|
| 392 | SectionGroupEnd |
|---|
| 393 | |
|---|
| 394 | ;-------------------------------- |
|---|
| 395 | ; Torbutton |
|---|
| 396 | SectionGroup "${TORBUTTON_DESC}" TorbuttonGroup |
|---|
| 397 | Section "${TORBUTTON_NAME}" Torbutton |
|---|
| 398 | SectionIn 1 2 |
|---|
| 399 | SetOutPath "$INSTDIR\Torbutton" |
|---|
| 400 | File torbutton\${TORBUTTON_APPVERSION}\LICENSE |
|---|
| 401 | File torbutton\${TORBUTTON_APPVERSION}\torbutton-${TORBUTTON_APPVERSION}.xpi |
|---|
| 402 | SectionEnd |
|---|
| 403 | |
|---|
| 404 | Section "$(TorbuttonAddToFirefox)" TorbuttonAddToFirefox |
|---|
| 405 | SectionIn 1 2 |
|---|
| 406 | ReadRegStr $1 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe" "" |
|---|
| 407 | StrCmp $1 "" FirefoxNotFound 0 ; if Path is empty or null, then skip to an error, otherwise proceed |
|---|
| 408 | Exec '"$1" "$INSTDIR\Torbutton\torbutton-${TORBUTTON_APPVERSION}.xpi"' |
|---|
| 409 | Goto TorbuttonInstalled |
|---|
| 410 | FirefoxNotFound: |
|---|
| 411 | MessageBox MB_OK|MB_ICONSTOP "$(TorbuttonFirefoxNotFound)" |
|---|
| 412 | TorbuttonInstalled: |
|---|
| 413 | SectionEnd |
|---|
| 414 | SectionGroupEnd |
|---|
| 415 | |
|---|
| 416 | Section "" end |
|---|
| 417 | SetOutPath "$INSTDIR" |
|---|
| 418 | WriteUninstaller "$INSTDIR\${UNINSTALLER}" |
|---|
| 419 | SectionEnd |
|---|
| 420 | |
|---|
| 421 | ;-------------------------------- |
|---|
| 422 | ; Functions |
|---|
| 423 | Function .onInit |
|---|
| 424 | !insertmacro MUI_LANGDLL_DISPLAY |
|---|
| 425 | FunctionEnd |
|---|
| 426 | |
|---|
| 427 | Function .onSelChange |
|---|
| 428 | Push $0 |
|---|
| 429 | |
|---|
| 430 | ; Check if the Torbutton option was unchecked |
|---|
| 431 | SectionGetFlags ${Torbutton} $0 |
|---|
| 432 | IntOp $0 $0 & ${SF_SELECTED} |
|---|
| 433 | IntCmp $0 0 0 SelChangeDone SelChangeDone |
|---|
| 434 | |
|---|
| 435 | ; Uncheck the "Add to Firefox" box |
|---|
| 436 | SectionGetFlags ${TorbuttonAddToFirefox} $0 |
|---|
| 437 | IntOp $0 $0 & ${SECTION_OFF} |
|---|
| 438 | SectionSetFlags ${TorbuttonAddToFirefox} $0 |
|---|
| 439 | |
|---|
| 440 | SelChangeDone: |
|---|
| 441 | Pop $0 |
|---|
| 442 | FunctionEnd |
|---|
| 443 | |
|---|
| 444 | Function CustomFinishFn |
|---|
| 445 | IntCmp $bInstallVidalia 1 run_vidalia check_tor check_tor |
|---|
| 446 | run_vidalia: |
|---|
| 447 | Exec '"$INSTDIR\Vidalia\${VIDALIA_EXEC}"' |
|---|
| 448 | goto check_privoxy |
|---|
| 449 | |
|---|
| 450 | check_tor: |
|---|
| 451 | IntCmp $bInstallTor 1 run_tor check_privoxy check_privoxy |
|---|
| 452 | run_tor: |
|---|
| 453 | Exec '"$INSTDIR\Tor\${TOR_EXEC}"' |
|---|
| 454 | |
|---|
| 455 | check_privoxy: |
|---|
| 456 | IntCmp $bInstallPrivoxy 1 run_privoxy done done |
|---|
| 457 | run_privoxy: |
|---|
| 458 | SetOutPath "$INSTDIR\Privoxy" |
|---|
| 459 | ExecShell "" '"$INSTDIR\Privoxy\${PRIVOXY_EXEC}"' "" SW_SHOWMINIMIZED |
|---|
| 460 | done: |
|---|
| 461 | FunctionEnd |
|---|
| 462 | |
|---|
| 463 | ;------------------------- |
|---|
| 464 | ; Uninstaller |
|---|
| 465 | Section "-Uninstall" Uninstall |
|---|
| 466 | SectionEnd |
|---|
| 467 | |
|---|
| 468 | SectionGroup "un.Tor ${TOR_APPVERSION}" UninstallTorGroup |
|---|
| 469 | Section "un.Tor" UninstallTor |
|---|
| 470 | SetShellVarContext all |
|---|
| 471 | RMDir /r "$INSTDIR\Tor" |
|---|
| 472 | RMDir /r "${SHORTCUTS}\Tor" |
|---|
| 473 | DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Tor" |
|---|
| 474 | SectionEnd |
|---|
| 475 | |
|---|
| 476 | Section "un.$(AppData)" UninstallTorAppData |
|---|
| 477 | SetShellVarContext current |
|---|
| 478 | RMDir /r "$APPDATA\Tor" |
|---|
| 479 | SectionEnd |
|---|
| 480 | SectionGroupEnd |
|---|
| 481 | |
|---|
| 482 | SectionGroup "un.Vidalia ${VIDALIA_APPVERSION}" UninstallVidaliaGroup |
|---|
| 483 | Section "un.Vidalia" UninstallVidalia |
|---|
| 484 | SetShellVarContext all |
|---|
| 485 | RMDir /r "$INSTDIR\Vidalia" |
|---|
| 486 | Delete "${SHORTCUTS}\Vidalia.lnk" |
|---|
| 487 | Delete "${SHORTCUTS}\Vidalia Website.lnk" |
|---|
| 488 | DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Run\Vidalia" |
|---|
| 489 | DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Vidalia" |
|---|
| 490 | SectionEnd |
|---|
| 491 | |
|---|
| 492 | Section "un.$(AppData)" UninstallVidaliaAppData |
|---|
| 493 | SetShellVarContext current |
|---|
| 494 | RMDir /r "$APPDATA\Vidalia" |
|---|
| 495 | SectionEnd |
|---|
| 496 | SectionGroupEnd |
|---|
| 497 | |
|---|
| 498 | Section "un.Privoxy ${PRIVOXY_APPVERSION}" UninstallPrivoxy |
|---|
| 499 | SetShellVarContext all |
|---|
| 500 | RMDir /r "$INSTDIR\Privoxy" |
|---|
| 501 | RMDir /r "${SHORTCUTS}\Privoxy" |
|---|
| 502 | Delete "$SMSTARTUP\Privoxy.lnk" |
|---|
| 503 | DeleteRegKey HKEY_CLASSES_ROOT ".action" |
|---|
| 504 | DeleteRegKey HKEY_CLASSES_ROOT "PrivoxyActionFile" |
|---|
| 505 | DeleteRegKey HKEY_CLASSES_ROOT ".filter" |
|---|
| 506 | DeleteRegKey HKEY_CLASSES_ROOT "PrivoxyFilterFile" |
|---|
| 507 | DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Privoxy" |
|---|
| 508 | SectionEnd |
|---|
| 509 | |
|---|
| 510 | ; XXX: We still need to find a way to actually remove Torbutton from Firefox |
|---|
| 511 | ;Section "un.Torbutton ${TORBUTTON_APPVERSION}" UninstallTorbutton |
|---|
| 512 | ; RMDir /r "$INSTDIR\Torbutton" |
|---|
| 513 | ; DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Tor" |
|---|
| 514 | ;SectionEnd |
|---|
| 515 | |
|---|
| 516 | Function un.onInit |
|---|
| 517 | !insertmacro MUI_LANGDLL_DISPLAY |
|---|
| 518 | SetShellVarContext current |
|---|
| 519 | |
|---|
| 520 | IfFileExists "$INSTDIR\Tor\*.*" CheckTorAppData |
|---|
| 521 | SectionGetFlags ${UninstallTor} $0 |
|---|
| 522 | IntOp $0 $0 & ${SECTION_OFF} |
|---|
| 523 | SectionSetFlags ${UninstallTor} $0 |
|---|
| 524 | |
|---|
| 525 | CheckTorAppData: |
|---|
| 526 | IfFileExists "$APPDATA\Tor\*.*" CheckVidalia |
|---|
| 527 | SectionGetFlags ${UninstallTorAppData} $0 |
|---|
| 528 | IntOp $0 $0 & ${SECTION_OFF} |
|---|
| 529 | SectionSetFlags ${UninstallTorAppData} $0 |
|---|
| 530 | |
|---|
| 531 | CheckVidalia: |
|---|
| 532 | IfFileExists "$INSTDIR\Vidalia\*.*" CheckVidaliaAppData |
|---|
| 533 | SectionGetFlags ${UninstallVidalia} $0 |
|---|
| 534 | IntOp $0 $0 & ${SECTION_OFF} |
|---|
| 535 | SectionSetFlags ${UninstallVidalia} $0 |
|---|
| 536 | |
|---|
| 537 | CheckVidaliaAppData: |
|---|
| 538 | IfFileExists "$APPDATA\Vidalia\*.*" CheckPrivoxy |
|---|
| 539 | SectionGetFlags ${UninstallVidaliaAppData} $0 |
|---|
| 540 | IntOp $0 $0 & ${SECTION_OFF} |
|---|
| 541 | SectionSetFlags ${UninstallVidaliaAppData} $0 |
|---|
| 542 | |
|---|
| 543 | CheckPrivoxy: |
|---|
| 544 | IfFileExists "$INSTDIR\Privoxy\*.*" Done |
|---|
| 545 | SectionGetFlags ${UninstallPrivoxy} $0 |
|---|
| 546 | IntOp $0 $0 & ${SECTION_OFF} |
|---|
| 547 | SectionSetFlags ${UninstallPrivoxy} $0 |
|---|
| 548 | |
|---|
| 549 | Done: |
|---|
| 550 | FunctionEnd |
|---|
| 551 | |
|---|
| 552 | Function un.onUninstSuccess |
|---|
| 553 | SetShellVarContext all |
|---|
| 554 | IfFileExists "$INSTDIR\Tor\*.*" DontRemoveTheUninstaller |
|---|
| 555 | IfFileExists "$INSTDIR\Vidalia\*.*" DontRemoveTheUninstaller |
|---|
| 556 | IfFileExists "$INSTDIR\Privoxy\*.*" DontRemoveTheUninstaller |
|---|
| 557 | RMDir /r "$INSTDIR" |
|---|
| 558 | RMDir /r "${SHORTCUTS}" |
|---|
| 559 | DontRemoveTheUninstaller: |
|---|
| 560 | FunctionEnd |
|---|
| 561 | |
|---|
| 562 | !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN |
|---|
| 563 | !insertmacro MUI_DESCRIPTION_TEXT ${Tor} "$(TorAppDesc)" |
|---|
| 564 | !insertmacro MUI_DESCRIPTION_TEXT ${TorGroup} "$(TorGroupDesc)" |
|---|
| 565 | !insertmacro MUI_DESCRIPTION_TEXT ${TorDocs} "$(TorDocumentationDesc)" |
|---|
| 566 | !insertmacro MUI_DESCRIPTION_TEXT ${TorShortcuts} "$(TorShortcutsDesc)" |
|---|
| 567 | |
|---|
| 568 | !insertmacro MUI_DESCRIPTION_TEXT ${Vidalia} "$(VidaliaAppDesc)" |
|---|
| 569 | !insertmacro MUI_DESCRIPTION_TEXT ${VidaliaGroup} "$(VidaliaGroupDesc)" |
|---|
| 570 | !insertmacro MUI_DESCRIPTION_TEXT ${VidaliaStartup} "$(VidaliaStartupDesc)" |
|---|
| 571 | !insertmacro MUI_DESCRIPTION_TEXT ${VidaliaShortcuts} "$(VidaliaShortcutsDesc)" |
|---|
| 572 | |
|---|
| 573 | !insertmacro MUI_DESCRIPTION_TEXT ${Privoxy} "$(PrivoxyAppDesc)" |
|---|
| 574 | !insertmacro MUI_DESCRIPTION_TEXT ${PrivoxyGroup} "$(PrivoxyGroupDesc)" |
|---|
| 575 | !insertmacro MUI_DESCRIPTION_TEXT ${PrivoxyStartup} "$(PrivoxyStartupDesc)" |
|---|
| 576 | !insertmacro MUI_DESCRIPTION_TEXT ${PrivoxyShortcuts} "$(PrivoxyShortcutsDesc)" |
|---|
| 577 | |
|---|
| 578 | !insertmacro MUI_DESCRIPTION_TEXT ${Torbutton} "$(TorbuttonAppDesc)" |
|---|
| 579 | !insertmacro MUI_DESCRIPTION_TEXT ${TorbuttonGroup} "$(TorbuttonGroupDesc)" |
|---|
| 580 | !insertmacro MUI_DESCRIPTION_TEXT ${TorbuttonAddToFirefox} "$(TorbuttonAddToFirefoxDesc)" |
|---|
| 581 | !insertmacro MUI_FUNCTION_DESCRIPTION_END |
|---|
| 582 | |
|---|
| 583 | !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN |
|---|
| 584 | !insertmacro MUI_DESCRIPTION_TEXT ${UninstallTor} "$(TorUninstDesc)" |
|---|
| 585 | !insertmacro MUI_DESCRIPTION_TEXT ${UninstallTorAppData} "$(AppDataUninstDesc)" |
|---|
| 586 | !insertmacro MUI_DESCRIPTION_TEXT ${UninstallVidalia} "$(VidaliaUninstDesc)" |
|---|
| 587 | !insertmacro MUI_DESCRIPTION_TEXT ${UninstallVidaliaAppData} "$(AppDataUninstDesc)" |
|---|
| 588 | !insertmacro MUI_DESCRIPTION_TEXT ${UninstallPrivoxy} "$(PrivoxyUninstDesc)" |
|---|
| 589 | !insertmacro MUI_UNFUNCTION_DESCRIPTION_END |
|---|
| 590 | |
|---|
| 591 | |
|---|
| 592 | Function StrRep |
|---|
| 593 | |
|---|
| 594 | ;Written by dirtydingus 2003-02-20 04:30:09 |
|---|
| 595 | ; USAGE |
|---|
| 596 | ;Push String to do replacement in (haystack) |
|---|
| 597 | ;Push String to replace (needle) |
|---|
| 598 | ;Push Replacement |
|---|
| 599 | ;Call StrRep |
|---|
| 600 | ;Pop $R0 result |
|---|
| 601 | |
|---|
| 602 | Exch $R4 ; $R4 = Replacement String |
|---|
| 603 | Exch |
|---|
| 604 | Exch $R3 ; $R3 = String to replace (needle) |
|---|
| 605 | Exch 2 |
|---|
| 606 | Exch $R1 ; $R1 = String to do replacement in (haystack) |
|---|
| 607 | Push $R2 ; Replaced haystack |
|---|
| 608 | Push $R5 ; Len (needle) |
|---|
| 609 | Push $R6 ; len (haystack) |
|---|
| 610 | Push $R7 ; Scratch reg |
|---|
| 611 | StrCpy $R2 "" |
|---|
| 612 | StrLen $R5 $R3 |
|---|
| 613 | StrLen $R6 $R1 |
|---|
| 614 | loop: |
|---|
| 615 | StrCpy $R7 $R1 $R5 |
|---|
| 616 | StrCmp $R7 $R3 found |
|---|
| 617 | StrCpy $R7 $R1 1 ; - optimization can be removed if U know len needle=1 |
|---|
| 618 | StrCpy $R2 "$R2$R7" |
|---|
| 619 | StrCpy $R1 $R1 $R6 1 |
|---|
| 620 | StrCmp $R1 "" done loop |
|---|
| 621 | found: |
|---|
| 622 | StrCpy $R2 "$R2$R4" |
|---|
| 623 | StrCpy $R1 $R1 $R6 $R5 |
|---|
| 624 | StrCmp $R1 "" done loop |
|---|
| 625 | done: |
|---|
| 626 | StrCpy $R3 $R2 |
|---|
| 627 | Pop $R7 |
|---|
| 628 | Pop $R6 |
|---|
| 629 | Pop $R5 |
|---|
| 630 | Pop $R2 |
|---|
| 631 | Pop $R1 |
|---|
| 632 | Pop $R4 |
|---|
| 633 | Exch $R3 |
|---|
| 634 | |
|---|
| 635 | FunctionEnd |
|---|
| 636 | |
|---|