|
| 1 | +!macro customHeader |
| 2 | + ; Custom header macro - called at the beginning of the installer |
| 3 | +!macroend |
| 4 | + |
| 5 | +!macro preInit |
| 6 | + ; This macro is inserted at the beginning of the NSIS .OnInit callback |
| 7 | + ; Check Windows version and enforce minimum Windows 10 requirement |
| 8 | + |
| 9 | + ; Get Windows version using a more reliable method |
| 10 | + ${If} ${AtLeastWin10} |
| 11 | + ; Windows 10 or later - continue with installation |
| 12 | + Goto continue_install |
| 13 | + ${Else} |
| 14 | + ; Check if it's Windows 8.1 or earlier |
| 15 | + ${If} ${AtLeastWin8.1} |
| 16 | + ; Windows 8.1 - show error and abort |
| 17 | + MessageBox MB_OK|MB_ICONSTOP "This application requires Windows 10 or later.$\r$\n$\r$\nWindows 8.1 is not supported.$\r$\n$\r$\nPlease upgrade to Windows 10 or later to continue." |
| 18 | + Abort "Windows version requirement not met" |
| 19 | + ${Else} |
| 20 | + ; Windows 8 or earlier - show error and abort |
| 21 | + MessageBox MB_OK|MB_ICONSTOP "This application requires Windows 10 or later.$\r$\n$\r$\nYour Windows version is not supported.$\r$\n$\r$\nPlease upgrade to Windows 10 or later to continue." |
| 22 | + Abort "Windows version requirement not met" |
| 23 | + ${EndIf} |
| 24 | + ${EndIf} |
| 25 | + |
| 26 | + continue_install: |
| 27 | + ; Continue with normal installation process |
| 28 | +!macroend |
| 29 | + |
| 30 | +!macro customInit |
| 31 | + ; Custom initialization macro |
| 32 | + ; This runs after preInit and can be used for additional setup |
| 33 | +!macroend |
| 34 | + |
| 35 | +!macro customInstall |
| 36 | + ; Custom installation macro |
| 37 | + ; This runs during the installation process |
| 38 | + ; Only run for fresh installs, not updates |
| 39 | + ${ifNot} ${isUpdated} |
| 40 | + ; This code only runs for fresh installations |
| 41 | + ; Basic installation logic can be added here |
| 42 | + ${endIf} |
| 43 | +!macroend |
| 44 | + |
| 45 | +!macro customInstallMode |
| 46 | + ; Custom install mode macro |
| 47 | + ; Can be used to set $isForceMachineInstall or $isForceCurrentInstall |
| 48 | + ; to enforce one or the other modes |
| 49 | +!macroend |
| 50 | + |
| 51 | +!macro customWelcomePage |
| 52 | + ; Custom welcome page macro |
| 53 | + ; Welcome Page is not added by default for installer |
| 54 | + ; Uncomment the line below if you want to add a custom welcome page |
| 55 | + ; !insertMacro MUI_PAGE_WELCOME |
| 56 | +!macroend |
| 57 | + |
| 58 | +!macro customUnWelcomePage |
| 59 | + ; Custom uninstaller welcome page macro |
| 60 | + ; Uncomment and customize if you want a custom uninstaller welcome page |
| 61 | + ; !define MUI_WELCOMEPAGE_TITLE "Uninstall Session Desktop" |
| 62 | + ; !define MUI_WELCOMEPAGE_TEXT "This will remove Session Desktop from your computer.$\r$\n$\r$\nClick Uninstall to continue." |
| 63 | + ; !insertmacro MUI_UNPAGE_WELCOME |
| 64 | +!macroend |
| 65 | + |
| 66 | +!macro customUnInstallSection |
| 67 | + ; Custom uninstall section macro |
| 68 | + ; You can add some uninstall section as component page |
| 69 | + ; If defined, then always run after `customUnInstall` |
| 70 | + ; Section /o "un.Some cool checkbox" |
| 71 | + ; ; Add custom uninstall options here if needed |
| 72 | + ; SectionEnd |
| 73 | +!macroend |
| 74 | + |
| 75 | +!macro customUnInit |
| 76 | + ; Custom uninstaller initialization macro |
| 77 | + ; This runs when the uninstaller starts |
| 78 | +!macroend |
| 79 | + |
| 80 | +!ifndef BUILD_UNINSTALLER |
| 81 | + Function AddToStartup |
| 82 | + CreateShortCut "$SMSTARTUP\Session.lnk" "$INSTDIR\Session.exe" "" |
| 83 | + FunctionEnd |
| 84 | + |
| 85 | + ; Using the readme setting as an easy way to add an add to startup option |
| 86 | + !define MUI_FINISHPAGE_SHOWREADME |
| 87 | + !define MUI_FINISHPAGE_SHOWREADME_TEXT "Start Session when Windows starts" |
| 88 | + !define MUI_FINISHPAGE_SHOWREADME_FUNCTION AddToStartup |
| 89 | +!endif |
| 90 | + |
| 91 | +!macro customUnInstall |
| 92 | + ; Custom uninstall macro |
| 93 | + ; This runs during the uninstallation process |
| 94 | + Delete "$SMSTARTUP\Session.lnk" |
| 95 | +!macroend |
| 96 | + |
| 97 | +!macro customRemoveFiles |
| 98 | + ; Custom remove files macro |
| 99 | + ; This runs when removing files during uninstallation |
| 100 | +!macroend |
| 101 | + |
| 102 | +; ======================================== |
| 103 | +; CUSTOM COMPONENTS SECTIONS |
| 104 | +; ======================================== |
| 105 | + |
| 106 | +!macro customComponents |
| 107 | + ; Add custom components page with checkboxes |
| 108 | + !insertMacro MUI_PAGE_COMPONENTS |
| 109 | +!macroend |
| 110 | + |
| 111 | +; Simple checkbox sections |
| 112 | +Section "Startup" StartupSection |
| 113 | + SetOutPath "$INSTDIR" |
| 114 | +SectionEnd |
| 115 | + |
| 116 | +Section "Taskbar" TaskbarSection |
| 117 | + SetOutPath "$INSTDIR" |
| 118 | +SectionEnd |
0 commit comments