Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 5152 - /etc/init.d/mysql start script broken with datadir different than /var/lib/mysql (fix provided)
Summary: /etc/init.d/mysql start script broken with datadir different than /var/lib/my...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: x86 Linux
: High critical (vote)
Assignee: Nick Hadaway
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-07-17 09:01 UTC by Alessandro Pisani
Modified: 2003-02-04 19:42 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alessandro Pisani 2002-07-17 09:01:54 UTC
/etc/init.d/mysql always check for /var/lib/mysql/mysql even if user set datadir
in /etc/mysql/my.cnf to a different path than the default one.
fix for/etc/init.d/mysql script is below:

checkconfig() {
        dir="`cat /etc/mysql/my.cnf | grep datadir | awk -F = '{ print $2 }'`"

        if [ ! -d $dir/mysql ] ; then
                eerror "You dont appear to have the mysql database installed yet."
                eerror "Please run /usr/bin/mysql_install_db to have this done..."
                return 1
        fi
}

HTH,
Alessandro
Comment 1 Alessandro Pisani 2002-07-24 01:59:43 UTC
...any chance to get this applied? :| 
Comment 2 Jon Nelson (RETIRED) 2002-07-24 07:41:55 UTC
I'll try to get it done by this weekend.
I'm a bit swamped right now, but I'll do what I can to close up as many bugs as
possible this weekend, including this one, because its so easy thanks to the fix
you've provided.

Comment 3 Jon Nelson (RETIRED) 2002-07-25 22:02:34 UTC
I believe the fix is in -r3!
Comment 4 Alessandro Pisani 2002-12-20 05:09:44 UTC
reopening bug: the fix needs to be ported also to mysql-4.0.x
Comment 5 Alessandro Pisani 2002-12-21 17:58:52 UTC
fixed files/mysql-4.0.rc6 follows, please merge in CVS:

--------->
#!/sbin/runscript
# Copyright 1999-2002 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later

depend() {
    need net
}

checkconfig() {
    if [ ! -f /etc/mysql/my.cnf ] ; then
        eerror "No /etc/mysql/my.cnf file exists!"
    fi

    dir=`awk '{ if ( $0 ~ /^datadir[ \t]+=/ ) { print $3 } }' < /etc/mysql/my.cnf`

    if [ ! -d $dir/mysql ] ; then
        eerror "You dont appear to have the mysql database installed yet."
        eerror "Please run /usr/bin/mysql_install_db to have this done..."
        return 1
    fi
}

start() {
    checkconfig || return 1
    ebegin "Starting mysqld"
    start-stop-daemon --start --quiet --exec /usr/bin/mysqld_safe \
        --background -- >/dev/null 2>&1
    eend $?
}

stop () {
    ebegin "Stopping mysqld"
    start-stop-daemon --stop --quiet --pidfile=/var/run/mysqld/mysqld.pid
    eend $?
}
<---------

bye,
Alessandro
Comment 6 Alessandro Pisani 2003-01-02 09:01:09 UTC
again, any chance to get this applied? :| 
if would be nice to have this applied and to also have an euild for the new
4.0.7 release, which had been now marked "gamma" , and so completely reliable.
is there anyone taking care of mysql ?

thank you
Comment 7 Donny Davies (RETIRED) gentoo-dev 2003-01-04 17:36:29 UTC
ok thanks.