source: trunk/windows/windows_installer.nsi @ 190

Revision 190, 4.3 KB checked in by guyru, 3 years ago (diff)

Updated the nsis installer script

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1; installer.nsi
2;
3; This is the NSIS installer script for Open Yahtzee.
4;
5;
6;
7;--------------------------------
8!define version 1.9
9;--------------------------------
10;Include Modern UI
11
12  !include "MUI2.nsh"
13
14;--------------------------------
15
16; The name of the installer
17Name "Open Yahtzee ${version}"
18
19; The file to write
20OutFile "openyahtzee-${version}.exe"
21
22; The default installation directory
23InstallDir "$PROGRAMFILES\Open Yahtzee"
24
25;hides details of the install and uninstall but allows the users to see them if he wants
26ShowInstDetails hide
27ShowUninstDetails hide
28
29; Registry key to check for directory (so if you install again, it will
30; overwrite the old one automatically)
31InstallDirRegKey HKLM "Software\Open Yahtzee" "Install_Dir"
32
33; set the icon for installer
34;Icon "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
35!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
36!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico"
37
38;--------------------------------
39;Interface Settings
40
41  !define MUI_ABORTWARNING
42
43;--------------------------------
44;Pages
45
46  !insertmacro MUI_PAGE_LICENSE "COPYING.txt"
47  !insertmacro MUI_PAGE_COMPONENTS
48  !insertmacro MUI_PAGE_DIRECTORY
49  !insertmacro MUI_PAGE_INSTFILES
50 
51  !insertmacro MUI_UNPAGE_CONFIRM
52  !insertmacro MUI_UNPAGE_INSTFILES
53 
54;--------------------------------
55
56; The stuff to install
57Section "Open Yahtzee-${version} (required)" SecOpenYahtzee
58
59  SectionIn RO
60 
61  ; Set output path to the installation directory.
62  SetOutPath $INSTDIR
63 
64  ; Put file there
65  File "openyahtzee.exe"
66  File "COPYING.txt"
67  File "ChangeLog.txt"
68
69  ; Copy the runtime dlls
70  SetOutPath "$INSTDIR\Microsoft.VC90.CRT"
71  File "Microsoft.VC90.CRT\*.dll"
72  File "Microsoft.VC90.CRT\*.manifest"
73 
74  ; Write the installation path into the registry
75  WriteRegStr HKLM "Software\Open Yahtzee" "Install_Dir" "$INSTDIR"
76 
77  ; Write the uninstall keys for Windows
78  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Open Yahtzee" "DisplayName" "Open Yahtzee"
79  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Open Yahtzee" "UninstallString" '"$INSTDIR\uninstall.exe"'
80  WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Open Yahtzee" "NoModify" 1
81  WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Open Yahtzee" "NoRepair" 1
82  WriteUninstaller "uninstall.exe"
83 
84SectionEnd
85
86; Optional section (can be disabled by the user)
87Section "Start Menu Shortcuts" SecStartMenu
88  ; Remove old shortcuts, if any
89  Delete "$SMPROGRAMS\OpenYahtzee\*.*"
90  Delete "$SMPROGRAMS\Open Yahtzee\*.*"
91
92  CreateDirectory "$SMPROGRAMS\Open Yahtzee"
93  CreateShortCut "$SMPROGRAMS\Open Yahtzee\Open Yahtzee.lnk" "$INSTDIR\openyahtzee.exe" "" "$INSTDIR\openyahtzee.exe" 0
94  CreateShortCut "$SMPROGRAMS\Open Yahtzee\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
95 
96SectionEnd
97;--------------------------------
98;Languages
99 
100  !insertmacro MUI_LANGUAGE "English"
101
102;--------------------------------
103;Descriptions
104
105  ;Language strings
106  LangString DESC_SecOpenYahtzee ${LANG_ENGLISH} "The Open Yahtzee game files and the required libraries."
107  LangString DESC_SecStartMenu ${LANG_ENGLISH} "Create shortcuts in the Start menu"
108
109  ;Assign language strings to sections
110  !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
111    !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenYahtzee} $(DESC_SecOpenYahtzee)
112    !insertmacro MUI_DESCRIPTION_TEXT ${SecStartMenu} $(DESC_SecStartMenu)
113  !insertmacro MUI_FUNCTION_DESCRIPTION_END
114
115;--------------------------------
116
117; Uninstaller
118
119Section "Uninstall"
120 
121  ; Remove registry keys
122  DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Open Yahtzee"
123  DeleteRegKey HKLM "SOFTWARE\Open Yahtzee"
124
125  ; Remove files and uninstaller
126  Delete "$INSTDIR\openyahtzee.exe"
127  Delete "$INSTDIR\COPYING.txt"
128  Delete "$INSTDIR\ChangeLog.txt"
129  Delete "$INSTDIR\uninstall.exe"
130  Delete "$INSTDIR\Microsoft.VC90.CRT\*.*"
131  ; Remove old files
132  Delete "$INSTDIR\openyahtzee.exe.manifest"
133  Delete "$INSTDIR\mingwm10.dll"
134  Delete "$INSTDIR\icon32.ico"
135
136  RMDir "$INSTDIR\Microsoft.VC90.CRT"
137  Delete "$INSTDIR\*"
138
139
140  ; Remove shortcuts, if any
141  Delete "$SMPROGRAMS\Open Yahtzee\*.*"
142
143  ; Remove directories used
144  RMDir "$SMPROGRAMS\Open Yahtzee"
145  RMDir "$INSTDIR"
146
147SectionEnd
Note: See TracBrowser for help on using the repository browser.