1 ; Compile with ./scripts/makensis ./scripts/naja.nsi .
2 ; You'll need to have previously run wine-py2exe
8 !define WS_VERSION "0.0.0" ; set by makensis scripts
9 !define WS_UNPACK "naja-${WS_VERSION}"
10 !define DIST_FOLDER "../dist"
13 OutFile "${DIST_FOLDER}\naja-${WS_VERSION}.exe"
14 InstallDir "$PROGRAMFILES\Robolock-${WS_VERSION}"
18 !define MUI_ABORTWARNING
20 !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\arrow-install.ico"
21 !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\arrow-uninstall.ico"
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"
29 !define COMBINED_LICENSE "../LICENSE.txt"
30 !define WS_PY2EXE_ZIP "naja-${WS_VERSION}.zip"
31 !define WS_ICON "../data/icons/robolock.ico"
32 !define WS_WINDOWS_ICON "data\icons\robolock.ico"
33 !define VCREDIST "vcredist_x86.exe"
34 !define VCREDIST_KEY "{FF66E9F6-83E7-3A3E-AF14-8DE9A809A6A4}"
35 !define UNINSTALLER "Uninstaller.exe"
39 !insertmacro MUI_PAGE_LICENSE "${COMBINED_LICENSE}"
40 !insertmacro MUI_PAGE_DIRECTORY
41 !insertmacro MUI_PAGE_INSTFILES
43 !insertmacro MUI_UNPAGE_CONFIRM
44 !insertmacro MUI_UNPAGE_INSTFILES
48 !insertmacro MUI_LANGUAGE "English"
53 SetCompress off ; all the big stuff is already compressed
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
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
70 ; Runs install with progress bar and no cancel button
72 ; http://blogs.msdn.com/b/astebner/archive/2010/10/18/9513328.aspx
74 DetailPrint "Installing required MS runtime libraries"
75 ExecWait "$INSTDIR/${VCREDIST} /qb!"
79 DetailPrint "MS runtime libraries already installed, skipping"
86 WriteUninstaller "$INSTDIR\${UNINSTALLER}"
88 File "${DIST_FOLDER}\${WS_PY2EXE_ZIP}"
91 ZipDLL::extractall "$INSTDIR\${WS_PY2EXE_ZIP}" "$INSTDIR"
92 Delete "$INSTDIR\${WS_PY2EXE_ZIP}"
94 CreateDirectory "$SMPROGRAMS\Robolock"
97 # parameters icon.file icon_index_number start_options
98 # keyboard_shortcut description
100 CreateShortCut "$SMPROGRAMS\Robolock\Robolock ${WS_VERSION}.lnk" "$INSTDIR\${WS_UNPACK}\naja.exe" \
101 "" "$INSTDIR\${WS_UNPACK}\${WS_WINDOWS_ICON}" "" SW_SHOWNORMAL \
104 CreateShortCut "$SMPROGRAMS\Robolock\Uninstall Robolock ${WS_VERSION}.lnk" "$INSTDIR\${UNINSTALLER}" \
105 "" "" "" SW_SHOWNORMAL \
106 "" "Uninstall Robolock"
110 UninstallText "This will uninstall Robolock ${WS_VERSION}."
111 UninstallIcon "${WS_ICON}"
114 ; Delete files not deleted during install
116 Delete "$INSTDIR\${WS_ICON}"
118 ; Remove py2exe folder
119 RMDir /r /REBOOTOK "$INSTDIR\${WS_UNPACK}"
121 ; Remove shortcut links
122 Delete "$SMPROGRAMS\Robolock\Robolock ${WS_VERSION}.lnk"
123 Delete "$SMPROGRAMS\Robolock\Uninstall Robolock ${WS_VERSION}.lnk"
125 ; Remove shortcut folder if no links left
126 IfFileExists "$SMPROGRAMS\Robolock\*.lnk" shortcuts_exist 0
127 RMDir /REBOOTOK "$SMPROGRAMS\Robolock"
130 ; Final Clean up (no point doing this while the uninstall is incomplete)
131 RMDir /r /REBOOTOK $INSTDIR
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
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?