]> Dogcows Code - chaz/yoink/blobdiff - arch/win32/yoink.nsi
repository reorganizing
[chaz/yoink] / arch / win32 / yoink.nsi
diff --git a/arch/win32/yoink.nsi b/arch/win32/yoink.nsi
new file mode 100644 (file)
index 0000000..4aa9a65
--- /dev/null
@@ -0,0 +1,151 @@
+;NSIS Modern User Interface
+;Start Menu Folder Selection Example Script
+;Written by Joost Verburg
+
+;--------------------------------
+;Include Modern UI
+
+  !include "MUI2.nsh"
+
+;--------------------------------
+;General
+
+  ;Name and file
+  Name "Yoink"
+  OutFile "${OUTFILE}"
+  SetCompressor /SOLID lzma
+
+  ;Default installation folder
+  InstallDir "$PROGRAMFILES\Yoink"
+  
+  ;Get installation folder from registry if available
+  InstallDirRegKey HKCU "Software\Yoink" ""
+
+  ;Request application privileges for Windows Vista
+  RequestExecutionLevel user
+
+;--------------------------------
+;Interface Settings
+
+  !define MUI_ICON "${ROOTPATH}/arch/win32/setup.ico"
+  !define MUI_UNICON "${ROOTPATH}/arch/win32/uninstall.ico"
+
+  !define MUI_COMPONENTSPAGE_SMALLDESC
+
+  !define MUI_FINISHPAGE_RUN "$INSTDIR\yoink.exe"
+  !define MUI_FINISHPAGE_RUN_NOTCHECKED
+  !define MUI_FINISHPAGE_LINK "Visit the Yoink website"
+  !define MUI_FINISHPAGE_LINK_LOCATION "http://www.dogcows.com/"
+
+  !define MUI_ABORTWARNING
+
+;--------------------------------
+;Pages
+
+  !insertmacro MUI_PAGE_WELCOME
+  !insertmacro MUI_PAGE_COMPONENTS
+  !insertmacro MUI_PAGE_DIRECTORY
+  !insertmacro MUI_PAGE_INSTFILES
+  !insertmacro MUI_PAGE_FINISH
+  
+  !insertmacro MUI_UNPAGE_CONFIRM
+  !insertmacro MUI_UNPAGE_INSTFILES
+
+;--------------------------------
+;Languages
+  !insertmacro MUI_LANGUAGE "English"
+
+;--------------------------------
+;Installer Sections
+
+Section "Install Yoink!" SecInstallYoink
+
+  SetOutPath "$INSTDIR"
+  
+  ;ADD YOUR OWN FILES HERE...
+  File /r "${INSTALLFILES}/*"
+  
+  ;Store installation folder
+  WriteRegStr HKCU "Software\Yoink" "" $INSTDIR
+  
+  ;Create uninstaller
+  WriteUninstaller "uninstall.exe"
+  
+  ;Create shortcuts
+  CreateDirectory "$SMPROGRAMS\Yoink"
+  CreateShortCut "$SMPROGRAMS\Yoink\Play Yoink!.lnk" "$INSTDIR\yoink.exe"
+  CreateShortCut "$SMPROGRAMS\Yoink\Uninstall.lnk" "$INSTDIR\uninstall.exe"
+
+  WriteRegStr HKCU "Software\Games\Yoink" "" "$INSTDIR"
+  WriteRegStr HKCU "Software\Games\Yoink" "Version" "${VERSION}"
+  WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Yoink" "DisplayName" "Yoink"
+  WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Yoink" "DisplayVersion" "${VERSION}"
+  WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Yoink" "UninstallString" "$INSTDIR\uninstall.exe"
+
+SectionEnd
+
+Section "Install desktop shortcut." SecInstallShortcut
+
+  ;Desktop shortcut
+  SetOverwrite on
+  CreateShortCut "$DESKTOP\Yoink.lnk" "$INSTDIR\yoink.exe"
+  SetOverwrite off
+
+SectionEnd
+
+;--------------------------------
+;Descriptions
+
+  ;Language strings
+  LangString DESC_SecInstallYoink ${LANG_ENGLISH} "Install the game executable and data files."
+  LangString DESC_SecInstallShortcut ${LANG_ENGLISH} "Install a shortcut to the executable on the desktop."
+
+  ;Assign language strings to sections
+  !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
+    !insertmacro MUI_DESCRIPTION_TEXT ${SecInstallYoink} $(DESC_SecInstallYoink)
+    !insertmacro MUI_DESCRIPTION_TEXT ${SecInstallShortcut} $(DESC_SecInstallShortcut)
+  !insertmacro MUI_FUNCTION_DESCRIPTION_END
+
+;--------------------------------
+;Uninstaller
+Section "Uninstall"
+
+  Delete "$SMPROGRAMS\Yoink\*.*"
+  RMDir "$SMPROGRAMS\Yoink"
+  Delete "$DESKTOP\Yoink.lnk"
+
+  DeleteRegKey /ifempty HKCU "Software\Games\Yoink"
+  DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Yoink"
+
+  RMDir /r "$INSTDIR"
+
+SectionEnd
+
+;--------------------------------
+;Functions
+
+Function .onInit
+
+;Run the uninstaller if Yoink is already installed.
+  ReadRegStr $R0 HKCU \
+  "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Yoink" \
+  "UninstallString"
+  StrCmp $R0 "" done
+  MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
+  "Yoink is already installed. $\n$\nClick `OK` to remove the \
+  previous version or `Cancel` to cancel the installation." \
+  IDOK uninst
+  Abort
+;Run the uninstaller
+uninst:
+  ClearErrors
+  ExecWait $INSTDIR\uninstall.exe
+done:
+
+FunctionEnd
+
This page took 0.019002 seconds and 4 git commands to generate.