166
|
1 ; Compile with ./scripts/makensis ./scripts/sypikslang.nsi .
|
|
2 ; You'll need to have previously run wine-py2exe
|
|
3
|
|
4 !include "MUI.nsh"
|
|
5
|
|
6 ; Application Details
|
|
7
|
|
8 !define SY_VERSION "0.0.0" ; set by makensis scripts
|
|
9 !define SY_UNPACK "sypikslang-${SY_VERSION}"
|
|
10 !define DIST_FOLDER "../dist"
|
|
11
|
|
12 Name "Sypikslang"
|
|
13 OutFile "${DIST_FOLDER}\sypikslang-${SY_VERSION}.exe"
|
|
14 InstallDir "$PROGRAMFILES\Sypikslang-${SY_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 SY_ICON "../data/icons/icon.ico"
|
|
31 !define SY_WINDOWS_ICON "data\icons\icon.ico"
|
|
32 !define SY_PY2EXE_ZIP "sypikslang-${SY_VERSION}.zip"
|
|
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 "${SY_ICON}"
|
|
53 SetCompress off ; all the big stuff is already compressed
|
|
54
|
|
55 ; Installer Sections
|
|
56
|
|
57 Section "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
|
|
69 install:
|
|
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
|
|
77 done:
|
|
78
|
|
79 DetailPrint "MS runtime libraries already installed, skipping"
|
|
80
|
|
81 SectionEnd
|
|
82
|
|
83 Section "Sypikslang"
|
|
84 SetOutPath "$INSTDIR"
|
|
85
|
|
86 WriteUninstaller "$INSTDIR\${UNINSTALLER}"
|
|
87
|
|
88 File "${DIST_FOLDER}\${SY_PY2EXE_ZIP}"
|
|
89 File "${SY_ICON}"
|
|
90
|
|
91 ZipDLL::extractall "$INSTDIR\${SY_PY2EXE_ZIP}" "$INSTDIR"
|
|
92 Delete "$INSTDIR\${SY_PY2EXE_ZIP}"
|
|
93
|
|
94 CreateDirectory "$SMPROGRAMS\Sypikslang"
|
|
95
|
|
96 # link.lnk target.exe
|
|
97 # parameters icon.file icon_index_number start_options
|
|
98 # keyboard_shortcut description
|
|
99
|
|
100 CreateShortCut "$SMPROGRAMS\Sypikslang\Sypikslang ${SY_VERSION}.lnk" "$INSTDIR\${SY_UNPACK}\sypikslang.exe" \
|
|
101 "" "$INSTDIR\${SY_UNPACK}\${SY_WINDOWS_ICON}" "" SW_SHOWNORMAL \
|
|
102 "" "Sypikslang"
|
|
103
|
|
104 CreateShortCut "$SMPROGRAMS\Sypikslang\Uninstall Sypikslang ${SY_VERSION}.lnk" "$INSTDIR\${UNINSTALLER}" \
|
|
105 "" "" "" SW_SHOWNORMAL \
|
|
106 "" "Uninstall Sypikslang"
|
|
107
|
|
108 SectionEnd
|
|
109
|
|
110 UninstallText "This will uninstall Sypikslang ${SY_VERSION}."
|
|
111 UninstallIcon "${SY_ICON}"
|
|
112
|
|
113 Section "Uninstall"
|
|
114 ; Delete files not deleted during install
|
|
115 Delete "$INSTDIR\${SY_ICON}"
|
|
116
|
|
117 ; Remove py2exe folder
|
|
118 RMDir /r /REBOOTOK "$INSTDIR\${SY_UNPACK}"
|
|
119
|
|
120 ; Remove shortcut links
|
|
121 Delete "$SMPROGRAMS\Sypikslang\Sypikslang ${SY_VERSION}.lnk"
|
|
122 Delete "$SMPROGRAMS\Sypikslang\Uninstall Sypikslang ${SY_VERSION}.lnk"
|
|
123
|
|
124 ; Remove shortcut folder if no links left
|
|
125 IfFileExists "$SMPROGRAMS\Sypikslang\*.lnk" shortcuts_exist 0
|
|
126 RMDir /REBOOTOK "$SMPROGRAMS\Sypikslang"
|
|
127 shortcuts_exist:
|
|
128
|
|
129 ; Final Clean up (no point doing this while the uninstall is incomplete)
|
|
130 RMDir /r /REBOOTOK $INSTDIR
|
|
131
|
|
132 ; Offer to reboot if needed
|
|
133 IfRebootFlag 0 noreboot
|
|
134 MessageBox MB_YESNO "A reboot is required to finish the uninstallation. Do you wish to reboot now?" IDNO noreboot
|
|
135 Reboot
|
|
136 noreboot:
|
|
137
|
|
138 ; TODO: We don't touch the vcredist stuff, since we can't tell a) if we were
|
|
139 ; the ones who installed it and b) if anything else needs it. This may cause
|
|
140 ; cruft on the users system, so should we tell the user?
|
|
141
|
|
142 SectionEnd
|