home *** CD-ROM | disk | FTP | other *** search
/ Nejlepší hry / Nejlepsi hry.iso / hry / frozen bubble / fbinstaller.exe / {app} / install / Frozen Bubble.nsi < prev    next >
Encoding:
Text File  |  2003-03-17  |  7.5 KB  |  219 lines

  1. ; Frozen Bubble Win32 port installer script
  2. ; This script requires NSIS 2.0b3 and above
  3. ; http://nsis.sf.net
  4. ;
  5. ; Written by Amir Szekely
  6.  
  7. #SetCompressor bzip2
  8.  
  9. !define MUI_PRODUCT "Frozen Bubble"
  10. !define MUI_VERSION "1.0.0"
  11.  
  12. !include "MUI.nsh"
  13.  
  14. ;--------------------------------
  15. ;Configuration
  16.  
  17.     !define MUI_FINISHPAGE
  18.     !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\Frozen Bubble.lnk"
  19.     
  20.     !define MUI_LICENSEPAGE
  21.     !define MUI_COMPONENTSPAGE
  22.     !define MUI_DIRECTORYPAGE
  23.     !define MUI_ABORTWARNING
  24.     !define MUI_UNCONFIRMPAGE
  25.     !define MUI_UNINSTALLER
  26.  
  27.     !define MUI_STARTMENUPAGE
  28.  
  29.     !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
  30.     !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\Frozen Bubble"
  31.     !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
  32.     !define MUI_STARTMENUPAGE_VARIABLE $R9
  33.  
  34.     !define MUI_HEADERBITMAP "branding.bmp"
  35.         
  36.     ;Language
  37.     !define MUI_TEXT_FINISH_SHOWREADME "Run ${MUI_PRODUCT}"
  38.     !insertmacro MUI_LANGUAGE "English"
  39.  
  40.     ;General
  41.     OutFile "Frozen Bubble.exe"
  42.     
  43.     ;License page
  44.     LicenseData "license.rtf"
  45.  
  46.     ;Folder-selection page
  47.     InstallDir "$PROGRAMFILES\${MUI_PRODUCT}"
  48.  
  49. ;--------------------------------
  50. ;Check for Perl and SDL_Perl and show splash screen
  51. Function .onInit
  52.     Banner::show /NOUNLOAD "Checking for Perl and SDL_Perl..."
  53.  
  54.     ReadRegStr $0 HKLM Software\Perl BinDir
  55.     StrCmp $5 "" 0 +2
  56.         StrCpy $5 perl.exe
  57.     nsExec::Exec '"$5" -v'
  58.     Pop $0
  59.     StrCmp $0 0 checkSDL
  60.         MessageBox MB_YESNOCANCEL|MB_ICONEXCLAMATION "The installer can not find Perl and SDL_perl on this computer!$\r$\nPlease install Perl and SDL_perl and run this installer again.$\r$\nPress cancel if you are sure you have Perl and SDL_Perl installed.$\r$\n$\r$\nWould you like the installer to open Perl's download page for you?" IDNO abort IDCANCEL splash
  61.             ExecShell open http://www.activestate.com/Products/Download/Get.plex?id=ActivePerl
  62.             MessageBox MB_OK|MB_ICONINFORMATION "Please make sure you download Perl 5.6.*. The current version of SDL_Perl doesn't work with Perl 5.8.*." IDOK abort
  63.  
  64.     checkSDL:
  65.         nsExec::Exec '"$5" -e "use SDL; print $$SDL::VERSION;"'
  66.         Pop $0
  67.         StrCmp $0 0 splash
  68.             ReadRegStr $0 HKLM Software\SDL_Perl Install_Dir
  69.             IfFileExists $0 0 install_SDL_Perl
  70.                 MessageBox MB_YESNO|MB_ICONEXCLAMATION `It seems that you have installed SDL_Perl but didn't add it to Perl's package list.$\r$\nTo add it to Perl's package list you must call "ppm install SDL_perl.ppd". Would you like the installer to call it for you?` IDNO abort
  71.                     SetOutPath $0
  72.                     ExecWait "ppm install SDL_perl.ppd" $1
  73.                     StrCmp $1 0 splash
  74.                         MessageBox MB_OK|MB_ICONSTOP "Installation failed. Please install SDL_Perl manually and run this installer again." IDOK abort
  75.             install_SDL_Perl:
  76.                 MessageBox MB_YESNO|MB_ICONEXCLAMATION "The installer can not find SDL_Perl on this computer!$\r$\nPlease install SDL_Perl and run this installer again.$\r$\n$\r$\nWould you like the installer to open SDL_Perl's download page for you?" IDNO abort
  77.                 ExecShell open http://www.sdlperl.org/index.htpl?id=0&cat=projects
  78.                 Goto abort
  79.  
  80.     splash:
  81.         Banner::destroy
  82.         File /oname=$PLUGINSDIR\splash.bmp splash.bmp
  83.         File /oname=$PLUGINSDIR\splash.wav ..\snd\malus.wav
  84.  
  85.         advsplash::show 1800 350 187 -1 $PLUGINSDIR\splash
  86.  
  87.         Pop $0 ; $0 has '1' if the user closed the splash screen early,
  88.                 ; '0' if everything closed normal, and '-1' if some error occured.
  89.         Return
  90.  
  91.     abort:
  92.         Banner::destroy
  93.         Abort
  94. FunctionEnd
  95.  
  96. ;--------------------------------
  97. ;Installer Sections
  98.  
  99. Section "!Frozen Bubble" SecCore
  100. SectionIn RO
  101.     SetOutPath $INSTDIR
  102.     File ..\AUTHORS.txt
  103.     File ..\CHANGES.txt
  104.     File ..\COPYING.txt
  105.     File ..\README.txt
  106.     File "..\Windows Port.txt"
  107.     File ..\frozen-bubble
  108.     File ..\frozen-bubble-editor
  109.  
  110.     File /r ..\gfx
  111.     File /r ..\lib
  112.     File /r ..\snd
  113.     File /r ..\data
  114.     File /r ..\doc
  115.  
  116.     StrCmp $5 perl.exe 0 +2
  117.         SearchPath $5 perl.exe
  118.     StrCmp $5 "" 0 +2
  119.         StrCpy $5 perl.exe
  120.     CreateShortcut "$INSTDIR\Frozen Bubble.lnk" $5 "-I.\lib frozen-bubble" $INSTDIR\gfx\icon.ico
  121.  
  122.     WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Frozen Bubble" DisplayName "Frozen Bubble"
  123.     WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Frozen Bubble" UninstallString '"$INSTDIR\Uninstall.exe"'
  124.     WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Frozen Bubble" DisplayIcon $INSTDIR\gfx\icon.ico
  125.     WriteUninstaller $INSTDIR\Uninstall.exe
  126. SectionEnd
  127.  
  128. Section -StartMenu
  129.     !insertmacro MUI_STARTMENU_WRITE_BEGIN
  130.     SetShellVarContext all
  131.     CreateDirectory $SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}
  132.     IfFileExists $SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE} createIcons
  133.         SetShellVarContext current
  134.         CreateDirectory $SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}
  135.  
  136.     createIcons:
  137.         CreateShortcut "$SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}\Frozen Bubble.lnk" $5 "-I.\lib frozen-bubble" $INSTDIR\gfx\icon.ico
  138.         CreateShortCut $SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}\Uninstall.lnk $INSTDIR\Uninstall.exe
  139.         CreateShortCut $SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}\License.lnk $INSTDIR\COPYING.txt
  140.         CreateShortCut $SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}\Readme.lnk $INSTDIR\README.txt
  141.         CreateShortCut "$SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}\Windows Port.lnk" "$INSTDIR\Windows Port.txt"
  142.     !insertmacro MUI_STARTMENU_WRITE_END
  143. SectionEnd
  144.  
  145. Section "Desktop icon" SecDesktop
  146.     CreateShortcut "$DESKTOP\Frozen Bubble.lnk" $5 "-I.\lib frozen-bubble" $INSTDIR\gfx\icon.ico
  147. SectionEnd
  148.  
  149. Section "Quick Launch icon" SecQuick
  150.     StrCmp $QUICKLAUNCH $TEMP +2
  151.         CreateShortcut "$QUICKLAUNCH\Frozen Bubble.lnk" $5 "-I.\lib frozen-bubble" $INSTDIR\gfx\icon.ico
  152. SectionEnd
  153.  
  154. Section "Install script" SecScript
  155.     SetOutPath $INSTDIR\install
  156.     File "Frozen Bubble.nsi"
  157.     File license.rtf
  158.     File splash.bmp
  159.     File branding.bmp
  160. SectionEnd
  161.  
  162. ;--------------------------------
  163. ;Descriptions
  164.  
  165. !insertmacro MUI_FUNCTIONS_DESCRIPTION_BEGIN
  166.     !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} "Game files"
  167.     !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} "An icon of Frozen Bubble on the desktop"
  168.     !insertmacro MUI_DESCRIPTION_TEXT ${SecQuick} "An icon of Frozen Bubble in the Quick Launch bar"
  169.     !insertmacro MUI_DESCRIPTION_TEXT ${SecScript} "This installer scripts (requires NSIS)"
  170. !insertmacro MUI_FUNCTIONS_DESCRIPTION_END
  171.  
  172. ;--------------------------------
  173. ;Uninstaller Section
  174.  
  175. Section "Uninstall"
  176.     Delete $INSTDIR\AUTHORS.txt
  177.     Delete $INSTDIR\CHANGES.txt
  178.     Delete $INSTDIR\COPYING.txt
  179.     Delete $INSTDIR\README.txt
  180.     Delete "$INSTDIR\Windows Port.txt"
  181.     Delete $INSTDIR\frozen-bubble
  182.     Delete $INSTDIR\frozen-bubble-editor
  183.     Delete "$INSTDIR\Frozen Bubble.lnk"
  184.     Delete $INSTDIR\.fbrc
  185.     Delete $INSTDIR\.fbhighscores
  186.     Delete $INSTDIR\.fbhighlevelshistory
  187.     Delete $INSTDIR\Uninstall.exe
  188.  
  189.     RMDir /r $INSTDIR\gfx
  190.     RMDir /r $INSTDIR\lib
  191.     RMDir /r $INSTDIR\snd
  192.     RMDir /r $INSTDIR\data
  193.     RMDir /r $INSTDIR\install
  194.     RMDir /r $INSTDIR\doc
  195.     RMDir /r $INSTDIR\.fblevels
  196.  
  197.     RMDir $INSTDIR
  198.  
  199.     ReadRegStr $0 "${MUI_STARTMENUPAGE_REGISTRY_ROOT}" "${MUI_STARTMENUPAGE_REGISTRY_KEY}" "${MUI_STARTMENUPAGE_REGISTRY_VALUENAME}"
  200.  
  201.     StrCmp $0 "" noshortcuts
  202.         Delete "$0\Frozen Bubble.lnk"
  203.         Delete $0\Uninstall.lnk
  204.         Delete $0\License.lnk
  205.         Delete $0\Readme.lnk
  206.         Delete "$0\Windows Port.lnk"
  207.         RMDir $0
  208.  
  209.     noshortcuts:
  210.  
  211.     DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Frozen Bubble"
  212.  
  213.     Delete "$DESKTOP\Frozen Bubble.lnk"
  214.     Delete "$QUICKLAUNCH\Frozen Bubble.lnk"
  215.  
  216.     !insertmacro MUI_UNFINISHHEADER
  217. SectionEnd
  218.  
  219. ;eof