Manuel Arostegui wrote: > Hi all. > I´m packing an application which has got some .sql to configure database. > When you download the tar.gz you have to run the sql by hand, of course, and all tables, and > databases are created. > Well, I would like to make that process automatically when the rpm is being installed. > > As all of you could imagine to run the sql you must be root, so, I have no idea about how to ask > for the root password when rpm -i foo.rpm is done. > I mean, I would like to store the root password (I´ve been thinking that could be done with > "expect") to use it with later, so then, the application will be installed and the databases will > be set up correctly, cause I don´t want users to install the rpm and after that run by hand the > sql file. > > Any ideas of what to do with the spec file? > Thanks in advance. > > Manuel. > Except for special cases where you can install as a user, you are normally running as root when you install an RPM. You need to be root to write to the bin and sbin directories. Now, as far as configuring the database, that is a different problem - you need to be able to access the database as a user with the correct permissions to create databases and tables. If you know the password, you can use the --password=<password> option for the mysql command, or the equivalent if using another version of sql. Also, the sql password for root does not have to be the same as the system password for root. (When first installed, there may not be a root password in the sql tables.) Getting the password interactively when doing an RPM install is a problem because of the design of rpm, and the fact that it may be running under a front-end program, or as part of a batch job. I can remember long threads about this in the past... Mikkel -- Do not meddle in the affairs of dragons, for thou art crunchy and taste good with Ketchup! -- fedora-list mailing list fedora-list@xxxxxxxxxx To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list