!ifndef VERSION !define VERSION '__VERSION__' !endif ;-------------------------------- ;Configuration !ifdef OUTFILE OutFile "${OUTFILE}" !else OutFile Output/aqualung-setup.exe !endif SetCompressor /SOLID lzma InstType "Full" InstType "Compact" InstType "Minimal" InstallDir $PROGRAMFILES\Aqualung InstallDirRegKey HKLM Software\Aqualung "" RequestExecutionLevel admin ;-------------------------------- ;Header Files !include "MUI.nsh" !include "Sections.nsh" !include "LogicLib.nsh" !include "Memento.nsh" ;-------------------------------- ;Definitions !define SHCNE_ASSOCCHANGED 0x8000000 !define SHCNF_IDLIST 0 ;-------------------------------- ;Configuration ;Names Name "Aqualung" Caption "Aqualung ${VERSION} Setup" BrandingText " " ;Memento Settings !define MEMENTO_REGISTRY_ROOT HKLM !define MEMENTO_REGISTRY_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aqualung" ;Interface Settings !define MUI_HEADERIMAGE !define MUI_HEADERIMAGE_BITMAP "header.bmp" !define MUI_ABORTWARNING !define MUI_WELCOMEFINISHPAGE_BITMAP "side.bmp" !define MUI_COMPONENTSPAGE_SMALLDESC ;Pages !define MUI_WELCOMEPAGE_TITLE "Welcome to the Aqualung ${VERSION} Setup Wizard" !define MUI_WELCOMEPAGE_TEXT "Aqualung plays audio CDs, internet radio streams and podcasts as well as soundfiles in just about any audio format and has the feature of inserting no gaps between adjacent tracks.\r\n\r\nThis wizard will guide you through the installation of Aqualung ${VERSION}, an advanced music player originally targeted at the GNU/Linux operating system, today also running on FreeBSD, OpenBSD and Microsoft Windows.\r\n\r\n$_CLICK" !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_LICENSE "c:\aqualung\COPYING.txt" LicenseForceSelection radiobuttons !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES ;!define MUI_FINISHPAGE_TEXT "Aqualung has been installed on your computer.\r\n\r\nYou are under no obligation to pay for Aqualung. However, if you like it and use it a lot, please consider donating -- any amount is welcome.\r\n\r\nClick Finish to close this wizard." !define MUI_FINISHPAGE_LINK "Visit the Aqualung website" !define MUI_FINISHPAGE_LINK_LOCATION "http://aqualung.factorial.hu/" !define MUI_FINISHPAGE_RUN "$INSTDIR\aqualung.exe" !define MUI_FINISHPAGE_NOREBOOTSUPPORT ;!define MUI_FINISHPAGE_SHOWREADME ;!define MUI_FINISHPAGE_SHOWREADME_TEXT "Open User's Manual" ;!define MUI_FINISHPAGE_SHOWREADME_FUNCTION ShowReleaseNotes !insertmacro MUI_PAGE_FINISH !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES ;-------------------------------- ;Languages !insertmacro MUI_LANGUAGE "English" ;-------------------------------- ;Reserve Files ;These files should be inserted before other files in the data block ;ReserveFile "makensis.ini" !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS ;-------------------------------- ;Installer Sections ${MementoSection} "Aqualung" SecCore SetDetailsPrint textonly DetailPrint "Installing Aqualung Files..." SetDetailsPrint listonly SectionIn 1 2 3 RO RMDir /r $SMPROGRAMS\Aqualung SetOverwrite on SetOutPath $INSTDIR File c:\aqualung\COPYING.txt File c:\aqualung\aqualung.exe File c:\aqualung\aqualung.ico File c:\aqualung\*.dll SetOutPath $INSTDIR\doc File /r c:\aqualung\doc\* SetOutPath $INSTDIR\etc File /r c:\aqualung\etc\* SetOutPath $INSTDIR\images File /r c:\aqualung\images\* ; Choose the right systray image: Call GetWindowsVersion Pop $R0 StrCmp $R0 "XP" replace_systray StrCmp $R0 "2003" replace_systray StrCmp $R0 "Vista" replace_systray Goto no_replace replace_systray: Delete $INSTDIR\images\systray.png Rename $INSTDIR\images\systray2.png $INSTDIR\images\systray.png Goto end_core no_replace: Delete $INSTDIR\images\systray2.png end_core: ${MementoSectionEnd} ${MementoSection} "Desktop icon" SecDesktop SetDetailsPrint textonly DetailPrint "Installing Desktop Shortcut..." SetDetailsPrint listonly SectionIn 1 2 CreateShortCut "$DESKTOP\Aqualung.lnk" "$INSTDIR\aqualung.exe" "" "$INSTDIR\aqualung.ico" ${MementoSectionEnd} ${MementoSection} "Start Menu shortcuts" SecShortcuts SetDetailsPrint textonly DetailPrint "Installing Start Menu shortcuts..." SetDetailsPrint listonly SectionIn 1 2 CreateDirectory $SMPROGRAMS\Aqualung CreateShortCut "$SMPROGRAMS\Aqualung\Aqualung.lnk" "$INSTDIR\aqualung.exe" "" "$INSTDIR\aqualung.ico" CreateShortCut "$SMPROGRAMS\Aqualung\User's Manual.lnk" "$INSTDIR\doc\aqualung.pdf" CreateShortCut "$SMPROGRAMS\Aqualung\Uninstall Aqualung.lnk" "$INSTDIR\uninst-aqualung.exe" ${MementoSectionEnd} ${MementoSection} "LADSPA plugins" SecLADSPA SetDetailsPrint textonly DetailPrint "Installing LADSPA plugins..." SetDetailsPrint listonly SectionIn 1 2 SetOverwrite on SetOutPath $INSTDIR\ladspa File /r c:\aqualung\ladspa\* ${MementoSectionEnd} SectionGroup "Language support" SecLanguage ${MementoSection} "German" SecGerman SetDetailsPrint textonly DetailPrint "Installing German Translation..." SetDetailsPrint listonly SectionIn 1 SetOverwrite on SetOutPath $INSTDIR\lib\locale\de File /r c:\aqualung\lib\locale\de\* ${MementoSectionEnd} ${MementoSection} "Hungarian" SecHungarian SetDetailsPrint textonly DetailPrint "Installing Hungarian Translation..." SetDetailsPrint listonly SectionIn 1 SetOverwrite on SetOutPath $INSTDIR\lib\locale\hu File /r c:\aqualung\lib\locale\hu\* ${MementoSectionEnd} ${MementoSection} "Italian" SecItalian SetDetailsPrint textonly DetailPrint "Installing Italian Translation..." SetDetailsPrint listonly SectionIn 1 SetOverwrite on SetOutPath $INSTDIR\lib\locale\it File /r c:\aqualung\lib\locale\it\* ${MementoSectionEnd} ${MementoSection} "Russian" SecRussian SetDetailsPrint textonly DetailPrint "Installing Russian Translation..." SetDetailsPrint listonly SectionIn 1 SetOverwrite on SetOutPath $INSTDIR\lib\locale\ru File /r c:\aqualung\lib\locale\ru\* ${MementoSectionEnd} ${MementoSection} "Swedish" SecSwedish SetDetailsPrint textonly DetailPrint "Installing Swedish Translation..." SetDetailsPrint listonly SectionIn 1 SetOverwrite on SetOutPath $INSTDIR\lib\locale\sv File /r c:\aqualung\lib\locale\sv\* ${MementoSectionEnd} ${MementoSection} "Ukrainian" SecUkrainian SetDetailsPrint textonly DetailPrint "Installing Ukrainian Translation..." SetDetailsPrint listonly SectionIn 1 SetOverwrite on SetOutPath $INSTDIR\lib\locale\uk File /r c:\aqualung\lib\locale\uk\* ${MementoSectionEnd} SectionGroupEnd ${MementoSectionDone} Section -post SetDetailsPrint textonly DetailPrint "Creating Registry Keys..." SetDetailsPrint listonly SetOutPath $INSTDIR WriteRegStr HKLM "Software\Aqualung" "" $INSTDIR WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aqualung" "UninstallString" '"$INSTDIR\uninst-aqualung.exe"' WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aqualung" "InstallLocation" "$INSTDIR" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aqualung" "DisplayName" "Aqualung Music Player" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aqualung" "DisplayIcon" "$INSTDIR\aqualung.exe,0" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aqualung" "DisplayVersion" "${VERSION}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aqualung" "URLInfoAbout" "http://aqualung.factorial.hu/" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aqualung" "HelpLink" "http://aqualung.factorial.hu/win32" WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aqualung" "NoModify" "1" WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aqualung" "NoRepair" "1" !ifndef NO_STARTMENUSHORTCUTS IfFileExists $SMPROGRAMS\Aqualung "" no_startshortcuts SetDetailsPrint textonly DetailPrint "Creating Shortcuts..." SetDetailsPrint listonly no_startshortcuts: !endif WriteUninstaller $INSTDIR\uninst-aqualung.exe ;${MementoSectionSave} SetDetailsPrint both SectionEnd ;-------------------------------- ;Descriptions !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} "The core files required to run Aqualung" !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} "Desktop icon to launch Aqualung" !insertmacro MUI_DESCRIPTION_TEXT ${SecShortcuts} "Start Menu shortcuts to Aqualung, the Uninstaller and the User's Manual" !insertmacro MUI_DESCRIPTION_TEXT ${SecLADSPA} "LADSPA plugins may be used to enhance or alter the music while playing." !insertmacro MUI_DESCRIPTION_TEXT ${SecLanguage} "Language support to display Aqualung in your native language." !insertmacro MUI_DESCRIPTION_TEXT ${SecGerman} "German translation" !insertmacro MUI_DESCRIPTION_TEXT ${SecHungarian} "Hungarian translation" !insertmacro MUI_DESCRIPTION_TEXT ${SecItalian} "Italian translation" !insertmacro MUI_DESCRIPTION_TEXT ${SecRussian} "Russian translation" !insertmacro MUI_DESCRIPTION_TEXT ${SecSwedish} "Swedish translation" !insertmacro MUI_DESCRIPTION_TEXT ${SecUkrainian} "Ukrainian translation" !insertmacro MUI_FUNCTION_DESCRIPTION_END ;-------------------------------- ;Installer Functions Function .onInit ;-------------------------------- ;Check if Windows version is too old Call GetWindowsVersion Pop $R0 StrCmp $R0 "95" win_too_old StrCmp $R0 "98" win_too_old StrCmp $R0 "ME" win_too_old Goto win_ok win_too_old: MessageBox MB_OK|MB_ICONEXCLAMATION "Your Windows version (Windows $R0) is too old. You need Windows NT or newer to install Aqualung."; Abort win_ok: FunctionEnd ; GetWindowsVersion ; ; Based on Yazno's function, http://yazno.tripod.com/powerpimpit/ ; Updated by Joost Verburg ; ; Returns on top of stack ; ; Windows Version (95, 98, ME, NT x.x, 2000, XP, 2003, Vista) ; or ; '' (Unknown Windows Version) ; ; Usage: ; Call GetWindowsVersion ; Pop $R0 ; ; at this point $R0 is "NT 4.0" or whatnot Function GetWindowsVersion Push $R0 Push $R1 ClearErrors ReadRegStr $R0 HKLM \ "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion IfErrors 0 lbl_winnt ; we are not NT ReadRegStr $R0 HKLM \ "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber StrCpy $R1 $R0 1 StrCmp $R1 '4' 0 lbl_error StrCpy $R1 $R0 3 StrCmp $R1 '4.0' lbl_win32_95 StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98 lbl_win32_95: StrCpy $R0 '95' Goto lbl_done lbl_win32_98: StrCpy $R0 '98' Goto lbl_done lbl_win32_ME: StrCpy $R0 'ME' Goto lbl_done lbl_winnt: StrCpy $R1 $R0 1 StrCmp $R1 '3' lbl_winnt_x StrCmp $R1 '4' lbl_winnt_x StrCpy $R1 $R0 3 StrCmp $R1 '5.0' lbl_winnt_2000 StrCmp $R1 '5.1' lbl_winnt_XP StrCmp $R1 '5.2' lbl_winnt_2003 StrCmp $R1 '6.0' lbl_winnt_vista lbl_error lbl_winnt_x: StrCpy $R0 "NT $R0" 6 Goto lbl_done lbl_winnt_2000: Strcpy $R0 '2000' Goto lbl_done lbl_winnt_XP: Strcpy $R0 'XP' Goto lbl_done lbl_winnt_2003: Strcpy $R0 '2003' Goto lbl_done lbl_winnt_vista: Strcpy $R0 'Vista' Goto lbl_done lbl_error: Strcpy $R0 '' lbl_done: Pop $R1 Exch $R0 FunctionEnd ;Function ShowReleaseNotes ; ${If} ${FileExists} $WINDIR\hh.exe ; StrCpy $0 $WINDIR\hh.exe ; Exec '"$0" mk:@MSITStore:$INSTDIR\NSIS.chm::/SectionF.1.html' ; ${Else} ; SearchPath $0 hh.exe ; ${If} ${FileExists} $0 ; Exec '"$0" mk:@MSITStore:$INSTDIR\NSIS.chm::/SectionF.1.html' ; ${Else} ; ExecShell "open" "http://nsis.sourceforge.net/Docs/AppendixF.html#F.1" ; ${EndIf} ; ${EndIf} ;FunctionEnd ;-------------------------------- ;Uninstaller Section Section Uninstall SetDetailsPrint textonly DetailPrint "Uninstalling Aqualung..." SetDetailsPrint listonly IfFileExists $INSTDIR\aqualung.exe nsis_installed MessageBox MB_YESNO "It does not appear that Aqualung is installed in the directory '$INSTDIR'.$\r$\nContinue anyway (not recommended)?" IDYES nsis_installed Abort "Uninstall aborted by user" nsis_installed: SetDetailsPrint textonly DetailPrint "Deleting Registry Keys..." SetDetailsPrint listonly DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aqualung" DeleteRegKey HKLM "Software\Aqualung" SetDetailsPrint textonly DetailPrint "Deleting Files..." SetDetailsPrint listonly RMDir /r $SMPROGRAMS\Aqualung Delete "$DESKTOP\Aqualung.lnk" Delete $INSTDIR\* RMDir /r $INSTDIR SetDetailsPrint both SectionEnd