;============================ ; audacious.nsis.in ; ; Copyright 2013 Carlo Bramini ; ; Redistribution and use in source and binary forms, with or without ; modification, are permitted provided that the following conditions are met: ; ; 1. Redistributions of source code must retain the above copyright notice, ; this list of conditions, and the following disclaimer. ; ; 2. Redistributions in binary form must reproduce the above copyright notice, ; this list of conditions, and the following disclaimer in the documentation ; provided with the distribution. ; ; This software is provided "as is" and without any warranty, express or ; implied. In no event shall the authors be liable for any damages arising from ; the use of this software. ;============================ ; Gain the rights to write in protected directories RequestExecutionLevel admin ; Import global macro !include "MUI2.nsh" ; Import support for multi-user !define MULTIUSER_EXECUTIONLEVEL Highest !define MULTIUSER_MUI !include MultiUser.nsh Function .onInit !insertmacro MULTIUSER_INIT FunctionEnd Function un.onInit !insertmacro MULTIUSER_UNINIT FunctionEnd ; Import version number from configure !define VERSION "@VERSION@" ; Declare package name !define NAME "Audacious ${VERSION}" ; The name of the installer Name "${NAME}" ; The name of the package !define PACKAGE "Audacious-${VERSION}" ; The name of the uninstaller !define UNINSTALLER "$INSTDIR\Uninstall_audacious.exe" ; The path with the sources !define AUD_SOURCES "..\${PACKAGE}" ; The path with the NSIS resources !define AUD_NSIS "${AUD_SOURCES}\contrib\win32" ; The file to write OutFile "${PACKAGE}.exe" ; The default installation directory InstallDir $PROGRAMFILES\${PACKAGE} ; Assign icon to installer !define MUI_ICON "${AUD_NSIS}\audacious.ico" ; Assign icon to un-installer (TODO) ;!define MUI_UNICON "${AUD_NSIS}\audacious.ico" ; Customize the pages !define MUI_COMPONENTSPAGE_SMALLDESC ; Use a customized header bitmap (TODO) ;!define MUI_HEADERIMAGE ;!define MUI_HEADERIMAGE_BITMAP "${AUD_NSIS}\header.bmp" ; Use a customized WELCOME bitmap (TODO) ;!define MUI_WELCOMEFINISHPAGE_BITMAP "${AUD_NSIS}\welcome.bmp" ; Use a customized FINISH bitmap (TODO) ;!define MUI_UNWELCOMEFINISHPAGE_BITMAP "${AUD_NSIS}\finish.bmp" ; Install common pages !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_LICENSE share\audacious\COPYING !insertmacro MULTIUSER_PAGE_INSTALLMODE !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_FINISH !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES !insertmacro MUI_UNPAGE_FINISH ; Languages !insertmacro MUI_LANGUAGE "English" ;Installer Sections Section "Audacious (required)" SecPlayer SectionIn 1 2 RO SetOverwrite on SetOutPath "$INSTDIR\bin" File /r "bin\*.*" SetOutPath "$INSTDIR\etc" File /r "etc\*.*" SetOutPath "$INSTDIR\lib" File /r "lib\*.*" SetOutPath "$INSTDIR\share" File /r "share\*.*" ; create uninstaller WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${NAME}" "DisplayName" "${NAME}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${NAME}" "UninstallString" '"${UNINSTALLER}"' WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${NAME}" "NoModify" 1 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${NAME}" "NoRepair" 1 WriteUninstaller ${UNINSTALLER} SectionEnd Section "Add to the Start Menu" SecStartMenu SectionIn 1 2 ; Create shortcuts CreateDirectory "$SMPROGRAMS\${NAME}" CreateShortCut "$SMPROGRAMS\${NAME}\${PACKAGE}.lnk" "$INSTDIR\bin\audacious.exe" CreateShortCut "$SMPROGRAMS\${NAME}\Uninstall.lnk" "${UNINSTALLER}" SectionEnd Section "Add link to desktop" SecDesktopLink SectionIn 1 2 CreateShortCut "$DESKTOP\${NAME}.lnk" "$INSTDIR\bin\audacious.exe" SectionEnd Section "Uninstall" Delete ${UNINSTALLER} ; delete self (see explanation below why this works) Delete "$SMPROGRAMS\${NAME}\*.*" RMDir "$SMPROGRAMS\${NAME}" Delete "$DESKTOP\${NAME}.lnk" RMDir /r $INSTDIR\bin RMDir /r $INSTDIR\etc RMDir /r $INSTDIR\lib RMDir /r $INSTDIR\share RMDir $INSTDIR DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${NAME}" SectionEnd