On Sat, 9 Feb 2002, Dan Brown wrote:

>  
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
>       I'm working on putting together a package that will need to add some
> MySQL tables.  I'm thinking I should be able to add "mysql <
> /path/to/script.sql" in a post-install script in the RPM.  Those
> commands run as root, so I'd expect it should grab the mysql root
> password from /root/.my.cnf.  Anybody know different before I try it?

Your best route is to take advantage of the mysql.init service included in
the e-smith-mysql rpm.

Make your post-install script make a symlink into the directory
/etc/e-smith/sql/init

i.e.

symlink "/etc/e-smith/sql/your-package/table-schema.sql,
            "/etc/e-smith/sql/init/S10table-schema.sql";

Then, the bootstrap-console-save action will automatically start the
mysql.init service (or you can do it manually: /etc/rc.d/init.d/mysql.init
start) and the files in the /etc/e-smith/sql/init directory will
automatically be accessed as "root" and the SQL code in them run.

It acts something like the event-action model in that the files in
/etc/e-smith/sql/init are run in the alphabetical order they are found (so
if you have several .sql files, make sure you make the symlinks in the
right order).

And the reason for the symlinks is because mysql.init will delete the files
in /etc/e-smith/sql/init after it has uploaded them.  So, to have that
legacy information around for reference purposes, I prefer the symlink
file approach.

Aside from that, to answer your specific question, if you are logged in as
"root" and run the action you mention above, it will automatically read the
/root/.my.cnf file for its password.

Regards,

Jay

-- 
Jason D. Miller                         E-mail: [EMAIL PROTECTED]
Senior Software Developer               Phone:  +1 613.368.4387
Network Server Solutions Group          Fax:    +1 613.564.7739
Mitel Networks Corporation              http://www.e-smith.com

"Are those workers dead?"
"Technically, yes ... but that's no excuse!", <cracks the whip>,
"Back to work you lazy corpse! ..."
--- Taken from DilbertTV, "Elbonian Trip"


--
Please report bugs to [EMAIL PROTECTED]
Please mail [EMAIL PROTECTED] (only) to discuss security issues
Support for registered customers and partners to [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Archives by mail and http://www.mail-archive.com/devinfo%40lists.e-smith.org

Reply via email to