Advertisement
uwekeim

NSIS

Jun 19th, 2012
514
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SetCompressor /FINAL lzma
  2.  
  3. ;--------------------------------
  4. ; Version number and other information.
  5.  
  6. !define VERSION '11.0.0'
  7. !define COPYRIGHT_YEAR '1999-2012'
  8.  
  9. ;--------------------------------
  10. ;Include Modern UI
  11.  
  12. !define MUI_ABORTWARNING
  13.  
  14. !include MUI2.nsh
  15. !include LogicLib.nsh
  16. !include DotNetVer.nsh
  17.  
  18. ;--------------------------------
  19.  
  20. ; The name of the installer
  21. Name "Zeta Producer ${VERSION}"
  22.  
  23. OutFile "..\Master\zp11-setup.exe"
  24.  
  25. ; The default installation directory
  26. InstallDir "$LOCALAPPDATA\Zeta Producer 11"
  27.  
  28. ; Request application privileges for Windows Vista
  29. RequestExecutionLevel user
  30.  
  31. BrandingText " "
  32.  
  33. ;--------------------------------
  34. ;Interface Settings
  35.  
  36. ; See http://nsis.sourceforge.net/Docs/Modern%20UI/Readme.html.
  37. !define MUI_ICON "box_software.ico"
  38. !define MUI_UNICON "box_software.ico"
  39.  
  40. ; http://ontopreplica.codeplex.com/SourceControl/changeset/view/a65fdbb263dd#Installer%2fscript.nsi
  41. !define REG_UNINSTALL "Software\Microsoft\Windows\CurrentVersion\Uninstall\ZetaProducer11"
  42.  
  43. ;--------------------------------
  44. ;Pages
  45.  
  46. ; http://nsis.sourceforge.net/Adding_3_Extra_Text_Lines_on_MUI_Welcome-Finish_Pages
  47. ; http://forums.winamp.com/showthread.php?postid=2243980
  48. !define MUI_FINISHPAGE_TITLE_3LINES
  49. !define MUI_WELCOMEPAGE_TITLE_3LINES
  50.  
  51. !define MUI_WELCOMEFINISHPAGE_BITMAP "start-exit.bmp"
  52.  
  53. !define MUI_WELCOMEPAGE_TITLE $(mui_welcomepage_title)
  54. !define MUI_WELCOMEPAGE_TEXT $(mui_welcomepage_text)
  55.  
  56. !insertmacro MUI_PAGE_WELCOME
  57.  
  58. ;!insertmacro MUI_PAGE_DIRECTORY
  59.  
  60. !insertmacro MUI_PAGE_INSTFILES
  61.  
  62. ; http://nsis.sourceforge.net/Docs/Modern%20UI/Readme.html
  63. !define MUI_FINISHPAGE_RUN "$INSTDIR\Applications\producer.exe"
  64. !define MUI_FINISHPAGE_RUN_TEXT $(mui_finishpage_run_text)
  65. !define MUI_FINISHPAGE_TITLE $(mui_finishpage_title)
  66. !define MUI_FINISHPAGE_TEXT $(mui_finishpage_text)
  67. !insertmacro MUI_PAGE_FINISH
  68.  
  69. !define MUI_FINISHPAGE_TITLE_3LINES
  70. !define MUI_WELCOMEPAGE_TITLE_3LINES
  71.  
  72. !insertmacro MUI_UNPAGE_CONFIRM
  73. !insertmacro MUI_UNPAGE_INSTFILES
  74.  
  75. ;--------------------------------
  76. ; Languages. AFTER THE PAGES!
  77.  
  78. !insertmacro MUI_LANGUAGE "English"
  79. !insertmacro MUI_LANGUAGE "German"
  80.  
  81. ;--------------------------------
  82. ; Language strings.
  83.  
  84. ; Also see http://nsis.sourceforge.net/Docs/Modern%20UI/Readme.html
  85.  
  86. LangString mui_welcomepage_title ${LANG_ENGLISH} "Install Zeta Producer 11"
  87. LangString mui_welcomepage_title ${LANG_GERMAN} "Zeta Producer 11 installieren"
  88.  
  89. LangString mui_welcomepage_text ${LANG_ENGLISH} "With Zeta Producer 11 you built your professional looking website in minutes.$\r$\n$\r$\n$\r$\n$\r$\nTo start click the 'Install' button."
  90. LangString mui_welcomepage_text ${LANG_GERMAN} "Mit Zeta Producer 11 erstellen Sie Ihre eigene professionelle Website in wenigen Minuten.$\r$\n$\r$\n$\r$\n$\r$\nKlicken Sie zum Start auf 'Installieren'."
  91.  
  92. LangString mui_finishpage_run_text ${LANG_ENGLISH} "Start Zeta Producer 11 now"
  93. LangString mui_finishpage_run_text ${LANG_GERMAN} "Zeta Producer 11 jetzt starten"
  94.  
  95. LangString mui_finishpage_title ${LANG_ENGLISH} "Zeta Producer 11 successfully installed"
  96. LangString mui_finishpage_title ${LANG_GERMAN} "Zeta Producer 11 wurde erfolgreich installiert"
  97.  
  98. LangString mui_finishpage_text ${LANG_ENGLISH} " "
  99. LangString mui_finishpage_text ${LANG_GERMAN} " "
  100.  
  101. LangString shortcut_uninstall_text ${LANG_ENGLISH} "Uninstall Zeta Producer 11"
  102. LangString shortcut_uninstall_text ${LANG_GERMAN} "Zeta Producer 11 deinstallieren"
  103.  
  104. LangString shortcut_web_text ${LANG_ENGLISH} "Zeta Producer 11 on the web"
  105. LangString shortcut_web_text ${LANG_GERMAN} "Zeta Producer 11 im Internet"
  106.  
  107. LangString shortcut_tv_text ${LANG_ENGLISH} "Remote support"
  108. LangString shortcut_tv_text ${LANG_GERMAN} "Fernwartungs-Support"
  109.  
  110. LangString shortcut_mdacrepair_text ${LANG_ENGLISH} "MDAC repair"
  111. LangString shortcut_mdacrepair_text ${LANG_GERMAN} "MDAC reparieren"
  112.  
  113. LangString shortcut_tv_exe ${LANG_ENGLISH} "tv_qs_en.exe"
  114. LangString shortcut_tv_exe ${LANG_GERMAN} "tv_qs_de.exe"
  115.  
  116. LangString mui_uninstall_text ${LANG_ENGLISH} "You are about to install Zeta Producer 11, version ${VERSION}.$\n$\nThe previous version $R1 is already installed. $\n$\nClick 'OK' to remove the previous version or 'Cancel' to cancel this upgrade."
  117. LangString mui_uninstall_text ${LANG_GERMAN} "Sie sind dabei Zeta Producer 11, Version ${VERSION} zu installieren.$\n$\nDie vorherige Version $R1 ist bereits installiert. $\n$\nKlicken Sie 'OK' um die vorherige Version zu entfernen oder 'Abbrechen' um die Installation abzubrechen."
  118.  
  119. LangString mui_uninstall_text2 ${LANG_ENGLISH} "Zeta Producer 11 ${VERSION} (remove only)"
  120. LangString mui_uninstall_text2 ${LANG_GERMAN} "Zeta Producer 11 ${VERSION} (nur entfernen)"
  121.  
  122. LangString uac_error_1 ${LANG_ENGLISH} "Unable to elevate. Error $0."
  123. LangString uac_error_1 ${LANG_GERMAN} "Benutzerkontenwechsel ist fehlgeschlagen. Fehler $0."
  124.  
  125. LangString uac_error_2 ${LANG_ENGLISH} "This installer requires admin access. Aborting operation."
  126. LangString uac_error_2 ${LANG_GERMAN} "Diese Installation benötigt Administrator-Berechtigungen. Vorgang wird abgebrochen."
  127.  
  128. LangString uac_error_3 ${LANG_ENGLISH} "This installer requires admin access. Please try again."
  129. LangString uac_error_3 ${LANG_GERMAN} "Diese Installation benötigt Administrator-Berechtigungen. Bitte versuchen Sie es erneut."
  130.  
  131. LangString net_4_setup_failed_message ${LANG_ENGLISH} "Zeta Producer requires Microsoft .NET Framework 2 or 4. This software is not installed (completely) on your system. Please activate your internet connection repeat the installation of Zeta Producer."
  132.  
  133. LangString net_4_setup_failed_message ${LANG_GERMAN} "Zeta Producer benötigt das Microsoft .NET Framework 2 oder 4. Dieses ist auf Ihrem System nicht (vollständig) installiert. Bitte aktivieren Sie Ihre Internetverbindung und wiederholen Sie die Installation von Zeta Producer."
  134.  
  135.  
  136. ; --------------------------------
  137. ; Version Information
  138.  
  139. VIProductVersion "${VERSION}.0"
  140.  
  141. VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "Zeta Producer 11"
  142. VIAddVersionKey /LANG=${LANG_ENGLISH} "Comments" "Zeta Producer 11 - Powerful and easy website creation for everyone"
  143. VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "Zeta Software GmbH"
  144. VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalTrademarks" "Zeta Producer 11, developed by Zeta Software GmbH"
  145. VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "Copyright © ${COPYRIGHT_YEAR} Zeta Software GmbH"
  146. VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "Zeta Producer 11"
  147. VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "${VERSION}"
  148.  
  149. VIAddVersionKey /LANG=${LANG_GERMAN} "ProductName" "Zeta Producer 11"
  150. VIAddVersionKey /LANG=${LANG_GERMAN} "Comments" "Zeta Producer 11 - Professionelle Websites selbst erstellen"
  151. VIAddVersionKey /LANG=${LANG_GERMAN} "CompanyName" "Zeta Software GmbH"
  152. VIAddVersionKey /LANG=${LANG_GERMAN} "LegalTrademarks" "Zeta Producer 11, entwickelt von Zeta Software GmbH"
  153. VIAddVersionKey /LANG=${LANG_GERMAN} "LegalCopyright" "Copyright © ${COPYRIGHT_YEAR} Zeta Software GmbH"
  154. VIAddVersionKey /LANG=${LANG_GERMAN} "FileDescription" "Zeta Producer 11"
  155. VIAddVersionKey /LANG=${LANG_GERMAN} "FileVersion" "${VERSION}"
  156.  
  157. ;--------------------------------
  158.  
  159. ;;Function StartEndApp
  160. ;;  Exec "$INSTDIR\Applications\producer.exe"
  161. ;;FunctionEnd
  162.  
  163. ; http://nsis.sourceforge.net/UAC_plug-in
  164. Function MyFinishFunction
  165. ;;; UAC::Exec "$INSTDIR\Applications\producer.exe"
  166. ;;  !insertmacro UAC.CallFunctionAsUser StartEndApp
  167. FunctionEnd
  168.  
  169. ;--------------------------------
  170.  
  171. Function .onInit
  172. ;   UAC_Elevate:
  173. ;       UAC::RunElevated
  174. ;       StrCmp 1223 $0 UAC_ElevationAborted ; UAC dialog aborted by user?
  175. ;       StrCmp 0 $0 0 UAC_Err ; Error?
  176. ;       StrCmp 1 $1 0 UAC_Success ;Are we the real deal or just the wrapper?
  177. ;       Quit
  178. ;    
  179. ;   UAC_Err:
  180. ;       MessageBox mb_iconstop "$(uac_error_1)"
  181. ;       Abort
  182. ;    
  183. ;   UAC_ElevationAborted:
  184. ;       # elevation was aborted, run as normal?
  185. ;       MessageBox mb_iconstop "$(uac_error_2)"
  186. ;       Abort
  187. ;    
  188. ;   UAC_Success:
  189. ;       StrCmp 1 $3 +4 ;Admin?
  190. ;       StrCmp 3 $1 0 UAC_ElevationAborted ;Try again?
  191. ;       MessageBox mb_iconstop "$(uac_error_3)"
  192. ;       goto UAC_Elevate
  193.  
  194.  
  195.     ;;;;;;  !insertmacro MUI_LANGDLL_DISPLAY
  196.  
  197.     ReadRegStr $R0 HKCU "${REG_UNINSTALL}" "UninstallString"
  198.     StrCmp $R0 "" done
  199.  
  200.     ReadRegStr $R1 HKCU "${REG_UNINSTALL}" "DisplayVersion"
  201.  
  202.     MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
  203.         "$(mui_uninstall_text)" \
  204.         IDOK uninst
  205.     Abort
  206.  
  207.     ;Run the uninstaller
  208.     uninst:
  209.         ClearErrors
  210.         ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
  211.  
  212.         IfErrors no_remove_uninstaller
  213.         ;You can either use Delete /REBOOTOK in the uninstaller or add some code
  214.         ;here to remove the uninstaller. Use a registry key to check
  215.         ;whether the user has chosen to uninstall. If you are using an uninstaller
  216.         ;components page, make sure all sections are uninstalled.
  217.     no_remove_uninstaller:
  218.  
  219.     done:
  220. FunctionEnd
  221.  
  222. ;--------------------------------
  223.  
  224. Function .onInstSuccess
  225.     ; For fixing Kaspersky's VBScript hijack.
  226.     ExecWait 'regsvr32 /s "vbscript.dll"'
  227.  
  228.     ;UAC::Unload
  229. FunctionEnd
  230.  
  231. Function .onInstFailed
  232.      ;UAC::Unload
  233. FunctionEnd
  234.  
  235. ;Function .onUserAbort
  236. ;    UAC::Unload
  237. ;FunctionEnd
  238.  
  239. ;--------------------------------
  240.  
  241. ; The stuff to install
  242. Section "All files"
  243.     SetOutPath "$INSTDIR"
  244.  
  245.     File "dotNetFx40_Full_setup.exe"
  246.  
  247.     ; Need .NET 2 or .NET 4.
  248.     ${If} ${HasDotNet4.0}
  249.         ${If} ${DOTNETVER_4_0} HasDotNetFullProfile 0
  250.             ExecWait "$INSTDIR\dotNetFx40_Full_setup.exe" $0
  251.  
  252.             ${If} $0 != 0
  253.                 MessageBox MB_OK|MB_ICONEXCLAMATION $(net_4_setup_failed_message)
  254.                 Quit
  255.             ${EndIf}
  256.         ${EndIf}
  257.     ${Else}
  258.         ${If} ${HasDotNet2.0}
  259.             ${If} ${DOTNETVER_2_0} AtLeastDotNetServicePack 1
  260.                 ; Do nothing, everything required is present.
  261.             ${Else}
  262.                 ExecWait "$INSTDIR\dotNetFx40_Full_setup.exe" $0
  263.  
  264.                 ${If} $0 != 0
  265.                     MessageBox MB_OK|MB_ICONEXCLAMATION $(net_4_setup_failed_message)
  266.                     Quit
  267.                 ${EndIf}
  268.             ${EndIf}
  269.         ${Else}
  270.             ExecWait "$INSTDIR\dotNetFx40_Full_setup.exe" $0
  271.  
  272.             ${If} $0 != 0
  273.                 MessageBox MB_OK|MB_ICONEXCLAMATION $(net_4_setup_failed_message)
  274.                 Quit
  275.             ${EndIf}
  276.         ${EndIf}
  277.     ${EndIf}
  278.  
  279.     Delete "$INSTDIR\dotNetFx40_Full_setup.exe"
  280.  
  281.     ; Store installation folder
  282.     WriteRegStr HKCU "Software\Zeta Producer 11" "" $INSTDIR
  283.  
  284.     ; ----
  285.  
  286.     ; Write uninstall strings.
  287.     WriteRegStr HKCU "${REG_UNINSTALL}" "DisplayIcon" '"$INSTDIR\Applications\producer.exe"'
  288.     WriteRegStr HKCU "${REG_UNINSTALL}" "DisplayName" "$(mui_uninstall_text2)"
  289.     WriteRegStr HKCU "${REG_UNINSTALL}" "DisplayVersion" "${VERSION}"
  290.     WriteRegStr HKCU "${REG_UNINSTALL}" "InstallLocation" '"$INSTDIR"'
  291.     WriteRegStr HKCU "${REG_UNINSTALL}" "UninstallString" '"$INSTDIR\uninstall.exe"'
  292.     WriteRegStr HKCU "${REG_UNINSTALL}" "Publisher" "Zeta Software GmbH"
  293.     WriteRegStr HKCU "${REG_UNINSTALL}" "URLInfoAbout" "http://www.zeta-producer.com"
  294.     WriteRegStr HKCU "${REG_UNINSTALL}" "HelpLink" "http://www.zeta-producer.com"
  295.     WriteRegDWord HKCU "${REG_UNINSTALL}" "NoModify" 1
  296.     WriteRegDWord HKCU "${REG_UNINSTALL}" "NoRepair" 1
  297.  
  298.     ; ----
  299.  
  300.     ; Main files. But only those who are not written to.
  301.     ; See "File" command documationation at:
  302.     ; http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.1.5
  303.     SetOutPath "$INSTDIR"
  304.     File /r /x ".svn" /x "*.pdb" /x "*.lnk" "..\Origin\*.*"
  305.  
  306.     ; Files that come completely from the web design departement.
  307.     SetOutPath "$INSTDIR\Packaging"
  308.     File /r /x ".svn" ".\Temporary\Packaging\*.*"
  309.  
  310.     ; Icons for links.
  311.     SetOutPath "$INSTDIR"
  312.     File /x ".svn" "earth.ico"
  313.  
  314.     ; ----
  315.  
  316.     ; Create uninstaller. KEEP AT LAST POSITION!
  317.     WriteUninstaller "$INSTDIR\Uninstall.exe"
  318. SectionEnd
  319.  
  320. ;--------------------------------
  321. ; Uninstaller Section
  322.  
  323. Function un.onInit
  324. ;   UAC_Elevate:
  325. ;       UAC::RunElevated
  326. ;       StrCmp 1223 $0 UAC_ElevationAborted ; UAC dialog aborted by user?
  327. ;       StrCmp 0 $0 0 UAC_Err ; Error?
  328. ;       StrCmp 1 $1 0 UAC_Success ;Are we the real deal or just the wrapper?
  329. ;       Quit
  330. ;    
  331. ;   UAC_Err:
  332. ;       MessageBox mb_iconstop "$(uac_error_1)"
  333. ;       Abort
  334. ;    
  335. ;   UAC_ElevationAborted:
  336. ;       # elevation was aborted, run as normal?
  337. ;       MessageBox mb_iconstop "$(uac_error_2)"
  338. ;       Abort
  339. ;    
  340. ;   UAC_Success:
  341. ;       StrCmp 1 $3 +4 ;Admin?
  342. ;       StrCmp 3 $1 0 UAC_ElevationAborted ;Try again?
  343. ;       MessageBox mb_iconstop "$(uac_error_3)"
  344. ;       goto UAC_Elevate
  345. FunctionEnd
  346.  
  347. Function un.OnUnInstSuccess
  348. ;   UAC::Unload
  349. FunctionEnd
  350.  
  351. Function un.OnUnInstFailed
  352. ;    UAC::Unload
  353. FunctionEnd
  354.  
  355. ;--------------------------------
  356.  
  357. Section "Uninstall"
  358.     ; Files.
  359.     RMDir /r "$INSTDIR"
  360.  
  361.     SetShellVarContext current
  362.  
  363.     ; Links.
  364.     RMDir /r "$SMPROGRAMS\Zeta Producer 11"
  365.     Delete "$SMPROGRAMS\ZetaProducer11.lnk"
  366.     Delete "$SMPROGRAMS\Zeta Producer 11.lnk"
  367.     Delete "$DESKTOP\ZetaProducer11.lnk"
  368.     Delete "$DESKTOP\Zeta Producer 11.lnk"
  369.  
  370.     ; Registry.
  371.     DeleteRegKey HKCU "${REG_UNINSTALL}"
  372.  
  373.     DeleteRegKey /ifempty HKCU "Software\Zeta Producer 11"
  374.  
  375.     ; Uninstall itself.
  376.     Delete "$INSTDIR\Uninstall.exe"
  377. SectionEnd
  378.  
  379. ;--------------------------------
  380.  
  381. ; Optional section (can be disabled by the user)
  382. Section "Start Menu Shortcuts"
  383.  
  384.     SetShellVarContext current
  385.  
  386.     CreateDirectory "$SMPROGRAMS\Zeta Producer 11"
  387.     CreateShortCut "$SMPROGRAMS\Zeta Producer 11\Desktop CMS Zeta Producer 11.lnk" "$INSTDIR\Applications\producer.exe"
  388.     CreateShortCut "$SMPROGRAMS\Zeta Producer 11\$(shortcut_web_text).lnk" "http://www.zeta-producer.com" "" "$INSTDIR\earth.ico" 0
  389.     CreateShortCut "$SMPROGRAMS\Zeta Producer 11\$(shortcut_tv_text).lnk" "$INSTDIR\Applications\$(shortcut_tv_exe)"
  390.  
  391.     CreateShortCut "$SMPROGRAMS\Zeta Producer 11.lnk" "$INSTDIR\Applications\producer.exe"
  392.     CreateShortCut "$DESKTOP\Zeta Producer 11.lnk" "$INSTDIR\Applications\producer.exe"
  393.  
  394.     CreateShortCut "$SMPROGRAMS\Zeta Producer 11\$(shortcut_mdacrepair_text).lnk" "http://zeta.li/mdac-repair" "" "$INSTDIR\earth.ico" 0
  395. SectionEnd
  396.  
  397. ;--------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement