SOLVED Updating installer scripts to reflect both locations of mysql password

  • Moderator

    I checked [URL=‘’]trunk [/URL] [URL=‘’] > lib [/URL] [URL=‘’] > ubuntu [/URL] > (861). The installPackages() function still only echos out a note about updating the config file under ${webdirdest}/commons/config.php and mentions nothing about /opt/fog/service/etc/config.php.

    iirc, both locations must be updated if you use a non-empty root password in mysql. The first for the web ui, the second for the FOGImageReplicator service.

  • While old, I think it’s worth mentioning here if only for documentary purposes.

    The /opt/fog/service/etc/config.php file now only contains a pointer to the FOG Servers FOG Web GUI information. This means what’s stored in the commons/config.php is the same info used for the FOG Service files. I’ve made great strides in adding the relevant sql questions and updating the information as well and believe it’s fairly safe to close this particular bug as resolved.

  • Moderator

    For Ubuntu:
    What does everyone think about adding debconf-utils to the Ubuntu packages, using the install script to prompt for a password, and then using debconf-set-selections to tell mysql what the default root password should be so it doesn’t do a separate prompt? We could then use that saved value to update the config files as needed.

    I’m looking at the 0.33 code as of revision 898 and it doesn’t look like much has changed in regards to this item. Can someone look at the code under the /lib/commons and /lib/ubuntu and double check that this is what would be needed?

    For RedHat:
    It looks like the redhat package installs with no password and you can run a mysqladmin command later to set it using the value read in from the prompt in the /lib/common/

  • Moderator

    I am familiar enough with BASH and Linux. I can update the installer scripts. I’ll grab the latest off SVN through sourceforge and generate a patch file. Does that sound like a good plan?

  • I’d love to volunteer FWIW but, I work for a University where we are not allowed to contribute to GPLv3 projects. 😞
    We can only file bug reports and snippets of code.

  • Developer

    The installer scripts need to be updated to ask for MySQL passwords and then put them in the correct location.

    If anyone could help, please PM me. You must be capable of modifying BASH scripts and comfortable working in Linux.

  • Moderator

    I didn’t look through the code enough to figure out if it already tries to update the /opt/fog/service/etc/config.php file with the mysql root password. I kind of assumed that the installer doesn’t know what the password is, at least on Ubuntu because the installer prompts you for it when you install the mysql packages.

    I had to change an existing server to have a password on the mysql root user account, and had to scour the wiki, forums, and google to find both locations it’s needed.

  • Ah, you didn’t want the script to update both config files - you just wanted a better warning.
    You could change the following in fog_0.32/lib/ubuntu/ with whatever sounds good to you:
    [CODE] 542 echo " We are about to install MySQL Server on “;
    543 echo " this server, if MySQL isn’t installed already”;
    544 echo " you will be prompted for a root password. If";
    545 echo " you don’t leave it blank you will need to change";
    546 echo " it in the config.php file located at:";
    547 echo " “;
    548 echo " ${webdirdest}/commons/config.php”;[/CODE]
    Say, change “file” to “files” in line 546 insert another line below 548 listing the second config file.

    …Although, it looks like the install script is supposed to update /opt/fog/service/etc/config.php so, in truth the only config file you have to update manually during install is ${webdirdest}/commons/config.php. So, the message is correct - it just would be better, IMO, if the script updated both files (or neither I suppose).

  • Moderator

    The installer currently warns you that if you set the mysql password for the root user to a non-empty value, that you must update the /var/www/fog/commons/config.php file, when in reality, you have to modify the /opt/fog/service/etc/config.php ALSO.

    I want to make Fog easier to use in general and adding an additional note to the install script should be easy before 0.33 is released.

    If at some point in the future the installer can update the config files for you, we’ll be even closer to perfection.

  • Yeah, it would be so easy to fix:

    Original fog_0.32/lib/ubuntu/ (with line numbers shown):
    [CODE] 459 define( “MYSQL_HOST”, “localhost” );
    460 define( “MYSQL_DATABASE”, “fog” );
    461 define( “MYSQL_USERNAME”, “root” );
    462 define( “MYSQL_PASSWORD”, “” );[/CODE]

    Fixed fog_0.32/lib/ubuntu/ (with line numbers shown):
    [CODE] 459 define( “MYSQL_HOST”, “${snmysqlhost}” );
    460 define( “MYSQL_DATABASE”, “fog” );
    461 define( “MYSQL_USERNAME”, “${snmysqluser}” );
    462 define( “MYSQL_PASSWORD”, “${snmysqlpass}” );[/CODE]
    …or something like that. I haven’t checked to make absolutely sure that those variables are defined when the configureHttpd() function s is called during install.

    The same change should be made for fog_0.32/lib/redhat/ only on lines 433-436.

    Can we submit a diff or anything to fix this? …Assuming it’s not fixed in 0.33 when it comes out.