1; sample NSIS description file for a ioquake3 mod installer
2
3!define NAME "Catch the Chicken"
4!define FSNAME "ioquake3-q3ctc"
5!define VERSION "1.4"
6!define RELEASE "1"
7!define MODDIR "q3ctc"
8!define PUBLISHER "The ioquake3 Team"
9!define URL "http://ioquake3.org/"
10; uncomment if the mod works without baseq3
11;!define STANDALONE
12
13!define MUI_ICON "../quake3.ico"
14
15!macro FILES
16  File ctc0.pk3
17  File ctc1.pk3
18  File description.txt
19  File gfx/chicken.jpg
20  File gfx/egggun.jpg
21  File gfx/q3ctc.gif
22  File q3ctc.config
23  File q3ctcteam.config
24  File readme.html
25  File readmeFirst.txt
26!macroend
27
28; no need to edit below in theory
29
30SetCompressor lzma
31
32!define MULTIUSER_MUI
33!define MULTIUSER_EXECUTIONLEVEL Highest
34!define MULTIUSER_INSTALLMODE_COMMANDLINE
35!define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY "Software\ioquake3"
36!define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME "Install_Mode"
37!define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY "Software\ioquake3"
38!define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME "Install_Dir"
39!define MULTIUSER_INSTALLMODE_INSTDIR "ioquake3"
40!include MultiUser.nsh
41
42!include "FileFunc.nsh"
43
44!include "MUI2.nsh"
45
46; The name of the installer
47Name "${NAME}-${VERSION} for ioquake3"
48
49; The file to write
50OutFile "${FSNAME}-${VERSION}-${RELEASE}.x86.exe"
51
52;Interface Settings
53
54!define MUI_ABORTWARNING
55
56;--------------------------------
57;Pages
58
59!insertmacro MULTIUSER_PAGE_INSTALLMODE
60;!insertmacro MUI_PAGE_LICENSE "id_patch_pk3s_Q3A_EULA.txt"
61!define MUI_COMPONENTSPAGE_NODESC
62!insertmacro MUI_PAGE_COMPONENTS
63!insertmacro MUI_PAGE_DIRECTORY
64!insertmacro MUI_PAGE_INSTFILES
65
66!insertmacro MUI_UNPAGE_CONFIRM
67!insertmacro MUI_UNPAGE_INSTFILES
68
69;--------------------------------
70;Languages
71
72!insertmacro MUI_LANGUAGE "English"
73
74;--------------------------------
75
76;--------------------------------
77;Multiuser stuff
78Function .onInit
79  !insertmacro MULTIUSER_INIT
80  ReadRegStr $0 SHCTX "Software\ioquake3" ${MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME}
81  IfErrors 0 oninitdone
82    MessageBox MB_OK "You need to install the ioquake3 engine first"
83    Abort
84  oninitdone:
85FunctionEnd
86
87Function un.onInit
88  !insertmacro MULTIUSER_UNINIT
89FunctionEnd
90
91; The stuff to install
92Section "${NAME}" sec_base
93
94  SectionIn RO
95
96  SetOutPath $INSTDIR
97
98  SetOutPath "$INSTDIR\${MODDIR}"
99
100  !insertmacro FILES
101
102  ; Write the uninstall keys for Windows
103  WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${FSNAME}" "DisplayName" "${NAME}"
104  WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${FSNAME}" "DisplayVersion" "${VERSION}-${RELEASE}"
105  WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${FSNAME}" "Publisher" "${PUBLISHER}"
106  WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${FSNAME}" "URLInfoAbout" "${URL}"
107  WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${FSNAME}" "UninstallString" '"$INSTDIR\uninstall-${FSNAME}.exe"'
108  WriteRegDWORD SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${FSNAME}" "NoModify" 1
109  WriteRegDWORD SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${FSNAME}" "NoRepair" 1
110
111  WriteUninstaller "uninstall-${FSNAME}.exe"
112
113!ifdef STANDALONE
114!define ARGS "+set com_standalone 1 "
115!else
116!define ARGS ""
117!endif
118  CreateShortCut "$SMPROGRAMS\ioquake3\${NAME}.lnk" "$INSTDIR\ioquake3.x86.exe" "${ARGS}+set fs_game ${MODDIR}" "$INSTDIR\ioquake3.x86.exe" 0 "" "" "${NAME}"
119
120SectionEnd
121
122Section "Uninstall"
123
124  ; Remove registry keys
125  DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${FSNAME}"
126
127  ; Remove files and uninstaller
128  Delete $INSTDIR\${MODDIR}\*
129
130  Delete $INSTDIR\uninstall-${FSNAME}.exe
131
132  ; Remove shortcuts, if any
133  Delete "$SMPROGRAMS\ioquake3\${NAME}.lnk"
134
135  ; Remove directories used
136  RMDir "$SMPROGRAMS\ioquake3"
137  RMDir "$INSTDIR\${MODDIR}"
138  RMDir "$INSTDIR"
139
140SectionEnd
141