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
|
;-------------------------------------------------------------------------------
; Includes
!include "MUI2.nsh"
!include "LogicLib.nsh"
!include "WinVer.nsh"
!include "x64.nsh"
;-------------------------------------------------------------------------------
; Constants
!ifndef PRODUCT_NAME
!define PRODUCT_NAME "Bumps"
!endif
!define /date CurrentYear "%Y"
!define PRODUCT_DESCRIPTION "Bayesian uncertainty modeling for the physical sciences"
!define COPYRIGHT "Copyright ${CurrentYear} The Bumps developers"
!ifndef PRODUCT_VERSION
!define PRODUCT_VERSION "1.0.0.0"
!endif
!define SETUP_VERSION 1.0.0.0
!ifndef SRC
!define SRC "..\conda_packed"
!endif
;-------------------------------------------------------------------------------
; Attributes
Name "${PRODUCT_NAME}"
OutFile "BumpsWebviewSetup.exe"
InstallDir "$LocalAppData\${PRODUCT_NAME}"
InstallDirRegKey HKCU "Software\Reflectometry-Org\${PRODUCT_NAME}" ""
RequestExecutionLevel user ; user|highest|admin
;-------------------------------------------------------------------------------
; Version Info
VIProductVersion "${PRODUCT_VERSION}"
VIAddVersionKey "ProductName" "${PRODUCT_NAME}"
VIAddVersionKey "ProductVersion" "${PRODUCT_VERSION}"
VIAddVersionKey "FileDescription" "${PRODUCT_DESCRIPTION}"
VIAddVersionKey "LegalCopyright" "${COPYRIGHT}"
VIAddVersionKey "FileVersion" "${SETUP_VERSION}"
;-------------------------------------------------------------------------------
; Modern UI Appearance
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\orange.bmp"
!define MUI_WELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange.bmp"
!define MUI_FINISHPAGE_NOAUTOCLOSE
;-------------------------------------------------------------------------------
; Installer Pages
!insertmacro MUI_PAGE_WELCOME
;!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
;-------------------------------------------------------------------------------
; Uninstaller Pages
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
;-------------------------------------------------------------------------------
; Languages
!insertmacro MUI_LANGUAGE "English"
;-------------------------------------------------------------------------------
; Installer Sections
Section "Webview Server" SEC01
SetOutPath "$INSTDIR"
File /r "${SRC}\*"
WriteRegStr HKCU "Software\Reflectometry-Org\${PRODUCT_NAME}" "Install_Dir" "$INSTDIR"
WriteUninstaller "$INSTDIR\Uninstall.exe"
; Registry entries
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
"DisplayName" "${PRODUCT_NAME}"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
"UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
"NoModify" 1
WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
"NoRepair" 1
SectionEnd
Section "Start Menu Shortcuts" SEC02
CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}"
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\BumpsWebview.lnk" \
"$SYSDIR\WindowsPowerShell\v1.0\powershell.exe" \
'-NoProfile -Command ""$INSTDIR\python.exe -m bumps.webview.server""' \
"$INSTDIR\share\icons\bumps.ico"
SetOutPath "%USERPROFILE%"
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\BumpsPowershell.lnk" \
"$SYSDIR\WindowsPowerShell\v1.0\powershell.exe" \
'-NoExit -NoProfile -Command ""$INSTDIR\Library\bin\micromamba.exe shell hook -s powershell | Out-String | Invoke-Expression ; micromamba activate $INSTDIR""' \
""
SectionEnd
Section "Desktop Shortcut" SEC03
SetShellVarContext current
CreateShortCut "$DESKTOP\${PRODUCT_NAME}.lnk" \
"$SYSDIR\WindowsPowerShell\v1.0\powershell.exe" \
'-NoProfile -Command ""$INSTDIR\python.exe -m bumps.webview.server""' \
"$INSTDIR\share\icons\bumps.ico"
SectionEnd
Section "CLI Commands" SEC04
DetailPrint "Setting up console commands..."
nsExec::Exec '"$INSTDIR\Scripts\conda-unpack.exe"'
Pop $0
DetailPrint "Return code: $0"
SectionEnd
;-------------------------------------------------------------------------------
; Uninstaller Sections
Section "Uninstall"
Delete "$INSTDIR\Uninstall.exe"
RMDir /r /REBOOTOK "$INSTDIR"
Delete "$SMPROGRAMS\${PRODUCT_NAME}\*.lnk"
RMDir "$SMPROGRAMS\${PRODUCT_NAME}"
DeleteRegKey /ifempty HKCU "Software\Reflectometry-Org\${PRODUCT_NAME}"
DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
SectionEnd
|