changeset 460:d05ea729f0d5

NSIS scripts.
author Simon Cross <hodgestar@gmail.com>
date Sat, 17 Sep 2011 20:56:57 +0200
parents 7278518bde8d
children 11fe3636f755
files scripts/makensis scripts/mamba.nsi
diffstat 2 files changed, 122 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/makensis	Sat Sep 17 20:56:57 2011 +0200
@@ -0,0 +1,13 @@
+#!/bin/sh
+# Usage: makensis <nsi file>
+
+NSI_FILE="$1"
+#DEPENDENCIES_FOLDER="$2"
+MM_VERSION=`sed -ne 's/VERSION_STR = "\(.*\)"/\1/p' setup.py`
+TMP_NSI="$NSI_FILE.tmp"
+
+cp "$NSI_FILE" "$TMP_NSI"
+#sed -i -e "s#\\(\\s*!define DEPENDENCIES_FOLDER\\).*#\\1 \"$DEPENDENCIES_FOLDER\"#" "$TMP_NSI"
+sed -i -e "s#\\(\\s*!define MM_VERSION\\).*#\\1 \"$MM_VERSION\"#" "$TMP_NSI"
+makensis "$TMP_NSI"
+rm "$TMP_NSI"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/mamba.nsi	Sat Sep 17 20:56:57 2011 +0200
@@ -0,0 +1,109 @@
+; Compile with ./scripts/makensis ./scripts/mamba.nsi .
+; You'll need to have previously run wine-py2exe
+
+  !include "MUI.nsh"
+
+; Application Details
+
+  !define MM_VERSION "0.0.0" ; set by makensis scripts
+  !define MM_UNPACK "mutable-mamba-${MM_VERSION}"
+  !define DIST_FOLDER "../dist"
+
+  Name "Mutable Mamba"
+  OutFile "${DIST_FOLDER}\mutable-mamba-${MM_VERSION}.exe"
+  InstallDir "$PROGRAMFILES\Mutable-Mamba-${MM_VERSION}"
+
+; Interface Settings
+
+  !define MUI_ABORTWARNING
+
+  !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\arrow-install.ico"
+  !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\arrow-uninstall.ico"
+
+  !define MUI_HEADERIMAGE
+  !define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\orange.bmp"
+  !define MUI_HEADERIMAGE_UNBITMAP "${NSISDIR}\Contrib\Graphics\Header\orange-uninstall.bmp"
+
+; Dependencies
+
+  !define COMBINED_LICENSE "../LICENSE.txt"
+  !define MM_ICON "../data/icons/program/icon.ico"
+  !define MM_PY2EXE_ZIP "mutable-mamba-${MM_VERSION}.zip"
+  !define UNINSTALLER "Uninstaller.exe"
+
+; Pages
+
+  !insertmacro MUI_PAGE_LICENSE "${COMBINED_LICENSE}"
+  !insertmacro MUI_PAGE_DIRECTORY
+  !insertmacro MUI_PAGE_INSTFILES
+
+  !insertmacro MUI_UNPAGE_CONFIRM
+  !insertmacro MUI_UNPAGE_INSTFILES
+
+; Languages
+
+  !insertmacro MUI_LANGUAGE "English"
+
+; Other Stuff
+
+  Icon "${MM_ICON}"
+  SetCompress off ; all the big stuff is already compressed
+
+; Installer Sections
+
+Section "Mutable Mamba"
+  SetOutPath "$INSTDIR"
+
+  WriteUninstaller "$INSTDIR\${UNINSTALLER}"
+
+  File "${DIST_FOLDER}\${MM_PY2EXE_ZIP}"
+  File "${MM_ICON}"
+
+  ZipDLL::extractall "$INSTDIR\${MM_PY2EXE_ZIP}" "$INSTDIR"
+  Delete "$INSTDIR\${MM_PY2EXE_ZIP}"
+
+  CreateDirectory "$SMPROGRAMS\Mutable Mamba"
+
+  # link.lnk target.exe
+  #   parameters icon.file icon_index_number start_options
+  #   keyboard_shortcut description
+
+  CreateShortCut "$SMPROGRAMS\Mutable Mamba\Mutable Mamba ${MM_VERSION}.lnk" "$INSTDIR\${MM_UNPACK}\mamba.exe" \
+     "" "$INSTDIR\${MM_ICON}" "" SW_SHOWNORMAL \
+     "" "Mutable Mamba"
+
+  CreateShortCut "$SMPROGRAMS\Mutable Mamba\Uninstall Mutable Mamba ${MM_VERSION}.lnk" "$INSTDIR\${UNINSTALLER}" \
+     "" "" "" SW_SHOWNORMAL \
+     "" "Uninstall Mutable Mamba"
+
+SectionEnd
+
+UninstallText "This will uninstall Mutable Mamba ${MM_VERSION}."
+UninstallIcon "${MM_ICON}"
+
+Section "Uninstall"
+  ; Delete files not deleted during install
+  Delete "$INSTDIR\${MM_ICON}"
+
+  ; Remove py2exe folder
+  RMDir /r /REBOOTOK "$INSTDIR\${MM_UNPACK}"
+
+  ; Remove shortcut links
+  Delete "$SMPROGRAMS\Mutable Mamba\Mutable Mamba ${MM_VERSION}.lnk"
+  Delete "$SMPROGRAMS\Mutable Mamba\Uninstall Mutable Mamba ${MM_VERSION}.lnk"
+
+  ; Remove shortcut folder if no links left
+  IfFileExists "$SMPROGRAMS\Mutable Mamba\*.lnk" shortcuts_exist 0
+    RMDir /REBOOTOK "$SMPROGRAMS\Mutable Mamba"
+  shortcuts_exist:
+
+  ; Final Clean up (no point doing this while the uninstall is incomplete)
+  RMDir /r /REBOOTOK $INSTDIR
+
+  ; Offer to reboot if needed
+  IfRebootFlag 0 noreboot
+    MessageBox MB_YESNO "A reboot is required to finish the uninstallation. Do you wish to reboot now?" IDNO noreboot
+    Reboot
+  noreboot:
+
+SectionEnd