source: branches/openyahtzee-1.8/windows/windows_installer.nsi @ 147

Last change on this file since 147 was 147, checked in by guyru, 7 years ago
  • Updated ChangeLOg
  • Updated NSIS installer scripts
  • Updated copyright years in the about dialog.
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.1 KB
Line 
1; installer.nsi
2;
3; This is the NSIS installer script for Open Yahtzee.
4;
5;
6;
7;--------------------------------
8!define version 1.8.1
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 "mingwm10.dll"
67  File "openyahtzee.exe.manifest"
68  File "COPYING.txt"
69  File "ChangeLog.txt"
70  File "icon32.ico"
71 
72  ; Write the installation path into the registry
73  WriteRegStr HKLM "Software\Open Yahtzee" "Install_Dir" "$INSTDIR"
74 
75  ; Write the uninstall keys for Windows
76  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Open Yahtzee" "DisplayName" "Open Yahtzee"
77  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Open Yahtzee" "UninstallString" '"$INSTDIR\uninstall.exe"'
78  WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Open Yahtzee" "NoModify" 1
79  WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Open Yahtzee" "NoRepair" 1
80  WriteUninstaller "uninstall.exe"
81 
82SectionEnd
83
84; Optional section (can be disabled by the user)
85Section "Start Menu Shortcuts" SecStartMenu
86  ; Remove old shortcuts, if any
87  Delete "$SMPROGRAMS\OpenYahtzee\*.*"
88  Delete "$SMPROGRAMS\Open Yahtzee\*.*"
89
90  CreateDirectory "$SMPROGRAMS\Open Yahtzee"
91  CreateShortCut "$SMPROGRAMS\Open Yahtzee\Open Yahtzee.lnk" "$INSTDIR\openyahtzee.exe" "" "$INSTDIR\icon32.ico" 0
92  CreateShortCut "$SMPROGRAMS\Open Yahtzee\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
93 
94SectionEnd
95;--------------------------------
96;Languages
97 
98  !insertmacro MUI_LANGUAGE "English"
99
100;--------------------------------
101;Descriptions
102
103  ;Language strings
104  LangString DESC_SecOpenYahtzee ${LANG_ENGLISH} "The Open Yahtzee game files and the required libraries."
105  LangString DESC_SecStartMenu ${LANG_ENGLISH} "Create shortcuts in the Start menu"
106
107  ;Assign language strings to sections
108  !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
109    !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenYahtzee} $(DESC_SecOpenYahtzee)
110    !insertmacro MUI_DESCRIPTION_TEXT ${SecStartMenu} $(DESC_SecStartMenu)
111  !insertmacro MUI_FUNCTION_DESCRIPTION_END
112
113;--------------------------------
114
115; Uninstaller
116
117Section "Uninstall"
118 
119  ; Remove registry keys
120  DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Open Yahtzee"
121  DeleteRegKey HKLM "SOFTWARE\Open Yahtzee"
122
123  ; Remove files and uninstaller
124  Delete "$INSTDIR\openyahtzee.exe"
125  Delete "$INSTDIR\openyahtzee.exe.manifest"
126  Delete "$INSTDIR\mingwm10.dll"
127  Delete "$INSTDIR\COPYING.txt"
128  Delete "$INSTDIR\ChangeLog.txt"
129  Delete "$INSTDIR\icon32.ico"
130  Delete "$INSTDIR\uninstall.exe"
131  Delete "$INSTDIR\*"
132
133  ; Remove shortcuts, if any
134  Delete "$SMPROGRAMS\Open Yahtzee\*.*"
135
136  ; Remove directories used
137  RMDir "$SMPROGRAMS\Open Yahtzee"
138  RMDir "$INSTDIR"
139
140SectionEnd
Note: See TracBrowser for help on using the repository browser.