mysql: properly handle quoted datadirs in initscript
authorJo-Philipp Wich <jow@openwrt.org>
Sat, 29 Jan 2011 18:51:47 +0000 (18:51 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Sat, 29 Jan 2011 18:51:47 +0000 (18:51 +0000)
SVN-Revision: 25243

libs/mysql/files/mysqld.init

index 32fe7b214fece7c41c7f6f504dd62aa53af0fa41..693dade6c1552fef6a74f45574e400f8d299eab9 100644 (file)
@@ -8,7 +8,7 @@ PID=/var/run/mysqld.pid
 CMD=/usr/bin/mysqld
 
 start() {
-       local datadir=$(sed -n -e 's/^[[:space:]]*datadir[[:space:]]*=[[:space:]]*//p' /etc/my.cnf)
+       local datadir=$(sed -n -e "s/^[[:space:]]*datadir[[:space:]]*=[[:space:]]*[\"']\?\([^\"']*\)[\"']\?/\1/p" /etc/my.cnf)
        if [ ! -d "$datadir" ]; then
                echo "Error: datadir in /etc/my.cnf ($datadir) doesn't exist"
                return 1