; vim: set enc=cp1250 sw=4 ts=4 sts=4 sta et ai : ; Project (image) name and version !define VMX "Ubuntu 7.04 Desktop" ; The VMX file !define VMX_FILE "${VMX}.vmx" ; File with the license (DO NOT forget to include the proper license in it!) !define LICENSE "${VMX} License.txt" ; VMWare player download link (from the http://www.vmware.com/download/player/download.html) -- most recent version !define VMP_DOWNLOAD_LINK "http://download3.vmware.com/software/vmplayer/VMware-player-2.0.0-45731.exe" ; or provide relative path to installer (when installing from a CD or any other media) ;!define VMP_LOCAL_LINK "$EXEDIR\VMware-player-2.0.0-45731.exe" ; Create LinuxEXPRES.cz icon in the start menu? !define CREATE_LE_ICON ;-------------------------------- ;Include Modern UI !include "MUI.nsh" ;-------------------------------- ;General ;Name and file Name "${VMX}" OutFile "${VMX} VMX Setup.exe" ;Default installation folder InstallDir "$DOCUMENTS\LinuxEXPRES\${VMX}" ;Get installation folder from registry if available InstallDirRegKey HKLM "Software\LinuxEXPRES\VMWare-NSIS\${VMX}" "" ;Because the size matters... SetCompressor /SOLID lzma ;-------------------------------- ;Interface Settings !define MUI_ABORTWARNING ;-------------------------------- ;Language Selection Dialog Settings ;Remember the installer language !define MUI_LANGDLL_REGISTRY_ROOT "HKCU" !define MUI_LANGDLL_REGISTRY_KEY "Software\LinuxEXPRES\VMWare-NSIS" !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language" ;-------------------------------- ;Pages !insertmacro MUI_PAGE_LICENSE "${LICENSE}" !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES !define MUI_FINISHPAGE_LINK "Další obrazy pro VMWare Player najdete na LinuxEXPRES.cz" !define MUI_FINISHPAGE_LINK_LOCATION "hLinuxEXPRES.icottp://www.linuxexpres.cz" !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\${VMX_FILE}" !define MUI_FINISHPAGE_SHOWREADME_TEXT "Spustit obraz disku ${VMX}" !define MUI_FINISHPAGE_REBOOTLATER !insertmacro MUI_PAGE_FINISH !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES ;-------------------------------- ;Languages !insertmacro MUI_LANGUAGE "Czech" !insertmacro MUI_LANGUAGE "English" ;Language strings LangString NAME_SecImage ${LANG_ENGLISH} "${VMX} VMWare Image" LangString NAME_SecImage ${LANG_CZECH} "${VMX} obraz disku" LangString NAME_SecStartMenu ${LANG_ENGLISH} "Start menu icons" LangString NAME_SecStartMenu ${LANG_CZECH} "Položky ve start menu" LangString NAME_SecDesktop ${LANG_ENGLISH} "Desktop icon" LangString NAME_SecDesktop ${LANG_CZECH} "Ikona na ploše" LangString DESC_SecImage ${LANG_ENGLISH} "VMWare Image with the system" LangString DESC_SecImage ${LANG_CZECH} "Obraz disku se systémem, který chcete instalovat" LangString DESC_SecPlayer ${LANG_ENGLISH} "Downloads and installs VMWare Player if not found" LangString DESC_SecPlayer ${LANG_CZECH} "Stáhne a nainstaluje VMWare Player, pokud není nainstalován" LangString DESC_SecStartMenu ${LANG_ENGLISH} "Creates Start menu icons and uninstaller icon" LangString DESC_SecStartMenu ${LANG_CZECH} "Vytvoří položky ve start menu včetně odinstalace" LangString DESC_SecDesktop ${LANG_ENGLISH} "Creates icon on your desktop" LangString DESC_SecDesktop ${LANG_CZECH} "Vytvoří ikonu na ploše pro rychlé spouštění" ;-------------------------------- ;Reserve Files ;If you are using solid compression, files that are required before ;the actual installation should be stored first in the data block, ;because this will make your installer start faster. !insertmacro MUI_RESERVEFILE_LANGDLL ;-------------------------------- ;Installer Sections Section !$(NAME_SecImage) SecImage SetOutPath "$INSTDIR" File "${VMX_FILE}" File "${LICENSE}" File /oname=..\LinuxEXPRES.ico LinuxEXPRES.ico ; ADD ALL YOUR OWN FILES HERE... ; Example: File "Ubuntu 7.04 Desktop.nvram" File "Ubuntu 7.04 Desktop*.vmdk" File "Ubuntu 7.04 Desktop.vmsd" File "Ubuntu 7.04 Desktop.vmx" File "Ubuntu 7.04 Desktop.vmxf" ;Store installation folder WriteRegStr HKLM "Software\LinuxEXPRES\VMWare-NSIS\${VMX}" "" $INSTDIR ;Create uninstaller WriteUninstaller "$INSTDIR\uninstall.exe" ; Write the uninstall keys for Windows WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${VMX}" "DisplayName" "${VMX}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${VMX}" "UninstallString" '"$INSTDIR\uninstall.exe"' WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${VMX}" "NoModify" 1 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${VMX}" "NoRepair" 1 SectionEnd Section "VMWare Player" SecPlayer Call DownloadPlayerIfNotInstalled SectionEnd Section $(NAME_SecStartMenu) SecStartMenu CreateDirectory "$SMPROGRAMS\LinuxEXPRES\${VMX}" CreateShortCut "$SMPROGRAMS\LinuxEXPRES\${VMX}\Uninstall ${VMX}.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0 CreateShortCut "$SMPROGRAMS\LinuxEXPRES\${VMX}\${VMX}.lnk" "cmd.exe" "/c $INSTDIR\${VMX_FILE}.vmx" !ifdef CREATE_LE_ICON WriteINIStr "$INSTDIR\..\LinuxEXPRES.cz.url" "InternetShortcut" "URL" "http://www.linuxexpres.cz/" CreateShortCut "$SMPROGRAMS\LinuxEXPRES\LinuxEXPRES.cz.lnk" "$INSTDIR\..\LinuxEXPRES.cz.url" "" "$INSTDIR\..\LinuxEXPRES.ico" 0 !endif SectionEnd Section $(NAME_SecDesktop) SecDesktop CreateShortCut "$DESKTOP\${VMX}.lnk" "cmd.exe" "/c $INSTDIR\${VMX_FILE}.vmx" SectionEnd ;-------------------------------- ;Installer Functions Function .onInit !insertmacro MUI_LANGDLL_DISPLAY FunctionEnd ;-------------------------------- ;Descriptions ;Assign language strings to sections !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN !insertmacro MUI_DESCRIPTION_TEXT ${SecImage} $(DESC_SecImage) !insertmacro MUI_DESCRIPTION_TEXT ${SecPlayer} $(DESC_SecPlayer) !insertmacro MUI_DESCRIPTION_TEXT ${SecStartMenu} $(DESC_SecStartMenu) !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} $(DESC_SecDesktop) !insertmacro MUI_FUNCTION_DESCRIPTION_END ;-------------------------------- ;Uninstaller Section Function InstallPlayer push $2 !ifdef VMP_DOWNLOAD_LINK MessageBox MB_YESNO "Stáhnout a nainstalovat VMWare Player (cca 160 MB)?" IDYES true IDNO false true: StrCpy $2 "$TEMP\VMWare_Player_installer.exe" nsisdl::download /TIMEOUT=30000 ${VMP_DOWNLOAD_LINK} $2 Pop $R0 ;Get the return value StrCmp $R0 "success" +3 MessageBox MB_OK "Stažení skončilo chybou ($R0), VMWare Player nainstalujte ručně ze stránek vmware.com." Quit MessageBox MB_OK "Nyní se spustí instalace VMWare Playeru, tato operace trvá asi 5 minut. Vyčkejte." ExecWait '"$2" /s/v"/qn /norestart"' Delete $2 SetRebootFlag true false: !endif !ifdef VMP_LOCAL_LINK StrCpy $2 "${VMP_LOCAL_LINK}" MessageBox MB_OK "Nyní se spustí instalace VMWare Playeru, tato operace trvá asi 5 minut. Vyčkejte." ExecWait '"$2" /s/v"/qn /norestart"' SetRebootFlag true !endif pop $2 FunctionEnd Function DownloadPlayerIfNotInstalled ; try to detect VMWare Workstation ReadRegStr $2 HKLM "SOFTWARE\VMware, Inc.\VMware Workstation" "ProductVersion" StrCmp $2 "" 0 skip ; try to detect VMWare Player ReadRegStr $2 HKLM "SOFTWARE\VMware, Inc.\VMware Player" "ProductVersion2" StrCmp $2 "" 0 skip Call InstallPlayer skip: FunctionEnd Section "Uninstall" Delete "$INSTDIR\${VMX_FILE}" Delete "$INSTDIR\${LICENSE}" ; ADD YOUR OWN FILES HERE... ; Example: Delete "$INSTDIR\Ubuntu 7.04 Desktop.nvram" Delete "$INSTDIR\Ubuntu 7.04 Desktop*.vmdk" Delete "$INSTDIR\Ubuntu 7.04 Desktop.vmsd" Delete "$INSTDIR\Ubuntu 7.04 Desktop.vmx" Delete "$INSTDIR\Ubuntu 7.04 Desktop.vmxf" Delete "$INSTDIR\vmware*.log" Delete "$INSTDIR\Uninstall.exe" RMDir "$INSTDIR" ; menu and desktop links Delete "$DESKTOP\${VMX}.lnk" RMDir /r "$SMPROGRAMS\LinuxEXPRES\${VMX}" RMDir "$SMPROGRAMS\LinuxEXPRES" ; only when not empty ; Remove registry keys DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${VMX}" DeleteRegKey HKLM "Software\LinuxEXPRES\VMWare-NSIS\${VMX}" SectionEnd ;-------------------------------- ;Uninstaller Functions Function un.onInit !insertmacro MUI_UNGETLANGUAGE FunctionEnd ;End