|
1 | 1 | ; NSIS script for Ansys Python Manager installer
|
2 | 2 |
|
3 |
| - |
4 | 3 | ; Set the name, version, and output path of the installer
|
| 4 | +!define VERSION_FILE "src/ansys/tools/installer/VERSION" |
5 | 5 | !define PRODUCT_NAME "Ansys Python Manager"
|
6 |
| -!define PRODUCT_VERSION "0.1.0-beta0" |
7 |
| -!define OUTFILE_NAME "Ansys Python Manager Setup-v${PRODUCT_VERSION}.exe" |
| 6 | +!define /file PRODUCT_VERSION "src/ansys/tools/installer/VERSION" |
| 7 | +!define OUTFILE_NAME "Ansys-Python-Manager-Setup-v${PRODUCT_VERSION}.exe" |
| 8 | + |
8 | 9 | Name "${PRODUCT_NAME}"
|
9 | 10 | VIProductVersion "${PRODUCT_VERSION}"
|
10 | 11 | OutFile "dist\${OUTFILE_NAME}"
|
11 | 12 |
|
| 13 | + |
| 14 | +!include "MUI2.nsh" |
| 15 | +!include "InstallOptions.nsh" |
| 16 | +!define MUI_PAGE_CUSTOMFUNCTION_PRE oneclickpre |
| 17 | +!define MUI_PAGE_CUSTOMFUNCTION_LEAVE oneclickleave |
| 18 | +!insertmacro MUI_PAGE_INSTFILES |
| 19 | +!include "uninstall.nsi" |
| 20 | + |
12 | 21 | ; Define the installer sections
|
13 | 22 | Section "Ansys Python Manager" SEC01
|
14 | 23 | ; Set the installation directory to the program files directory
|
15 | 24 | SetOutPath "$PROGRAMFILES64\ANSYS Inc\Ansys Python Manager"
|
16 |
| - |
| 25 | + |
17 | 26 | ; Copy the files from the dist\ansys_python_manager directory
|
| 27 | + ; File /r /oname=ignore "dist\ansys_python_manager\*" |
18 | 28 | File /r "dist\ansys_python_manager\*"
|
19 |
| - |
| 29 | + |
20 | 30 | ; Create the start menu directory
|
21 | 31 | CreateDirectory "$SMPROGRAMS\Ansys Python Manager"
|
22 |
| - |
| 32 | + |
23 | 33 | ; Create the start menu shortcut
|
24 | 34 | CreateShortCut "$SMPROGRAMS\Ansys Python Manager\Ansys Python Manager.lnk" "$INSTDIR\Ansys Python Manager.exe"
|
| 35 | + |
| 36 | + ; Add the program to the installed programs list |
| 37 | + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayName" "${PRODUCT_NAME}" |
| 38 | + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\"" |
| 39 | + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayIcon" "$\"$INSTDIR\Ansys Python Manager.exe$\"" |
| 40 | + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "Publisher" "ANSYS Inc" |
| 41 | + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "Version" "${PRODUCT_VERSION}" |
| 42 | + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayVersion" "${PRODUCT_VERSION}" |
| 43 | + |
| 44 | + WriteUninstaller "$INSTDIR\uninstall.exe" |
| 45 | + |
| 46 | + ; start after install |
| 47 | + Exec "$INSTDIR\Ansys Python Manager.exe" |
| 48 | + |
25 | 49 | SectionEnd
|
26 | 50 |
|
27 | 51 | ; Define the uninstaller section
|
28 | 52 | Section "Uninstall" SEC02
|
29 |
| - ; Remove the installed files |
| 53 | + |
30 | 54 | Delete "$PROGRAMFILES64\Ansys Python Manager\*.*"
|
31 | 55 | RMDir "$PROGRAMFILES64\Ansys Python Manager"
|
32 |
| - |
33 |
| - ; Remove the registry keys |
34 |
| - DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Ansys Python Manager" |
35 |
| - |
36 |
| - ; Remove the start menu shortcut and directory |
| 56 | + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" |
37 | 57 | Delete "$SMPROGRAMS\Ansys Python Manager\Ansys Python Manager.lnk"
|
38 | 58 | RMDir "$SMPROGRAMS\Ansys Python Manager"
|
39 | 59 | SectionEnd
|
40 | 60 |
|
41 |
| -; Set the installer properties |
42 |
| -Name "${PRODUCT_NAME}" |
43 | 61 | Icon "dist\ansys_python_manager\assets\pyansys_icon.ico"
|
44 | 62 | InstallDir "$PROGRAMFILES64\ANSYS Inc\Ansys Python Manager"
|
45 | 63 |
|
46 |
| -; Simplify the installer GUI |
| 64 | +; Define the custom functions for the MUI2 OneClick plugin |
47 | 65 | InstProgressFlags smooth
|
| 66 | +Function oneclickpre |
| 67 | + !insertmacro MUI_HEADER_TEXT "Installing ${PRODUCT_NAME}" "Please wait while the installation completes." |
| 68 | + ; !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico" |
| 69 | + HideWindow |
| 70 | +FunctionEnd |
| 71 | + |
| 72 | +Function oneclickleave |
| 73 | + Quit |
| 74 | +FunctionEnd |
| 75 | + |
| 76 | +; Call the MUI2 OneClick plugin |
| 77 | +!insertmacro MUI_UNPAGE_CONFIRM |
| 78 | +!insertmacro MUI_UNPAGE_INSTFILES |
| 79 | + |
0 commit comments