source: packaging/nagslang.nsi@ 674:03fc9cf0f556

Last change on this file since 674:03fc9cf0f556 was 674:03fc9cf0f556, checked in by Neil Muller <drnlmuller@…>, 8 years ago

We have icons now, so I suppose is needed.

File size: 4.3 KB
Line 
1; Compile with ./scripts/makensis ./scripts/nagslang.nsi .
2; You'll need to have previously run wine-py2exe
3
4 !include "MUI.nsh"
5
6; Application Details
7
8 !define WS_VERSION "0.0.0" ; set by makensis scripts
9 !define WS_UNPACK "nagslang-${WS_VERSION}"
10 !define DIST_FOLDER "../dist"
11
12 Name "Werewolf Sonata"
13 OutFile "${DIST_FOLDER}\nagslang-${WS_VERSION}.exe"
14 InstallDir "$PROGRAMFILES\Werewolf-Sonata-${WS_VERSION}"
15
16; Interface Settings
17
18 !define MUI_ABORTWARNING
19
20 !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\arrow-install.ico"
21 !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\arrow-uninstall.ico"
22
23 !define MUI_HEADERIMAGE
24 !define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\orange.bmp"
25 !define MUI_HEADERIMAGE_UNBITMAP "${NSISDIR}\Contrib\Graphics\Header\orange-uninstall.bmp"
26
27; Dependencies
28
29 !define COMBINED_LICENSE "../LICENSE.txt"
30 !define WS_PY2EXE_ZIP "nagslang-${WS_VERSION}.zip"
31 !define WS_ICON "../data/icons/werewolf-sonata.ico"
32 !define WS_WINDOWS_ICON "data\icons\werewolf-sonata.ico"
33 !define VCREDIST "vcredist_x86.exe"
34 !define VCREDIST_KEY "{FF66E9F6-83E7-3A3E-AF14-8DE9A809A6A4}"
35 !define UNINSTALLER "Uninstaller.exe"
36
37; Pages
38
39 !insertmacro MUI_PAGE_LICENSE "${COMBINED_LICENSE}"
40 !insertmacro MUI_PAGE_DIRECTORY
41 !insertmacro MUI_PAGE_INSTFILES
42
43 !insertmacro MUI_UNPAGE_CONFIRM
44 !insertmacro MUI_UNPAGE_INSTFILES
45
46; Languages
47
48 !insertmacro MUI_LANGUAGE "English"
49
50; Other Stuff
51
52 Icon "${WS_ICON}"
53 SetCompress off ; all the big stuff is already compressed
54
55; Installer Sections
56
57Section "vcredist"
58
59 SetOutPath "$INSTDIR"
60 File "${DIST_FOLDER}\${VCREDIST}"
61 ; Check if it's already installed by checking for the uninstall key
62 ; Idea and key value to check taken post and comments at:
63 ; http://blogs.msdn.com/b/astebner/archive/2009/01/29/9384143.aspx
64
65 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${VCREDIST_KEY}" UninstallString
66 ; NSIS docs say if the key doesn't exist, we get an error and an empty string
67 IfErrors install done
68
69install:
70 ; Runs install with progress bar and no cancel button
71 ; Details taken from
72 ; http://blogs.msdn.com/b/astebner/archive/2010/10/18/9513328.aspx
73
74 DetailPrint "Installing required MS runtime libraries"
75 ExecWait "$INSTDIR/${VCREDIST} /qb!"
76
77done:
78
79 DetailPrint "MS runtime libraries already installed, skipping"
80
81SectionEnd
82
83Section "Werewolf Sonata"
84 SetOutPath "$INSTDIR"
85
86 WriteUninstaller "$INSTDIR\${UNINSTALLER}"
87
88 File "${DIST_FOLDER}\${WS_PY2EXE_ZIP}"
89 File "${WS_ICON}"
90
91 ZipDLL::extractall "$INSTDIR\${WS_PY2EXE_ZIP}" "$INSTDIR"
92 Delete "$INSTDIR\${WS_PY2EXE_ZIP}"
93
94 CreateDirectory "$SMPROGRAMS\Werewolf Sonata"
95
96 # link.lnk target.exe
97 # parameters icon.file icon_index_number start_options
98 # keyboard_shortcut description
99
100 CreateShortCut "$SMPROGRAMS\Werewolf Sonata\Werewolf Sonata ${WS_VERSION}.lnk" "$INSTDIR\${WS_UNPACK}\nagslang.exe" \
101 "" "$INSTDIR\${WS_UNPACK}\${WS_WINDOWS_ICON}" "" SW_SHOWNORMAL \
102 "" "Werewolf Sonata"
103
104 CreateShortCut "$SMPROGRAMS\Werewolf Sonata\Uninstall Werewolf Sonata ${WS_VERSION}.lnk" "$INSTDIR\${UNINSTALLER}" \
105 "" "" "" SW_SHOWNORMAL \
106 "" "Uninstall Werewolf Sonata"
107
108SectionEnd
109
110UninstallText "This will uninstall Werewolf Sonata ${WS_VERSION}."
111UninstallIcon "${WS_ICON}"
112
113Section "Uninstall"
114 ; Delete files not deleted during install
115
116 Delete "$INSTDIR\${WS_ICON}"
117
118 ; Remove py2exe folder
119 RMDir /r /REBOOTOK "$INSTDIR\${WS_UNPACK}"
120
121 ; Remove shortcut links
122 Delete "$SMPROGRAMS\Werewolf Sonata\Werewolf Sonata ${WS_VERSION}.lnk"
123 Delete "$SMPROGRAMS\Werewolf Sonata\Uninstall Werewolf Sonata ${WS_VERSION}.lnk"
124
125 ; Remove shortcut folder if no links left
126 IfFileExists "$SMPROGRAMS\Werewolf Sonata\*.lnk" shortcuts_exist 0
127 RMDir /REBOOTOK "$SMPROGRAMS\Werewolf Sonata"
128 shortcuts_exist:
129
130 ; Final Clean up (no point doing this while the uninstall is incomplete)
131 RMDir /r /REBOOTOK $INSTDIR
132
133 ; Offer to reboot if needed
134 IfRebootFlag 0 noreboot
135 MessageBox MB_YESNO "A reboot is required to finish the uninstallation. Do you wish to reboot now?" IDNO noreboot
136 Reboot
137 noreboot:
138
139 ; TODO: We don't touch the vcredist stuff, since we can't tell a) if we were
140 ; the ones who installed it and b) if anything else needs it. This may cause
141 ; cruft on the users system, so should we tell the user?
142
143SectionEnd
Note: See TracBrowser for help on using the repository browser.