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
-- 



 


Jaime Ventura
[Infra-estruturas e Comunicações]

Rua Dr. António Bernardino de Almeida, 431
4200 - 072 Porto
Telef: +351 22 834 05 00 (04) - ext. 1641
Fax: +351 22 832 11 59

e-mail:         [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
url:    www.isep.ipp.pt <http://www.isep.ipp.pt>         

        




-------------------------------------------------------------------------
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

Reply via email to