Skip to content

Commit

Permalink
include envar
Browse files Browse the repository at this point in the history
  • Loading branch information
PrajwalVandana committed Jul 23, 2024
1 parent fdccca7 commit 7f9d4dc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 18 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/cross-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ jobs:
# - name: Install NSIS
# run: |
# choco install -y nsis
# # - name: Move executable to dist
# # run: |
# # if (-Not (Test-Path dist)) { New-Item -ItemType Directory -Path dist }
# # Move-Item "${{ steps.pyinstaller.outputs.executable_path }}/maestro" dist/maestro
# # shell: pwsh
- name: Run NSIS
# run: |
# "C:\Program Files\NSIS\makensis.exe" install-scripts\windows.nsi
Expand Down
28 changes: 15 additions & 13 deletions install-scripts/windows.nsi
Original file line number Diff line number Diff line change
@@ -1,38 +1,40 @@
!include "EnVar.nsh"

!define PRODUCT_NAME "maestro-cli"

OutFile "maestro-installer.exe"

Section
; Set output path to the installation directory.
SetOutPath $PROGRAMFILES\maestro-bundle
SetOutPath $PROGRAMFILES64\maestro-bundle

File ..\dist\maestro\maestro.exe
File /r ..\dist\maestro\_internal

; Add $PROGRAMFILES\maestro-bundle to PATH
EnVar::AddValue HKCU "Path" "$PROGRAMFILES\maestro-bundle"
; Add $PROGRAMFILES64\maestro-bundle to PATH
EnVar::AddValue HKCU "Path" "$PROGRAMFILES64\maestro-bundle"

; Add uninstaller registry key
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayName" "${PRODUCT_NAME}"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "UninstallString" "$PROGRAMFILES\maestro-uninstall.exe"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\$PRODUCT_NAME" "DisplayName" "$PRODUCT_NAME"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\$PRODUCT_NAME" "UninstallString" "$PROGRAMFILES64\maestro-uninstall.exe"
SectionEnd

Section -Post
; Write uninstaller
WriteUninstaller "$PROGRAMFILES\maestro-uninstall.exe"
WriteUninstaller "$PROGRAMFILES64\maestro-uninstall.exe"
SectionEnd

; Uninstaller
Section "Uninstall"
; Remove $PROGRAMFILES\maestro-bundle
RMDir /r "$PROGRAMFILES\maestro-bundle"
; Remove $PROGRAMFILES64\maestro-bundle
RMDir /r "$PROGRAMFILES64\maestro-bundle"

; Remove $PROGRAMFILES\maestro from PATH
EnVar::RemoveValue HKCU "Path" "$PROGRAMFILES\maestro-bundle"
; Remove $PROGRAMFILES64\maestro from PATH
EnVar::RemoveValue HKCU "Path" "$PROGRAMFILES64\maestro-bundle"

; Remove $PROGRAMFILES\maestro-uninstall.exe
Delete "$PROGRAMFILES\maestro-uninstall.exe"
; Remove $PROGRAMFILES64\maestro-uninstall.exe
Delete "$PROGRAMFILES64\maestro-uninstall.exe"

; Remove uninstaller registry key
DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\$PRODUCT_NAME"
SectionEnd

0 comments on commit 7f9d4dc

Please sign in to comment.