/usr/share/doc/nsis/Examples/UserVars.nsi is in nsis-doc 2.46-7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | ; UserVars.nsi
;
; This script shows you how to declare and user variables.
;--------------------------------
Name "User Variables Text"
OutFile "UserVars.exe"
InstallDir "$PROGRAMFILES\User Variables Test"
RequestExecutionLevel admin
;--------------------------------
;Pages
Page directory
Page instfiles
UninstPage uninstConfirm
UninstPage instfiles
;--------------------------------
; Declaration of user variables (Var command), allowed charaters for variables names : [a-z][A-Z][0-9] and '_'
Var "Name"
Var "Serial"
Var "Info"
;--------------------------------
; Installer
Section "Dummy Section" SecDummy
StrCpy $0 "Admin"
StrCpy "$Name" $0
StrCpy "$Serial" "12345"
MessageBox MB_OK "User Name: $Name $\n$\nSerial Number: $Serial"
CreateDirectory $INSTDIR
WriteUninstaller "$INSTDIR\Uninst.exe"
SectionEnd
Section "Another Section"
Var /GLOBAL "AnotherVar"
StrCpy $AnotherVar "test"
SectionEnd
;--------------------------------
; Uninstaller
Section "Uninstall"
StrCpy $Info "User variables test uninstalled successfully."
Delete "$INSTDIR\Uninst.exe"
RmDir $INSTDIR
SectionEnd
Function un.OnUninstSuccess
HideWindow
MessageBox MB_OK "$Info"
FunctionEnd
|