summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTerje Rosten <terje.rosten@oracle.com>2017-02-14 12:25:20 +0100
committerTerje Rosten <terje.rosten@oracle.com>2017-02-14 12:37:39 +0100
commit6fce90e52426b3d6b9ad3800c2a9a1100e79a7ab (patch)
treedba3883ab04e03507b0748bd8e485ccd2e6d4a97
parentb7f33d22d8f1af07deac57a3d51ac750788b812f (diff)
downloadmariadb-git-6fce90e52426b3d6b9ad3800c2a9a1100e79a7ab.tar.gz
Bug#25287707 THE PID-FILE VALUE IS IGNORED IN THE /ETC/MY.CNF OPTION FILE
In SysV initscripts for RPMS [mysqld] section was ignored for some options.
-rw-r--r--packaging/rpm-oel/mysql.init29
-rw-r--r--packaging/rpm-sles/mysql.init20
2 files changed, 26 insertions, 23 deletions
diff --git a/packaging/rpm-oel/mysql.init b/packaging/rpm-oel/mysql.init
index 108da1dcd26..e46edd14187 100644
--- a/packaging/rpm-oel/mysql.init
+++ b/packaging/rpm-oel/mysql.init
@@ -31,26 +31,29 @@ MYSQLD_OPTS=
lockfile=/var/lock/subsys/$prog
-# extract value of a MySQL option from config files
-# Usage: get_mysql_option SECTION VARNAME DEFAULT
-# result is returned in $result
+# Extract value of a MySQL option from config files
+# Usage: get_mysql_option OPTION DEFAULT SECTION1 SECTION2 SECTIONN
+# Result is returned in $result
# We use my_print_defaults which prints all options from multiple files,
# with the more specific ones later; hence take the last match.
-get_mysql_option(){
- result=`/usr/bin/my_print_defaults "$1" | sed -n "s/^--$2=//p" | tail -n 1`
- if [ -z "$result" ]; then
- # not found, use default
- result="$3"
- fi
+get_mysql_option () {
+ option=$1
+ default=$2
+ shift 2
+ result=$(/usr/bin/my_print_defaults "$@" | sed -n "s/^--${option}=//p" | tail -n 1)
+ if [ -z "$result" ]; then
+ # not found, use default
+ result="${default}"
+ fi
}
-get_mysql_option mysqld datadir "/var/lib/mysql"
+get_mysql_option datadir "/var/lib/mysql" mysqld
datadir="$result"
-get_mysql_option mysqld socket "$datadir/mysql.sock"
+get_mysql_option socket "$datadir/mysql.sock" mysqld
socketfile="$result"
-get_mysql_option mysqld_safe log-error "/var/log/mysqld.log"
+get_mysql_option log-error "/var/log/mysqld.log" mysqld mysqld_safe
errlogfile="$result"
-get_mysql_option mysqld_safe pid-file "/var/run/mysqld/mysqld.pid"
+get_mysql_option pid-file "/var/run/mysqld/mysqld.pid" mysqld mysqld_safe
mypidfile="$result"
case $socketfile in
diff --git a/packaging/rpm-sles/mysql.init b/packaging/rpm-sles/mysql.init
index 62f2a62e1b9..4c72d976526 100644
--- a/packaging/rpm-sles/mysql.init
+++ b/packaging/rpm-sles/mysql.init
@@ -38,23 +38,23 @@ PROG=/usr/bin/mysqld_safe
lockfile=/var/lock/subsys/mysql
get_option () {
- local section=$1
- local option=$2
- local default=$3
- ret=$(/usr/bin/my_print_defaults $section | grep '^--'${option}'=' | cut -d= -f2-)
- [ -z $ret ] && ret=$default
+ local option=$1
+ local default=$2
+ shift 2
+ ret=$(/usr/bin/my_print_defaults "$@" | sed -n "s/^--${option}=//p" | tail -n 1)
+ [ -z $ret ] && ret=${default}
echo $ret
}
-datadir=$(get_option mysqld datadir "/var/lib/mysql")
-socket=$(get_option mysqld socket "$datadir/mysql.sock")
-pidfile=$(get_option mysqld_safe pid-file "/var/run/mysql/mysqld.pid")
+datadir=$(get_option datadir "/var/lib/mysql" mysqld)
+socket=$(get_option socket "$datadir/mysql.sock" mysqld)
+pidfile=$(get_option pid-file "/var/run/mysql/mysqld.pid" mysqld mysqld_safe)
install_db () {
# Note: something different than datadir=/var/lib/mysql requires
# SELinux policy changes (in enforcing mode)
- datadir=$(get_option mysqld datadir "/var/lib/mysql")
- logfile=$(get_option mysqld_safe log-error "/var/log/mysql/mysqld.log")
+ datadir=$(get_option datadir "/var/lib/mysql" mysqld)
+ logfile=$(get_option log-error "/var/log/mysql/mysqld.log" mysqld mysqld_safe)
# Restore log, dir, perms and SELinux contexts
if [ ! -d "$datadir" -a ! -h "$datadir" -a "x$(dirname "$datadir")" = "x/var/lib" ]; then