polipo-mingw.nsi 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. ;polipo-mingw.nsi - A basic win32 installer for Polipo
  2. ; Originally written by J Doe.
  3. ; Modified by Andrew Lewman
  4. ; See LICENSE for licencing information
  5. ;-----------------------------------------
  6. ;
  7. !include "MUI.nsh"
  8. !define VERSION "1.0.2"
  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" "©2007, 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 "$INSTDIR\polipo.exe -c $configdir\config"
  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. ; There's no point in having a clickthrough license: Our license adds
  42. ; certain rights, but doesn't remove them.
  43. ; !insertmacro MUI_PAGE_LICENSE "${LICENSE}"
  44. !insertmacro MUI_PAGE_COMPONENTS
  45. !insertmacro MUI_PAGE_DIRECTORY
  46. !insertmacro MUI_PAGE_INSTFILES
  47. !insertmacro MUI_PAGE_FINISH
  48. !insertmacro MUI_UNPAGE_WELCOME
  49. !insertmacro MUI_UNPAGE_CONFIRM
  50. !insertmacro MUI_UNPAGE_INSTFILES
  51. !insertmacro MUI_UNPAGE_FINISH
  52. !insertmacro MUI_LANGUAGE "English"
  53. Var configdir
  54. Var configfile
  55. ;Sections
  56. ;--------
  57. Section "Polipo" Polipo
  58. ;Files that have to be installed for polipo to run and that the user
  59. ;cannot choose not to install
  60. SectionIn RO
  61. SetOutPath $INSTDIR
  62. File "${BIN}\polipo.exe"
  63. File "${BIN}\COPYING"
  64. File "${BIN}\CHANGES"
  65. File "${BIN}\config.windows"
  66. File "${BIN}\forbidden.sample"
  67. File "${BIN}\README.Windows"
  68. WriteIniStr "$INSTDIR\Polipo Website.url" "InternetShortcut" "URL" ${WEBSITE}
  69. StrCpy $configfile "config"
  70. StrCpy $configdir $INSTDIR
  71. SetOutPath $configdir
  72. ;If there's already a polipo config file, ask if they want to
  73. ;overwrite it with the new one.
  74. IfFileExists "$configdir\config" "" endifconfig
  75. 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
  76. Delete $configdir\config
  77. Goto endifconfig
  78. yesreplace:
  79. StrCpy $configfile ".\config.windows"
  80. endifconfig:
  81. File /oname=$configfile ".\config.windows"
  82. IfFileExists "$INSTDIR\www\*.*" "" endifwebroot
  83. CreateDirectory "$INSTDIR\www"
  84. endifwebroot:
  85. CopyFiles "${BIN}\localindex.html" $INSTDIR\www\index.html
  86. IfFileExists "$INSTDIR\cache\*.*" "" endifcache
  87. CreateDirectory "$INSTDIR\cache"
  88. endifcache:
  89. SectionEnd
  90. SubSection /e "Shortcuts" Shortcuts
  91. Section "Start Menu" StartMenu
  92. SetOutPath $INSTDIR
  93. IfFileExists "$SMPROGRAMS\Polipo\*.*" "" +2
  94. RMDir /r "$SMPROGRAMS\Polipo"
  95. CreateDirectory "$SMPROGRAMS\Polipo"
  96. CreateShortCut "$SMPROGRAMS\Polipo\Polipo.lnk" "$INSTDIR\polipo.exe -c $configdir\config"
  97. CreateShortCut "$SMPROGRAMS\Polipo\Poliporc.lnk" "Notepad.exe" "$configdir\config"
  98. CreateShortCut "$SMPROGRAMS\Polipo\Polipo Documentation.lnk" "$INSTDIR\www\index.html"
  99. CreateShortCut "$SMPROGRAMS\Polipo\Polipo Website.lnk" "$INSTDIR\Polipo Website.url"
  100. CreateShortCut "$SMPROGRAMS\Polipo\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
  101. SectionEnd
  102. Section "Desktop" Desktop
  103. SetOutPath $INSTDIR
  104. CreateShortCut "$DESKTOP\Polipo.lnk" "$INSTDIR\polipo.exe -c $configdir\config"
  105. SectionEnd
  106. Section /o "Run at startup" Startup
  107. SetOutPath $INSTDIR
  108. CreateShortCut "$SMSTARTUP\Polipo.lnk" "$INSTDIR\polipo.exe -c $configdir\config" "" "" "" SW_SHOWMINIMIZED
  109. SectionEnd
  110. SubSectionEnd
  111. Section "Uninstall"
  112. Delete "$DESKTOP\Polipo.lnk"
  113. Delete "$INSTDIR\polipo.exe"
  114. Delete "$INSTDIR\Polipo Website.url"
  115. Delete "$INSTDIR\config"
  116. Delete "$INSTDIR\config.sample"
  117. StrCmp $configdir $INSTDIR +2 ""
  118. RMDir /r $configdir
  119. Delete "$INSTDIR\Uninstall.exe"
  120. RMDir /r "$INSTDIR\Documents"
  121. RMDir $INSTDIR
  122. RMDir /r "$SMPROGRAMS\Polipo"
  123. RMDir /r "$APPDATA\Polipo"
  124. Delete "$SMSTARTUP\Polipo.lnk"
  125. DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Polipo"
  126. SectionEnd
  127. Section -End
  128. WriteUninstaller "$INSTDIR\Uninstall.exe"
  129. ;The registry entries simply add the Polipo uninstaller to the Windows
  130. ;uninstall list.
  131. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Polipo" "DisplayName" "Polipo (remove only)"
  132. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Polipo" "UninstallString" '"$INSTDIR\Uninstall.exe"'
  133. SectionEnd
  134. !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  135. !insertmacro MUI_DESCRIPTION_TEXT ${Polipo} "The core executable and config files needed for Polipo to run."
  136. !insertmacro MUI_DESCRIPTION_TEXT ${ShortCuts} "Shortcuts to easily start Polipo"
  137. !insertmacro MUI_DESCRIPTION_TEXT ${StartMenu} "Shortcuts to access Polipo and it's documentation from the Start Menu"
  138. !insertmacro MUI_DESCRIPTION_TEXT ${Desktop} "A shortcut to start Polipo from the desktop"
  139. !insertmacro MUI_DESCRIPTION_TEXT ${Startup} "Launches Polipo automatically at startup in a minimized window"
  140. !insertmacro MUI_FUNCTION_DESCRIPTION_END