annotate scripts/sypikslang.nsi @ 203:4159e34d7310

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