summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/eglibc/eglibc-2.18/tzselect-sh.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/eglibc/eglibc-2.18/tzselect-sh.patch')
-rw-r--r--meta/recipes-core/eglibc/eglibc-2.18/tzselect-sh.patch156
1 files changed, 156 insertions, 0 deletions
diff --git a/meta/recipes-core/eglibc/eglibc-2.18/tzselect-sh.patch b/meta/recipes-core/eglibc/eglibc-2.18/tzselect-sh.patch
new file mode 100644
index 0000000000..e9a3691bbb
--- /dev/null
+++ b/meta/recipes-core/eglibc/eglibc-2.18/tzselect-sh.patch
@@ -0,0 +1,156 @@
1tzselect: eliminate ksh-dependency
2
3This is an adapted version of a patch originally
4by Peter Seebach <peter.seebach@windriver.com> found here:
5http://www.eglibc.org/archives/patches/msg00671.html
6
7Upstream-Status: Pending
8
9Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
10
11Index: libc/timezone/tzselect.ksh
12===================================================================
13--- libc.orig/timezone/tzselect.ksh 2012-11-17 09:50:14.000000000 -0800
14+++ libc/timezone/tzselect.ksh 2013-01-03 22:46:26.423844259 -0800
15@@ -1,4 +1,4 @@
16-#!/bin/bash
17+#!/bin/sh
18
19 PKGVERSION='(tzcode) '
20 TZVERSION=see_Makefile
21@@ -11,23 +11,80 @@
22
23 # Porting notes:
24 #
25-# This script requires a Posix-like shell with the extension of a
26-# 'select' statement. The 'select' statement was introduced in the
27-# Korn shell and is available in Bash and other shell implementations.
28-# If your host lacks both Bash and the Korn shell, you can get their
29-# source from one of these locations:
30+# func_select allows this script to run on shells (such as busybox ash)
31+# which lack the ksh "select" builtin.
32 #
33-# Bash <http://www.gnu.org/software/bash/bash.html>
34-# Korn Shell <http://www.kornshell.com/>
35-# Public Domain Korn Shell <http://www.cs.mun.ca/~michael/pdksh/>
36-#
37-# This script also uses several features of modern awk programs.
38+# This script uses several features of modern awk programs.
39 # If your host lacks awk, or has an old awk that does not conform to Posix,
40 # you can use either of the following free programs instead:
41 #
42 # Gawk (GNU awk) <http://www.gnu.org/software/gawk/>
43 # mawk <http://invisible-island.net/mawk/>
44
45+# Implement ksh-style select in POSIX shell
46+
47+# We need a mostly-portable echo-n.
48+case `echo -n "foo\c"` in
49+*n*c*) func_echo_n() { echo "$*"; } ;;
50+*n*) func_echo_n() { echo "$*\c"; } ;;
51+*) func_echo_n() { echo -n "$*"; } ;;
52+esac
53+
54+# Synopsis: Replace "select foo in list" with "while func_select foo in list"
55+# and this works just like ksh, so far as I know.
56+func_select () {
57+ func_select_args=0
58+ if expr "$1" : "[_a-zA-Z][_a-zA-Z0-9]*$" > /dev/null; then
59+ func_select_var=$1
60+ else
61+ echo >&2 "func_select: '$1' is not a valid variable name."
62+ return 1
63+ fi
64+ shift 1
65+ case $1 in
66+ in) shift 1;;
67+ *) echo >&2 "func_select: usage: func_select var in ... (you must provide
68+arguments)"; return 1;;
69+ esac
70+ case $# in
71+ 0) echo >&2 "func_select: usage: func_select var in ..."; return 1;;
72+ esac
73+ for func_select_arg
74+ do
75+ func_select_args=`expr $func_select_args + 1`
76+ eval func_select_a_$func_select_args=\$func_select_arg
77+ done
78+ REPLY=""
79+ while :
80+ do
81+ if test -z "$REPLY"; then
82+ func_select_i=1
83+ while test $func_select_i -le $func_select_args
84+ do
85+ eval echo "\"\$func_select_i) \$func_select_a_$func_select_i\""
86+ func_select_i=`expr $func_select_i + 1`
87+ done
88+ fi
89+ func_echo_n "${PS3-#? }" >&2
90+ if read REPLY; then
91+ if test -n "${REPLY}"; then
92+ if expr "$REPLY" : '[1-9][0-9]*$' > /dev/null; then
93+ if test "$REPLY" -ge 1 && test "$REPLY" -le $func_select_args; then
94+ eval $func_select_var=\$func_select_a_$REPLY
95+ else
96+ eval $func_select_var=
97+ fi
98+ else
99+ eval $func_select_var=
100+ fi
101+ return 0
102+ fi
103+ else
104+ eval $func_select_var=
105+ return 1
106+ fi
107+ done
108+}
109
110 # Specify default values for environment variables if they are unset.
111 : ${AWK=awk}
112@@ -72,7 +129,7 @@
113
114
115 # Work around a bug in bash 1.14.7 and earlier, where $PS3 is sent to stdout.
116-case $(echo 1 | (select x in x; do break; done) 2>/dev/null) in
117+case $(echo 1 | (while func_select x in x; do break; done) 2>/dev/null) in
118 ?*) PS3=
119 esac
120
121@@ -92,7 +149,7 @@
122
123 echo >&2 'Please select a continent or ocean.'
124
125- select continent in \
126+ while func_select continent in \
127 Africa \
128 Americas \
129 Antarctica \
130@@ -172,7 +229,7 @@
131 case $countries in
132 *"$newline"*)
133 echo >&2 'Please select a country.'
134- select country in $countries
135+ while func_select country in $countries
136 do
137 case $country in
138 '') echo >&2 'Please enter a number in range.';;
139@@ -211,7 +268,7 @@
140 *"$newline"*)
141 echo >&2 'Please select one of the following' \
142 'time zone regions.'
143- select region in $regions
144+ while func_select region in $regions
145 do
146 case $region in
147 '') echo >&2 'Please enter a number in range.';;
148@@ -288,7 +345,7 @@
149 echo >&2 "Is the above information OK?"
150
151 ok=
152- select ok in Yes No
153+ while func_select ok in Yes No
154 do
155 case $ok in
156 '') echo >&2 'Please enter 1 for Yes, or 2 for No.';;