Hello, Thanks for the suggestion. Michael K. Johnson and I had this discussion some years ago. His position, with which I agreed, was that it was bad practice to prompt for information in rpm post-install scripts because rpm was designed to run unattended. That is to say, tools like yum and apt4rpm have a hard time answering prompts. So we settle for the assumption that no password was in use and that seems to work for 99% of users. Your suggestion does make the error output better from what I see. Is there anyone out there with a postgresql installation who could test the same or similar modification to the postgresql script? Sqlite doesn't have password capability so far as I know.
On Thu, 2007-03-29 at 14:39 +0100, Jaime Ventura wrote: > Hello, > In the rpm based upgrade, I got the following: > ... > Updating : bacula-mysql ######################### [1/4] > Hmm, doesn't look like you have an existing database. > Granting privileges for MySQL user bacula... > ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using > password: NO) > Error creating privileges. > Creating MySQL bacula database... > ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using > password: NO) > Creation of bacula database failed. > Creating bacula tables... > ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using > password: NO) > ..... > > Thats ok because my mysql server is password protected. > But since the message wasn't so accurate to the problem, i took a look > at the spec file. > So Im sending you a suggestion. > As you can see it applies only on the mysql part of the script, because > I don't have sqlite or posgres to test it. > > > So, instead of: > ... > %if %{mysql} > # test for an existing database > # note: this ASSUMES no password has been set for bacula database > DB_VER=`mysql 2>/dev/null bacula -e 'select * from Version;'|tail -n 1` > > # grant privileges and create tables if they do not exist > if [ -z "$DB_VER" ]; then > echo "Hmm, doesn't look like you have an existing database." > ... > > > you could: > ... > # test for an existing database > # note: this ASSUMES no password has been set for bacula database > DB_VER=`mysql 2>&1 bacula -e 'select * from Version;'|tail -n 1` > if expr "$DB_VER" : '.*ERROR.*' >/dev/null; then > echo "Couldn't access your database server.($DB_VER)" > echo "If you are installing bacula for the first time you will > need to run the bacula database creation scripts." > echo "If you are upgrading you may need to run the bacula > database updating scripts." > # grant privileges and create tables if they do not exist > elif [ -z "$DB_VER" ]; then > echo "Hmm, doesn't look like you have an existing database." > ... > > As you can see, I sugest to redirect stderror to std output the command, > and then search for the "ERROR" string to stat if there was an error. > > Or you could ask for the database root password. > I didn't do any patch because the suggested code applies to mysql only > (may be you could do it for the other databases:P ) > > Thanks, > Jaime ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users