Skip to content

Commit 722b8b0

Browse files
committed
Merge branch 'mysql-5.5' into mysql-5.6
2 parents 8c50770 + 6fce90e commit 722b8b0

File tree

2 files changed

+26
-23
lines changed

2 files changed

+26
-23
lines changed

packaging/rpm-oel/mysql.init

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,26 +31,29 @@ MYSQLD_OPTS=
3131
lockfile=/var/lock/subsys/$prog
3232

3333

34-
# extract value of a MySQL option from config files
35-
# Usage: get_mysql_option SECTION VARNAME DEFAULT
36-
# result is returned in $result
34+
# Extract value of a MySQL option from config files
35+
# Usage: get_mysql_option OPTION DEFAULT SECTION1 SECTION2 SECTIONN
36+
# Result is returned in $result
3737
# We use my_print_defaults which prints all options from multiple files,
3838
# with the more specific ones later; hence take the last match.
39-
get_mysql_option(){
40-
result=$(/usr/bin/my_print_defaults "$1" | sed -n "s/^--$2=//p" | tail -n 1)
41-
if [ -z "$result" ]; then
42-
# not found, use default
43-
result="$3"
44-
fi
39+
get_mysql_option () {
40+
option=$1
41+
default=$2
42+
shift 2
43+
result=$(/usr/bin/my_print_defaults "$@" | sed -n "s/^--${option}=//p" | tail -n 1)
44+
if [ -z "$result" ]; then
45+
# not found, use default
46+
result="${default}"
47+
fi
4548
}
4649

47-
get_mysql_option mysqld datadir "/var/lib/mysql"
50+
get_mysql_option datadir "/var/lib/mysql" mysqld
4851
datadir="$result"
49-
get_mysql_option mysqld socket "$datadir/mysql.sock"
52+
get_mysql_option socket "$datadir/mysql.sock" mysqld
5053
socketfile="$result"
51-
get_mysql_option mysqld_safe log-error "/var/log/mysqld.log"
54+
get_mysql_option log-error "/var/log/mysqld.log" mysqld mysqld_safe
5255
errlogfile="$result"
53-
get_mysql_option mysqld_safe pid-file "/var/run/mysqld/mysqld.pid"
56+
get_mysql_option pid-file "/var/run/mysqld/mysqld.pid" mysqld mysqld_safe
5457
mypidfile="$result"
5558

5659
case $socketfile in

packaging/rpm-sles/mysql.init

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,23 +54,23 @@ PROG=/usr/bin/mysqld_safe
5454
lockfile=/var/lock/subsys/mysql
5555

5656
get_option () {
57-
local section=$1
58-
local option=$2
59-
local default=$3
60-
ret=$(/usr/bin/my_print_defaults $section | grep '^--'${option}'=' | cut -d= -f2- | tail -n 1)
61-
[ -z $ret ] && ret=$default
57+
local option=$1
58+
local default=$2
59+
shift 2
60+
ret=$(/usr/bin/my_print_defaults "$@" | sed -n "s/^--${option}=//p" | tail -n 1)
61+
[ -z $ret ] && ret=${default}
6262
echo $ret
6363
}
6464

65-
datadir=$(get_option mysqld datadir "/var/lib/mysql")
66-
socket=$(get_option mysqld socket "$datadir/mysql.sock")
67-
pidfile=$(get_option mysqld_safe pid-file "/var/run/mysql/mysqld.pid")
65+
datadir=$(get_option datadir "/var/lib/mysql" mysqld)
66+
socket=$(get_option socket "$datadir/mysql.sock" mysqld)
67+
pidfile=$(get_option pid-file "/var/run/mysql/mysqld.pid" mysqld mysqld_safe)
6868

6969
install_db () {
7070
# Note: something different than datadir=/var/lib/mysql requires
7171
# SELinux policy changes (in enforcing mode)
72-
datadir=$(get_option mysqld datadir "/var/lib/mysql")
73-
logfile=$(get_option mysqld_safe log-error "/var/log/mysql/mysqld.log")
72+
datadir=$(get_option datadir "/var/lib/mysql" mysqld)
73+
logfile=$(get_option log-error "/var/log/mysql/mysqld.log" mysqld mysqld_safe)
7474

7575
# Restore log, dir, perms and SELinux contexts
7676
if [ ! -d "$datadir" -a ! -h "$datadir" -a "x$(dirname "$datadir")" = "x/var/lib" ]; then

0 commit comments

Comments
 (0)