[packages] mysql: properly handle quoted datadirs in initscript
authorjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Sat, 29 Jan 2011 18:51:47 +0000 (18:51 +0000)
committerjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Sat, 29 Jan 2011 18:51:47 +0000 (18:51 +0000)
git-svn-id: svn://svn.openwrt.org/openwrt/packages@25243 3c298f89-4303-0410-b956-a3cf2f4a3e73

libs/mysql/files/mysqld.init

index 32fe7b2..693dade 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