• Download Gist
NSIS Script for deploying Prism Applications
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
;Found at http://community.omnicom.no/blogs/lea/archive/2008/10/17/prism-and-nsis-to-the-rescue.aspx
;NSIS Modern User Interface
 
;--------------------------------
; Start
 
!include "MUI2.nsh"
 
!define MUI_PRODUCT "Name of webapp"
!define MUI_VERSION ""
!define MUI_BRANDINGTEXT "Your company here"
CRCCheck On
 
;!include "${NSISDIR}\Contrib\Modern UI\System.nsh"
 
;--------------------------------
;General
 
;Name and file
Name "Name of webapp"
OutFile "setup.exe"
 
;Default installation folder
InstallDir "$PROGRAMFILES\Prism"
 
;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\Prism" ""
 
;Request application privileges for Windows Vista
RequestExecutionLevel user
 
;--------------------------------
;Interface Settings
 
!define MUI_ABORTWARNING
!define MUI_ICON "---PATH TO SETUP ICON HERE---"; There's some in the NSIS folder
!define MUI_UNICON "---PATH TO SETUP ICON HERE---"
!define MUI_WELCOMEPAGE
!define MUI_UNINSTALLER
!define MUI_UNCONFIRMPAGE
!define MUI_FINISHPAGE
 
;Pages
 
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_INSTFILES
 
# These indented statements modify settings for MUI_PAGE_FINISH
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_CHECKED
!define MUI_FINISHPAGE_RUN_TEXT "Start -- YOUR APP NAME HERE --"
!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink"
 
!insertmacro MUI_PAGE_FINISH
 
 
;--------------------------------
;Languages
 
!insertmacro MUI_LANGUAGE "English"
 
;--------------------------------
 
;--------------------------------
;Installer Sections
 
Section "Install Section" SecInstall
 
; set the context for $SMPROGRAMS and other shell folder to the 'current' user
SetShellVarContext current
 
; PRISM webApp data is recursively copied from yourAppAppData to "$APPDATA\WebApps"
SetOutPath "$APPDATA\WebApps\-- YOUR PRISM APP NAME HERE --@prism.app\"
File /r --- YOUR APPDATA FOLDER HERE --- \WebApps\-- YOUR PRISM APP NAME HERE --@prism.app\*
 
; PRISM application data is recursively copied from yourAppPgmFiles to "$APPDATA\yourApp\Prism"
SetOutPath "$PROGRAMFILES\Prism"
File /r C:\Program Files\Prism\*
 
;windirExists:
;Store installation folder
WriteRegStr HKCU "Software\Prism" "" $INSTDIR
 
 
;Create Shortcut links
CreateShortcut "$DESKTOP\${MUI_PRODUCT}.lnk" "$PROGRAMFILES\Prism\prism.exe" "-override $\"$APPDATA\WebApps\-- YOUR PRISM APP NAME --@prism.app\override.ini$\" -webapp -- YOUR PRISM APP NAME --@prism.app" "$APPDATA\WebApps\-- YOUR PRISM APP NAME --@prism.app\icons\default\webapp.ico"
 
;Create uninstaller
;write uninstall information to the registry
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}" "DisplayName" "${MUI_PRODUCT} (remove only)"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}" "UninstallString" "$INSTDIR\Uninstall.exe"
WriteUninstaller "$INSTDIR\Uninstall.exe"
 
 
SectionEnd
 
;--------------------------------
;Uninstaller Section
 
Section "Uninstall"
 
; set the context for $SMPROGRAMS and other shell folder to the 'current' user
SetShellVarContext current
 
;ADD YOUR OWN FILES HERE...
 
Delete "$DESKTOP\${MUI_PRODUCT}.lnk"
Delete "$INSTDIR\Uninstall.exe"
 
;Delete Files
RMDir /r "$INSTDIR\*.*"
 
RMDir "$INSTDIR"
RMDir "$PROGRAMFILES\Prism"
RmDir "$APPDATA\WebApps\-- YOUR PRISM APP NAME --@prism.app"
 
;Delete Uninstaller And Unistall Registry Entries
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\${MUI_PRODUCT}"
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}"
DeleteRegKey /ifempty HKCU "Software\Prism"
 
SectionEnd
 
 
Function LaunchLink
SetShellVarContext current
 
ExecShell "" "$DESKTOP\${MUI_PRODUCT}.lnk"
FunctionEnd

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.