Postinsts barfing when mysqld not running

Mario Limonciello superm1 at ubuntu.com
Mon Aug 20 19:36:23 BST 2007


We encounter this same issue when working with the mythtv-database
postinstall script.

Here is what we are using for our workaround:

    if ! DoSQL "$hostname" "$admin_username" "$admin_password"
"$database" "SELECT NULL" 2>/dev/null; then

        if ! DoSQL "$hostname" "$admin_username" "$admin_password" "" \
          "CREATE DATABASE $database"; then
          echo "Failed to create database (incorrect admin
username/password?)" >&2
          echo "It's also possible that mysql-server wasn't running.
After install" >&2
          echo "is completed, you will need to make sure mysql-server is
running" >&2
          echo "and that you supplied correct information. Try:" >&2
          echo "sudo dpkg-reconfigure mythtv-database" >&2
          # silently exit, instead pop up a notification for user
indicating this
          unud=/var/lib/update-notifier/user.d
          if test -d $uund; then
          cp -f
/usr/share/mythtv/mythtv-reconfigure-required.update-notifier \

/var/lib/update-notifier/user.d/mythtv-reconfigure-required
          fi
          exit 0
        fi

DoSQL issues the SQL command.  If the server is not contactable, then a
notification applet shows up in the user's tray as well as issues a warning.

Mario Limonciello
superm1 at ubuntu.com

Barry deFreese wrote:
> Michael Bienia wrote:
>> On 2007-08-17 16:50:27 -0400, Barry deFreese wrote:
>>   
>>> For simba, I did something like this in the simba.postinst:
>>>
>>> # Check if mysqlserver is running
>>> if [ -e "/var/run/mysqld/mysqld.sock" ]; then
>>> ...
>>> else
>>>     echo "W: Database server does not appear to be running!"
>>>     echo "W: Please try dpkg-reconfigure simba to configure the package."
>>> fi
>>>     
>> This check will fail if the database server runs on an other host.
>>
>>   
> Obviously but it fails that currently as far as I can see.
>>> Should I tell them to install a database server and make sure it's 
>>> running, then reconfigure the package.  Or am I approaching this the 
>>> wrong way entirely?
>>>     
>> It's a valid configuration to have the database on an other host.
>> Therefore similar packages like simba depend only on a database client
>> (which will hopefully know where to reach the database) and suggest the
>> database server at best.
>>
>>   
> Right, again, poor choice of words.  I mean install a database server 
> "somehwere".  I suppose it should be more descriptive that either 
> connect to remote database or install local database.
> 
> What I was really looking for though was if this was even the correct 
> approach to get around these issues. 
> 
> I suppose another option would be to prompt the user for 1. Connect to 
> remote db 2. Use local db  3. Leave unconfigured but that just means 
> more prompting that we don't like, no?
>> Michael
>>
>>   
> Thanks for responding, at least someone is.. :)
> 
> 
> Barry deFreese (aka bddebian)
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/ubuntu-motu/attachments/20070820/b241b977/attachment.pgp 


More information about the Ubuntu-motu mailing list