Page 1 of 1

How to use MySQL MSI

Posted: Mon Feb 16, 2009 6:16 am
by moppelstroppel
Hello all,

my problem is the MySQL calls another setup after finsh.
But the install script is not waiting for this one. And my own database setup which is executed after MySQL installer cannot be executed due to missing configuretion which is running in background.

So my database setup has to wait, but how?
How can I wait for finishing of a special exe?

I tried this. But label: CHECK_DB_SERVICE is not allowed?

Thanks Thomas

Code: Select all

  [DEFINE REGION: Perform First Time or Maintenance Installation]
  Comment: Install/Re-Install product
  Create Shortcut $SHORTCUTFOLDER$\\Remove MyApp to $UNINSTALLLINK$
  [OFFLINE CONTENT]
  Create Shortcut $SHORTCUTFOLDER$\\MyApp Remote to $TARGETDIR$\\AppRemote.exe
  Install Files D:\\Setup\\dll\\Csdmb.dll to $TARGETDIR$

  [DEFINE WEB MEDIA Datenbank]
  Get Component Datenbank Selection State into Variable SELECTED
  if Variable SELECTED Equals TRUE
  end
  
  [DEFINE WEB MEDIA Server]
  Get Component Datenbank\\Server Selection State into Variable SELECTED
  Set Variable DATABASESERVER_FILEBAG to 
  Set Variable DATABASE_INSTALLED to 0
  Define File Bag : D:\\Setup\\MySQL\\Server\\*.*, get runtime location of files into variable DATABASESERVER_FILEBAG
  if Variable SELECTED Equals TRUE
    Run Program under UAC msiexec /i "$DATABASESERVER_FILEBAG$\\mysql.msi" (WAIT)
    if Variable DATABASE_INSTALLED not Equals 0
      MessageBox: Error.$NEWLINE$ Code: $DATABASE_INSTALLED$
      Terminate Installation
    end
  end
  
  [DEFINE WEB MEDIA My App Database]
  label: CHECK_DB_SERVICE
  Set Variable DBMANAGER_FILEBAG to 
  Get Component Datenbank\\My App Datenbank Selection State into Variable SELECTED
  Define File Bag : D:\\Setup\\UpdateManager\\*.*, get runtime location of files into variable DBMANAGER_FILEBAG
  if Variable SELECTED Equals TRUE
    Set Variable DB_SERVICE_RUNNING to 0
    Check Service State for MySQL (write result into variable DB_SERVICE_RUNNING)
    if Variable DB_SERVICE_RUNNING Equals 0
      GoTo Label: CHECK_DB_SERVICE
      else
      Run Program $DBMANAGER_FILEBAG$\\UpdateMgr.exe installDb MySQL localhost (WAIT)
    end
  end

Posted: Mon Feb 16, 2009 6:51 am
by bokkie
Thomas,

I'll take a quick guess. Is it your

msiexec /i "$DATABASESERVER_FILEBAG$\\mysql.msi

statement that's causing the problem? If it is, is the mysql.msi built using IA as well? If so, I was told, if I remember correctly, that you cannot use msiexec on IA built projects.

Does that sound possible? Sorry, that's the best I can think of.

EDIT: Another thing I thought of is if mysql.msi is spawning another installation could that be running aysnchronously to the first? I suppose it's possible that your IA call to Run Program is correctly waiting on the first but perhaps the second is not running in the same process as the first. Sorry, those are probably pointless ideas of mine but given freely all the same. :)

Posted: Mon Feb 16, 2009 9:13 am
by MichaelNesmith
Don't use msiexec! Always use (Un)Install MSI Setup - it is how you should install MSI files with InstallAware. Be sure to display a progress dialog before calling (Un)Install MSI Setup so you capture native progress, error, and any other messages coming from the MSI setup in your own UI. That will never be possible with msiexec.

Posted: Tue Feb 17, 2009 3:10 am
by moppelstroppel
Thanks for your help, but my problem is that my installer created with Install Aware is waiting after the MSI install mysql.msi has finished. But at this point the database configuration is not finsihed. Due to this the mysql.msi calls another application before the mysql.msi is closed.
After the mysql.msi has finsihed the other application is running, but the Install Aware script is running in parallel and calls my own app which need a fully configured database.
So at this point two application are running.
And how can I solve this problem.

Below is the code from NSI Nullsoft Installer and I assumed in Install Aware it is much easier?
But I don't find any solution.

Code: Select all

Section "App Database" SecAppDB
	SectionIn 1 3
	Sleep 10000
	ClearErrors
  ; Make sure that the MySQLConfig is not running
	checkInstance:
	;MySQL Server Instance Configuration Wizard"
	  FindWindow $R0 "" "MySQL Server 5.0 - Setup Wizard"
		IsWindow $R0 0 +3
		Sleep 5000
		Goto checkInstance
		Sleep 10000
	  FindWindow $R0 "" "MySQL Server Instance Configuration Wizard"
		IsWindow $R0 0 +3
		Sleep 5000
	Goto checkInstance

	file /oname=$TEMP\\UpdateMgr.exe "..\\UpdateManager\\UpdateMgr.exe"
	file /oname=$TEMP\\data.sql "..\\UpdateManager\\data.sql"
	file /oname=$TEMP\\tables.sql "..\\UpdateManager\\tables.sql"
  ExecWait '"$TEMP\\UpdateMgr.exe"installDb'
  Delete "$TEMP\\UpdateMgr.exe" 
  Delete "$TEMP\\data.sql" 
  Delete "$TEMP\\tables.sql" 
	IfErrors errorInstallDb successInstallDb
		errorInstallDb: 
			MessageBox MB_ICONINFORMATION|MB_OK "$(MSG_CRATE_DB_INSTALL_ERROR)"
			Abort "$(MSG_CRATE_DB_INSTALL_ABORT)"
		successInstallDb: 
			MessageBox MB_ICONINFORMATION|MB_OK "$(MSG_CRATE_DB_INSTALL_SUCCESS)"
SectionEnd