Skip to content

Commit 86d2586

Browse files
committed
Merge branch 'mysql-5.6' into mysql-5.7
2 parents d11ef96 + 722b8b0 commit 86d2586

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
@@ -34,26 +34,29 @@ lockfile=/var/lock/subsys/$prog
3434
command=$1 && shift
3535
extra_opts="$@"
3636

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

50-
get_mysql_option mysqld datadir "/var/lib/mysql"
53+
get_mysql_option datadir "/var/lib/mysql" mysqld
5154
datadir="$result"
52-
get_mysql_option mysqld socket "$datadir/mysql.sock"
55+
get_mysql_option socket "$datadir/mysql.sock" mysqld
5356
socketfile="$result"
54-
get_mysql_option mysqld_safe log-error "/var/log/mysqld.log"
57+
get_mysql_option log-error "/var/log/mysqld.log" mysqld mysqld_safe
5558
errlogfile="$result"
56-
get_mysql_option mysqld_safe pid-file "/var/run/mysqld/mysqld.pid"
59+
get_mysql_option pid-file "/var/run/mysqld/mysqld.pid" mysqld mysqld_safe
5760
mypidfile="$result"
5861

5962
case $socketfile in

packaging/rpm-sles/mysql.init

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,17 @@ command=$1 && shift
5757
extra_opts="$@"
5858

5959
get_option () {
60-
local section=$1
61-
local option=$2
62-
local default=$3
63-
ret=$(/usr/bin/my_print_defaults $section | grep '^--'${option}'=' | cut -d= -f2- | tail -n 1)
64-
[ -z $ret ] && ret=$default
60+
local option=$1
61+
local default=$2
62+
shift 2
63+
ret=$(/usr/bin/my_print_defaults "$@" | sed -n "s/^--${option}=//p" | tail -n 1)
64+
[ -z $ret ] && ret=${default}
6565
echo $ret
6666
}
6767

68-
datadir=$(get_option mysqld datadir "/var/lib/mysql")
69-
socket=$(get_option mysqld socket "$datadir/mysql.sock")
70-
pidfile=$(get_option mysqld_safe pid-file "/var/run/mysql/mysqld.pid")
68+
datadir=$(get_option datadir "/var/lib/mysql" mysqld)
69+
socket=$(get_option socket "$datadir/mysql.sock" mysqld)
70+
pidfile=$(get_option pid-file "/var/run/mysql/mysqld.pid" mysqld mysqld_safe)
7171

7272
install_validate_password_sql_file () {
7373
local dir
@@ -86,8 +86,8 @@ install_validate_password_sql_file () {
8686
install_db () {
8787
# Note: something different than datadir=/var/lib/mysql requires
8888
# SELinux policy changes (in enforcing mode)
89-
datadir=$(get_option mysqld datadir "/var/lib/mysql")
90-
logfile=$(get_option mysqld_safe log-error "/var/log/mysql/mysqld.log")
89+
datadir=$(get_option datadir "/var/lib/mysql" mysqld)
90+
logfile=$(get_option log-error "/var/log/mysql/mysqld.log" mysqld mysqld_safe)
9191

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

0 commit comments

Comments
 (0)