Skip to content

Commit c361883

Browse files
committed
Merge pull request #75 from edmorley/fix-my_print_defaults-handling
Make get_option() handle duplicate options in my_print_defaults output
2 parents 18ec190 + f9fd52d commit c361883

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

5.5/docker-entrypoint.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ get_option () {
55
local section=$1
66
local option=$2
77
local default=$3
8-
ret=$(my_print_defaults $section | grep '^--'${option}'=' | cut -d= -f2-)
8+
# my_print_defaults can output duplicates, if an option exists both globally and in
9+
# a custom config file. We pick the last occurence, which is from the custom config.
10+
ret=$(my_print_defaults $section | grep '^--'${option}'=' | cut -d= -f2- | tail -n1)
911
[ -z $ret ] && ret=$default
1012
echo $ret
1113
}

5.6/docker-entrypoint.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ get_option () {
55
local section=$1
66
local option=$2
77
local default=$3
8-
ret=$(my_print_defaults $section | grep '^--'${option}'=' | cut -d= -f2-)
8+
# my_print_defaults can output duplicates, if an option exists both globally and in
9+
# a custom config file. We pick the last occurence, which is from the custom config.
10+
ret=$(my_print_defaults $section | grep '^--'${option}'=' | cut -d= -f2- | tail -n1)
911
[ -z $ret ] && ret=$default
1012
echo $ret
1113
}

5.7/docker-entrypoint.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ get_option () {
55
local section=$1
66
local option=$2
77
local default=$3
8-
ret=$(my_print_defaults $section | grep '^--'${option}'=' | cut -d= -f2-)
8+
# my_print_defaults can output duplicates, if an option exists both globally and in
9+
# a custom config file. We pick the last occurence, which is from the custom config.
10+
ret=$(my_print_defaults $section | grep '^--'${option}'=' | cut -d= -f2- | tail -n1)
911
[ -z $ret ] && ret=$default
1012
echo $ret
1113
}
@@ -77,6 +79,7 @@ if [ "$1" = 'mysqld' ]; then
7779
echo 'FLUSH PRIVILEGES ;' >> "$tempSqlFile"
7880

7981
mysql -uroot < "$tempSqlFile"
82+
8083
rm -f "$tempSqlFile"
8184
kill $(cat $PIDFILE)
8285
for i in $(seq 30 -1 0); do
@@ -95,4 +98,3 @@ if [ "$1" = 'mysqld' ]; then
9598
fi
9699

97100
exec "$@"
98-

0 commit comments

Comments
 (0)