polipo-mingw.nsi 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. ;polipo-mingw.nsi - A basic win32 installer for Polipo
  2. ; Originally written by J Doe.
  3. ; Modified by Andrew Lewman
  4. ; This is licensed under a Modified BSD license.
  5. ;-----------------------------------------
  6. ;
  7. !include "MUI.nsh"
  8. !define VERSION "1.0.4.0-forbidden-1"
  9. !define INSTALLER "polipo-${VERSION}-win32.exe"
  10. !define WEBSITE "http://www.pps.jussieu.fr/~jch/software/polipo/"
  11. !define LICENSE "COPYING"
  12. ;BIN is where it expects to find polipo.exe
  13. !define BIN "."
  14. SetCompressor lzma
  15. OutFile ${INSTALLER}
  16. InstallDir $PROGRAMFILES\Polipo
  17. SetOverWrite ifnewer
  18. Name "Polipo"
  19. Caption "Polipo ${VERSION} Setup"
  20. BrandingText "A Caching Web Proxy"
  21. CRCCheck on
  22. XPStyle on
  23. VIProductVersion "${VERSION}"
  24. VIAddVersionKey "ProductName" "Polipo: A caching web proxy"
  25. VIAddVersionKey "Comments" "http://www.pps.jussieu.fr/~jch/software/polipo/"
  26. VIAddVersionKey "LegalTrademarks" "See COPYING"
  27. VIAddVersionKey "LegalCopyright" "©2008, Juliusz Chroboczek"
  28. VIAddVersionKey "FileDescription" "Polipo is a caching web proxy."
  29. VIAddVersionKey "FileVersion" "${VERSION}"
  30. !define MUI_WELCOMEPAGE_TITLE "Welcome to the Polipo ${VERSION} Setup Wizard"
  31. !define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of Polipo ${VERSION}.\r\n\r\nIf you have previously installed Polipo and it is currently running, please exit Polipo first before continuing this installation.\r\n\r\n$_CLICK"
  32. !define MUI_ABORTWARNING
  33. !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\win-install.ico"
  34. !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\win-uninstall.ico"
  35. !define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\win.bmp"
  36. !define MUI_HEADERIMAGE
  37. ;!define MUI_FINISHPAGE_RUN
  38. !define MUI_FINISHPAGE_LINK "Visit the Polipo website for the latest updates."
  39. !define MUI_FINISHPAGE_LINK_LOCATION ${WEBSITE}
  40. !insertmacro MUI_PAGE_WELCOME
  41. !insertmacro MUI_PAGE_COMPONENTS
  42. !insertmacro MUI_PAGE_DIRECTORY
  43. !insertmacro MUI_PAGE_INSTFILES
  44. !insertmacro MUI_PAGE_FINISH
  45. !insertmacro MUI_UNPAGE_WELCOME
  46. !insertmacro MUI_UNPAGE_CONFIRM
  47. !insertmacro MUI_UNPAGE_INSTFILES
  48. !insertmacro MUI_UNPAGE_FINISH
  49. !insertmacro MUI_LANGUAGE "English"
  50. Var configfile
  51. Var forbiddenfile
  52. ;Sections
  53. ;--------
  54. Section "Polipo" Polipo
  55. ;Files that have to be installed for polipo to run and that the user
  56. ;cannot choose not to install
  57. SectionIn RO
  58. SetOutPath $INSTDIR
  59. File "${BIN}\polipo.exe"
  60. File "${BIN}\COPYING"
  61. File "${BIN}\CHANGES"
  62. File "${BIN}\config.sample"
  63. File "${BIN}\forbidden.sample"
  64. File "${BIN}\README.Windows"
  65. File "${BIN}\libgnurx-0.dll"
  66. WriteIniStr "$INSTDIR\Polipo Website.url" "InternetShortcut" "URL" ${WEBSITE}
  67. StrCpy $configfile "config"
  68. StrCpy $forbiddenfile "forbidden"
  69. SetOutPath $INSTDIR
  70. ;If there's already a polipo config file, ask if they want to
  71. ;overwrite it with the new one.
  72. IfFileExists "$INSTDIR\config" "" endifconfig
  73. MessageBox MB_ICONQUESTION|MB_YESNO "You already have a Polipo config file.$\r$\nDo you want to overwrite it with the default sample config file?" IDNO yesreplace
  74. Delete $INSTDIR\config
  75. Goto endifconfig
  76. yesreplace:
  77. StrCpy $configfile ".\config.sample"
  78. endifconfig:
  79. File /oname=$configfile ".\config.sample"
  80. ;If there's already a polipo forbidden file, ask if they want to
  81. ;overwrite it with the new one.
  82. IfFileExists "$INSTDIR\forbidden" "" endifforbidden
  83. MessageBox MB_ICONQUESTION|MB_YESNO "You already have a Polipo forbidden file.$\r$\nDo you want to overwrite it with the default sample forbidden file?" IDNO forbidyesreplace
  84. Delete $INSTDIR\forbidden
  85. Goto endifforbidden
  86. forbidyesreplace:
  87. StrCpy $forbiddenfile ".\forbidden.sample"
  88. endifforbidden:
  89. File /oname=$forbiddenfile ".\forbidden.sample"
  90. IfFileExists "$INSTDIR\bin\*.*" "" endifbinroot
  91. CreateDirectory "$INSTDIR\bin"
  92. endifbinroot:
  93. CopyFiles "${BIN}\localindex.html" $INSTDIR\index.html
  94. IfFileExists "$INSTDIR\cache\*.*" "" endifcache
  95. CreateDirectory "$INSTDIR\cache"
  96. endifcache:
  97. SectionEnd
  98. SubSection /e "Shortcuts" Shortcuts
  99. Section "Start Menu" StartMenu
  100. SetOutPath $INSTDIR
  101. IfFileExists "$SMPROGRAMS\Polipo\*.*" "" +2
  102. RMDir /r "$SMPROGRAMS\Polipo"
  103. CreateDirectory "$SMPROGRAMS\Polipo"
  104. CreateShortCut "$SMPROGRAMS\Polipo\Polipo.lnk" "$INSTDIR\polipo.exe" "-c config"
  105. CreateShortCut "$SMPROGRAMS\Polipo\Poliporc.lnk" "Notepad.exe" "$INSTDIR\config"
  106. CreateShortCut "$SMPROGRAMS\Polipo\Polipo Documentation.lnk" "$INSTDIR\www\index.html"
  107. CreateShortCut "$SMPROGRAMS\Polipo\Polipo Website.lnk" "$INSTDIR\Polipo Website.url"
  108. CreateShortCut "$SMPROGRAMS\Polipo\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
  109. SectionEnd
  110. Section "Desktop" Desktop
  111. SetOutPath $INSTDIR
  112. CreateShortCut "$DESKTOP\Polipo.lnk" "$INSTDIR\polipo.exe" "-c config"
  113. SectionEnd
  114. Section /o "Run at startup" Startup
  115. SetOutPath $INSTDIR
  116. CreateShortCut "$SMSTARTUP\Polipo.lnk" "$INSTDIR\polipo.exe" "-c config -f forbidden" "" "" "" SW_SHOWMINIMIZED
  117. SectionEnd
  118. SubSectionEnd
  119. Section "Uninstall"
  120. Delete "$DESKTOP\Polipo.lnk"
  121. Delete "$INSTDIR\polipo.exe"
  122. Delete "$INSTDIR\Polipo Website.url"
  123. Delete "$INSTDIR\config"
  124. Delete "$INSTDIR\config.sample"
  125. Delete "$INSTDIR\forbidden.sample"
  126. Delete "$INSTDIR\libgnurx-0.dll"
  127. Delete "$INSTDIR\COPYING"
  128. Delete "$INSTDIR\CHANGES"
  129. Delete "$INSTDIR\README.Windows"
  130. StrCmp $INSTDIR $INSTDIR +2 ""
  131. RMDir /r $INSTDIR
  132. Delete "$INSTDIR\Uninstall.exe"
  133. RMDir /r "$INSTDIR\Documents"
  134. RMDir $INSTDIR
  135. RMDir /r "$SMPROGRAMS\Polipo"
  136. RMDir /r "$APPDATA\Polipo"
  137. Delete "$SMSTARTUP\Polipo.lnk"
  138. DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Polipo"
  139. SectionEnd
  140. Section -End
  141. WriteUninstaller "$INSTDIR\Uninstall.exe"
  142. ;The registry entries simply add the Polipo uninstaller to the Windows
  143. ;uninstall list.
  144. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Polipo" "DisplayName" "Polipo (remove only)"
  145. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Polipo" "UninstallString" '"$INSTDIR\Uninstall.exe"'
  146. SectionEnd
  147. !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  148. !insertmacro MUI_DESCRIPTION_TEXT ${Polipo} "The core executable and config files needed for Polipo to run."
  149. !insertmacro MUI_DESCRIPTION_TEXT ${ShortCuts} "Shortcuts to easily start Polipo"
  150. !insertmacro MUI_DESCRIPTION_TEXT ${StartMenu} "Shortcuts to access Polipo and it's documentation from the Start Menu"
  151. !insertmacro MUI_DESCRIPTION_TEXT ${Desktop} "A shortcut to start Polipo from the desktop"
  152. !insertmacro MUI_DESCRIPTION_TEXT ${Startup} "Launches Polipo automatically at startup in a minimized window"
  153. !insertmacro MUI_FUNCTION_DESCRIPTION_END