mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2024-12-19 04:47:52 +00:00
Use 'gawk', not plain 'awk'.
We need GNU Awk? Then check for, and use 'gawk', not plain 'awk'. Be a little mre verbose if a tool was not found. /trunk/configure | 7 4 3 0 ++++--- /trunk/scripts/build/kernel/linux.sh | 2 1 1 0 +- /trunk/scripts/functions | 16 8 8 0 ++++++++-------- /trunk/scripts/saveSample.sh | 4 2 2 0 ++-- 4 files changed, 15 insertions(+), 14 deletions(-)
This commit is contained in:
parent
d31396bc23
commit
a5bbab574f
7
configure
vendored
7
configure
vendored
@ -36,7 +36,7 @@ TOOLS_TO_CHECK='
|
|||||||
/bin/bash/^GNU bash, version 3\.
|
/bin/bash/^GNU bash, version 3\.
|
||||||
make/^GNU Make
|
make/^GNU Make
|
||||||
gcc/
|
gcc/
|
||||||
awk/^GNU Awk
|
gawk/^GNU Awk
|
||||||
sed/
|
sed/
|
||||||
bison/
|
bison/
|
||||||
flex/
|
flex/
|
||||||
@ -83,9 +83,10 @@ has_or_abort() {
|
|||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
if [ -n "${regexp}" ]; then
|
if [ -n "${regexp}" ]; then
|
||||||
str=$(${tool} --version 2>&1 |grep -E "${regexp}" |head -n 1)
|
tool_version=$(${tool} --version 2>&1)
|
||||||
|
str=$(echo "${tool_version}" |grep -E "${regexp}" |head -n 1)
|
||||||
if [ -z "${str}" ]; then
|
if [ -z "${str}" ]; then
|
||||||
echo "wrong version string"
|
echo "wrong version string: expecting regexp '${regexp}'"
|
||||||
where=""
|
where=""
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
@ -49,7 +49,7 @@ do_kernel_install() {
|
|||||||
|
|
||||||
# Only starting with 2.6.18 does headers_install is usable. We only
|
# Only starting with 2.6.18 does headers_install is usable. We only
|
||||||
# have 2.6 version available, so only test for sublevel.
|
# have 2.6 version available, so only test for sublevel.
|
||||||
k_sublevel=$(awk '/^SUBLEVEL =/ { print $3 }' "${CT_SRC_DIR}/${CT_KERNEL_FILE}/Makefile")
|
k_sublevel=$(gawk '/^SUBLEVEL =/ { print $3 }' "${CT_SRC_DIR}/${CT_KERNEL_FILE}/Makefile")
|
||||||
[ ${k_sublevel} -ge 18 ] || CT_Abort "Kernel version >= 2.6.18 is needed to install kernel headers."
|
[ ${k_sublevel} -ge 18 ] || CT_Abort "Kernel version >= 2.6.18 is needed to install kernel headers."
|
||||||
|
|
||||||
V_OPT="V=${CT_KERNEL_LINUX_VERBOSE_LEVEL}"
|
V_OPT="V=${CT_KERNEL_LINUX_VERBOSE_LEVEL}"
|
||||||
|
@ -319,7 +319,7 @@ CT_DoSetProxy() {
|
|||||||
# Find all interfaces and build locally accessible networks
|
# Find all interfaces and build locally accessible networks
|
||||||
server_ip=$(ping -c 1 -W 2 "${CT_PROXY_HOST}" |head -n 1 |sed -r -e 's/^[^\(]+\(([^\)]+)\).*$/\1/;' || true)
|
server_ip=$(ping -c 1 -W 2 "${CT_PROXY_HOST}" |head -n 1 |sed -r -e 's/^[^\(]+\(([^\)]+)\).*$/\1/;' || true)
|
||||||
CT_TestOrAbort "SOCKS proxy '${CT_PROXY_HOST}' has no IP." -n "${server_ip}"
|
CT_TestOrAbort "SOCKS proxy '${CT_PROXY_HOST}' has no IP." -n "${server_ip}"
|
||||||
/sbin/ifconfig |awk -v server_ip="${server_ip}" '
|
/sbin/ifconfig |gawk -v server_ip="${server_ip}" '
|
||||||
BEGIN {
|
BEGIN {
|
||||||
split( server_ip, tmp, "\\." );
|
split( server_ip, tmp, "\\." );
|
||||||
server_ip_num = tmp[1] * 2^24 + tmp[2] * 2^16 + tmp[3] * 2^8 + tmp[4] * 2^0;
|
server_ip_num = tmp[1] * 2^24 + tmp[2] * 2^16 + tmp[3] * 2^8 + tmp[4] * 2^0;
|
||||||
@ -751,13 +751,13 @@ CT_DoSaveState() {
|
|||||||
CT_DoLog DEBUG " Saving environment and aliases"
|
CT_DoLog DEBUG " Saving environment and aliases"
|
||||||
# We must omit shell functions, and some specific bash variables
|
# We must omit shell functions, and some specific bash variables
|
||||||
# that break when restoring the environment, later. We could do
|
# that break when restoring the environment, later. We could do
|
||||||
# all the processing in the awk script, but a sed is easier...
|
# all the processing in the gawk script, but a sed is easier...
|
||||||
set |awk '
|
set |gawk '
|
||||||
BEGIN { _p = 1; }
|
BEGIN { _p = 1; }
|
||||||
$0~/^[^ ]+ \(\)/ { _p = 0; }
|
$0~/^[^ ]+ \(\)/ { _p = 0; }
|
||||||
_p == 1
|
_p == 1
|
||||||
$0 == "}" { _p = 1; }
|
$0 == "}" { _p = 1; }
|
||||||
' |sed -r -e '/^BASH_(ARGC|ARGV|LINENO|SOURCE|VERSINFO)=/d;
|
' |sed -r -e '/^BASH_(ARGC|ARGV|LINENO|SOURCE|VERSINFO)=/d;
|
||||||
/^(UID|EUID)=/d;
|
/^(UID|EUID)=/d;
|
||||||
/^(FUNCNAME|GROUPS|PPID|SHELLOPTS)=/d;' >"${state_dir}/env.sh"
|
/^(FUNCNAME|GROUPS|PPID|SHELLOPTS)=/d;' >"${state_dir}/env.sh"
|
||||||
|
|
||||||
|
@ -59,8 +59,8 @@ sed -r -e 's|^(CT_PREFIX_DIR)=.*|\1="${HOME}/x-tools/${CT_TARGET}"|;' \
|
|||||||
CT_DoAddFileToSample() {
|
CT_DoAddFileToSample() {
|
||||||
source="$1"
|
source="$1"
|
||||||
dest="$2"
|
dest="$2"
|
||||||
inode_s=$(ls -i "${source}" |awk '{ print $1; }')
|
inode_s=$(ls -i "${source}" |gawk '{ print $1; }')
|
||||||
inode_d=$(ls -i "${dest}" 2>/dev/null |awk '{ print $1; }' || true)
|
inode_d=$(ls -i "${dest}" 2>/dev/null |gawk '{ print $1; }' || true)
|
||||||
if [ "${inode_s}" != "${inode_d}" ]; then
|
if [ "${inode_s}" != "${inode_d}" ]; then
|
||||||
cp "${source}" "${dest}"
|
cp "${source}" "${dest}"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user