annotate packaging/nagslang.nsi @ 669:30ae339d7224

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