Sic08/SicSetup/Sic_Setup/CVD.nsi

175 lines
4.0 KiB
Plaintext
Raw Normal View History

;NSIS Modern User Interface
2023-03-03 15:42:13 +08:00
;Basic Example Script
;Written by Joost Verburg
;--------------------------------
;Include Modern UI
!include "MUI2.nsh"
;--------------------------------
; Password
!define Password "sic2023"
;PasswordBox ID
!define IDC_PASSWORD 1214
2023-03-03 15:42:13 +08:00
;--------------------------------
;General
!getdllversion "sicui\sicui.exe" ver
;Name and file
2023-12-14 08:33:08 +08:00
Name "Sic Evaluation Edition v${ver1}.${ver2}.${ver3}.${ver4}"
OutFile "Sic_EVE_Setup_v${ver1}.${ver2}.${ver3}.${ver4}.exe"
2023-03-03 15:42:13 +08:00
;Default installation folder
;InstallDir "$LOCALAPPDATA\Modern UI Test"
InstallDir "C:\Sic"
;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\Sicentury\CVD" ""
;Request application privileges for Windows Vista
RequestExecutionLevel user
;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
;--------------------------------
;Pages@
2023-03-03 15:42:13 +08:00
Page Custom PasswordPageShow PasswordPageLeave
2023-03-03 15:42:13 +08:00
!insertmacro MUI_PAGE_LICENSE "License.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
2023-03-03 15:42:13 +08:00
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Installer Sections
Section "Control Apps" SecControlApp
2023-03-03 15:42:13 +08:00
SetOutPath "$INSTDIR"
;ADD YOUR OWN FILES HERE...
SetOutPath "$INSTDIR\SicUI"
File /r "SicUI\*"
SetOutPath "$INSTDIR\SicRT"
File /r "SicRT\*"
;Store installation folder
WriteRegStr HKCU "Software\Sicentury\CVD" "" $INSTDIR
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
;CreateShortCut "$DESKTOP\SicRTIPConfig.lnk" "$INSTDIR\SicUI\SicUI.exe" "--is-set-rt-ip" "$INSTDIR\SicUI\RtIpAddressSetting.ico" 0
2023-03-03 15:42:13 +08:00
CreateShortCut "$DESKTOP\SicUI.lnk" "$INSTDIR\SicUI\SicUI.exe"
SectionEnd
Section "Simulator" SecSim
SetOutPath "$INSTDIR"
;ADD YOUR OWN FILES HERE...
SetOutPath "$INSTDIR\SicSimulator"
File /r "SicSimulator\*"
;Store installation folder
WriteRegStr HKCU "Software\Sicentury\CVD" "" $INSTDIR
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
CreateShortCut "$DESKTOP\SicSimulator.lnk" "$INSTDIR\SicSimulator\SicSimulator.exe"
SectionEnd
2023-03-03 15:42:13 +08:00
;--------------------------------
;Descriptions
;Language strings
LangString DESC_SecControlApp ${LANG_ENGLISH} "Install SicRT and SicUI."
LangString DESC_SecSim ${LANG_ENGLISH} "Install Simulator."
2023-03-03 15:42:13 +08:00
;Assign language strings to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecControlApp} $(DESC_SecControlApp)
!insertmacro MUI_DESCRIPTION_TEXT ${SecSim} $(DESC_SecSim)
2023-03-03 15:42:13 +08:00
!insertmacro MUI_FUNCTION_DESCRIPTION_END
;--------------------------------
;Uninstaller Section
Section "Uninstall"
;ADD YOUR OWN FILES HERE...
Delete "$INSTDIR\Uninstall.exe"
Delete "$DESKTOP\SicRTIPConfig.lnk"
Delete "$DESKTOP\SicUI.lnk"
Delete "$DESKTOP\SicSimulator.lnk"
2023-03-03 15:42:13 +08:00
RMDir /r "$INSTDIR\SicUI"
RMDir /r "$INSTDIR\SicRT"
RMDir /r "$INSTDIR\SicSimulator"
2023-03-03 15:42:13 +08:00
DeleteRegKey /ifempty HKCU "Software\Sicentury\CVD"
SectionEnd
;--------------------------------
; Password Dialog Functions
## Displays the password dialog
Function PasswordPageShow
!insertmacro MUI_HEADER_TEXT "CAUTION!" "This is an EVALUATION version for testing or training purposes, DO NOT use it in a production environment!"
PassDialog::InitDialog Password /HEADINGTEXT "Enter a password to install"
Pop $R0 # Page HWND
# Use the following code to set a custom password character
;GetDlgItem $R1 $R0 ${IDC_PASSWORD}
;SendMessage $R1 ${EM_SETPASSWORDCHAR} 178 0
PassDialog::Show
FunctionEnd
## Validate password
Function PasswordPageLeave
## Pop password from stack
Pop $R0
## A bit of validation
StrCmp $R0 '${Password}' +3
MessageBox MB_OK|MB_ICONEXCLAMATION "The password is incorrect!"
Abort
FunctionEnd
Function ComponentsPageShow
## Disable the Back button
GetDlgItem $R0 $HWNDPARENT 3
EnableWindow $R0 0
FunctionEnd