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(-)
1.1 --- a/configure Wed Oct 29 21:20:23 2008 +0000
1.2 +++ b/configure Wed Oct 29 22:27:30 2008 +0000
1.3 @@ -36,7 +36,7 @@
1.4 /bin/bash/^GNU bash, version 3\.
1.5 make/^GNU Make
1.6 gcc/
1.7 -awk/^GNU Awk
1.8 +gawk/^GNU Awk
1.9 sed/
1.10 bison/
1.11 flex/
1.12 @@ -83,9 +83,10 @@
1.13 continue
1.14 else
1.15 if [ -n "${regexp}" ]; then
1.16 - str=$(${tool} --version 2>&1 |grep -E "${regexp}" |head -n 1)
1.17 + tool_version=$(${tool} --version 2>&1)
1.18 + str=$(echo "${tool_version}" |grep -E "${regexp}" |head -n 1)
1.19 if [ -z "${str}" ]; then
1.20 - echo "wrong version string"
1.21 + echo "wrong version string: expecting regexp '${regexp}'"
1.22 where=""
1.23 continue
1.24 fi
2.1 --- a/scripts/build/kernel/linux.sh Wed Oct 29 21:20:23 2008 +0000
2.2 +++ b/scripts/build/kernel/linux.sh Wed Oct 29 22:27:30 2008 +0000
2.3 @@ -49,7 +49,7 @@
2.4
2.5 # Only starting with 2.6.18 does headers_install is usable. We only
2.6 # have 2.6 version available, so only test for sublevel.
2.7 - k_sublevel=$(awk '/^SUBLEVEL =/ { print $3 }' "${CT_SRC_DIR}/${CT_KERNEL_FILE}/Makefile")
2.8 + k_sublevel=$(gawk '/^SUBLEVEL =/ { print $3 }' "${CT_SRC_DIR}/${CT_KERNEL_FILE}/Makefile")
2.9 [ ${k_sublevel} -ge 18 ] || CT_Abort "Kernel version >= 2.6.18 is needed to install kernel headers."
2.10
2.11 V_OPT="V=${CT_KERNEL_LINUX_VERBOSE_LEVEL}"
3.1 --- a/scripts/functions Wed Oct 29 21:20:23 2008 +0000
3.2 +++ b/scripts/functions Wed Oct 29 22:27:30 2008 +0000
3.3 @@ -319,7 +319,7 @@
3.4 # Find all interfaces and build locally accessible networks
3.5 server_ip=$(ping -c 1 -W 2 "${CT_PROXY_HOST}" |head -n 1 |sed -r -e 's/^[^\(]+\(([^\)]+)\).*$/\1/;' || true)
3.6 CT_TestOrAbort "SOCKS proxy '${CT_PROXY_HOST}' has no IP." -n "${server_ip}"
3.7 - /sbin/ifconfig |awk -v server_ip="${server_ip}" '
3.8 + /sbin/ifconfig |gawk -v server_ip="${server_ip}" '
3.9 BEGIN {
3.10 split( server_ip, tmp, "\\." );
3.11 server_ip_num = tmp[1] * 2^24 + tmp[2] * 2^16 + tmp[3] * 2^8 + tmp[4] * 2^0;
3.12 @@ -751,13 +751,13 @@
3.13 CT_DoLog DEBUG " Saving environment and aliases"
3.14 # We must omit shell functions, and some specific bash variables
3.15 # that break when restoring the environment, later. We could do
3.16 - # all the processing in the awk script, but a sed is easier...
3.17 - set |awk '
3.18 - BEGIN { _p = 1; }
3.19 - $0~/^[^ ]+ \(\)/ { _p = 0; }
3.20 - _p == 1
3.21 - $0 == "}" { _p = 1; }
3.22 - ' |sed -r -e '/^BASH_(ARGC|ARGV|LINENO|SOURCE|VERSINFO)=/d;
3.23 + # all the processing in the gawk script, but a sed is easier...
3.24 + set |gawk '
3.25 + BEGIN { _p = 1; }
3.26 + $0~/^[^ ]+ \(\)/ { _p = 0; }
3.27 + _p == 1
3.28 + $0 == "}" { _p = 1; }
3.29 + ' |sed -r -e '/^BASH_(ARGC|ARGV|LINENO|SOURCE|VERSINFO)=/d;
3.30 /^(UID|EUID)=/d;
3.31 /^(FUNCNAME|GROUPS|PPID|SHELLOPTS)=/d;' >"${state_dir}/env.sh"
3.32
4.1 --- a/scripts/saveSample.sh Wed Oct 29 21:20:23 2008 +0000
4.2 +++ b/scripts/saveSample.sh Wed Oct 29 22:27:30 2008 +0000
4.3 @@ -59,8 +59,8 @@
4.4 CT_DoAddFileToSample() {
4.5 source="$1"
4.6 dest="$2"
4.7 - inode_s=$(ls -i "${source}" |awk '{ print $1; }')
4.8 - inode_d=$(ls -i "${dest}" 2>/dev/null |awk '{ print $1; }' || true)
4.9 + inode_s=$(ls -i "${source}" |gawk '{ print $1; }')
4.10 + inode_d=$(ls -i "${dest}" 2>/dev/null |gawk '{ print $1; }' || true)
4.11 if [ "${inode_s}" != "${inode_d}" ]; then
4.12 cp "${source}" "${dest}"
4.13 fi