ia64/xen-unstable

changeset 11875:cbc181eb54fa

Fix 'chk' scripts for generic shell (non-bash) and *BSD.
From: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Wed Oct 18 15:26:08 2006 +0100 (2006-10-18)
parents 2ae6000abda3
children 4ecfbf08b449
files tools/check/check_brctl tools/check/check_iproute tools/check/check_python tools/check/check_zlib_devel tools/check/check_zlib_lib tools/check/chk
line diff
     1.1 --- a/tools/check/check_brctl	Wed Oct 18 15:16:37 2006 +0100
     1.2 +++ b/tools/check/check_brctl	Wed Oct 18 15:26:08 2006 +0100
     1.3 @@ -1,10 +1,27 @@
     1.4 -#!/bin/bash
     1.5 +#!/bin/sh
     1.6  # CHECK-INSTALL
     1.7  
     1.8 -function error {
     1.9 -   echo
    1.10 -   echo '  *** Check for the bridge control utils (brctl) FAILED'
    1.11 -   exit 1
    1.12 -}
    1.13 +RC=0
    1.14  
    1.15 -which brctl 1>/dev/null 2>&1 || error
    1.16 +case ${OS} in
    1.17 +OpenBSD|NetBSD|FreeBSD)
    1.18 +	# These systems have a bridge builtin
    1.19 +	TOOL="brconfig"
    1.20 +	which ${TOOL} 1>/dev/null 2>&1 || RC=1 
    1.21 +	;;
    1.22 +Linux)
    1.23 +	TOOL="brctl"
    1.24 +	which ${TOOL} 1>/dev/null 2>&1 || RC=1
    1.25 +	;;
    1.26 +*)
    1.27 +	TOOL=""
    1.28 +	echo "Unknown OS" && RC=1
    1.29 +	;;
    1.30 +esac
    1.31 +
    1.32 +if test ${RC} -ne 0; then
    1.33 +	echo
    1.34 +	echo " *** Check for the bridge control utils (${TOOL}) FAILED"
    1.35 +fi
    1.36 +
    1.37 +exit ${RC} 
     2.1 --- a/tools/check/check_iproute	Wed Oct 18 15:16:37 2006 +0100
     2.2 +++ b/tools/check/check_iproute	Wed Oct 18 15:26:08 2006 +0100
     2.3 @@ -1,11 +1,26 @@
     2.4 -#!/bin/bash
     2.5 +#!/bin/sh
     2.6  # CHECK-INSTALL
     2.7  
     2.8 -function error {
     2.9 -   echo
    2.10 -   echo '  *** Check for iproute (ip addr) FAILED'
    2.11 -   exit 1
    2.12 -}
    2.13 +RC=0
    2.14  
    2.15 -ip addr list 1>/dev/null 2>&1 || error
    2.16 +case ${OS} in
    2.17 +OpenBSD|NetBSD|FreeBSD)
    2.18 +	TOOL="ifconfig"
    2.19 +	eval ${TOOL} -a 1>/dev/null 2>&1 || RC=1 
    2.20 +	;;
    2.21 +Linux)
    2.22 +	TOOL="ip addr"
    2.23 +	eval ${TOOL} list 1>/dev/null 2>&1 || RC=1 
    2.24 +	;;
    2.25 +*)
    2.26 +	TOOL=""
    2.27 +	echo "Unknown OS" && RC=1 
    2.28 +	;;
    2.29 +esac
    2.30  
    2.31 +if test ${RC} -ne 0; then
    2.32 +	echo
    2.33 +	echo " *** Check for iproute (${TOOL}) FAILED"
    2.34 +fi
    2.35 +
    2.36 +exit ${RC} 
     3.1 --- a/tools/check/check_python	Wed Oct 18 15:16:37 2006 +0100
     3.2 +++ b/tools/check/check_python	Wed Oct 18 15:26:08 2006 +0100
     3.3 @@ -1,10 +1,13 @@
     3.4 -#!/bin/bash
     3.5 +#!/bin/sh
     3.6  # CHECK-BUILD CHECK-INSTALL
     3.7  
     3.8 -function error {
     3.9 -    echo
    3.10 -    echo "  *** Check for Python version >= 2.2 FAILED"
    3.11 -    exit 1
    3.12 -}
    3.13 +RC=0
    3.14 +
    3.15 +python -V 2>&1 | cut -d ' ' -f 2 | grep -q '^2.[2345]' || RC=1
    3.16  
    3.17 -python -V 2>&1 | cut -d ' ' -f 2 | grep -q '^2.[2345]' || error
    3.18 +if test ${RC} -ne 0; then
    3.19 +	echo
    3.20 +	echo " *** Check for Python version >= 2.2 FAILED"
    3.21 +fi
    3.22 +
    3.23 +exit ${RC} 
     4.1 --- a/tools/check/check_zlib_devel	Wed Oct 18 15:16:37 2006 +0100
     4.2 +++ b/tools/check/check_zlib_devel	Wed Oct 18 15:26:08 2006 +0100
     4.3 @@ -1,11 +1,14 @@
     4.4 -#!/bin/bash
     4.5 +#!/bin/sh
     4.6  # CHECK-BUILD
     4.7  
     4.8 -function error {
     4.9 -    echo
    4.10 -    echo "  *** Check for zlib headers FAILED"
    4.11 -    exit 1
    4.12 -}
    4.13 +RC=0
    4.14  
    4.15  set -e
    4.16 -[ -e /usr/include/zlib.h ] || error
    4.17 +test -r /usr/include/zlib.h || RC=1
    4.18 +
    4.19 +if test ${RC} -ne 0; then
    4.20 +	echo
    4.21 +	echo " *** Check for zlib headers FAILED"
    4.22 +fi 
    4.23 +
    4.24 +exit ${RC}
     5.1 --- a/tools/check/check_zlib_lib	Wed Oct 18 15:16:37 2006 +0100
     5.2 +++ b/tools/check/check_zlib_lib	Wed Oct 18 15:26:08 2006 +0100
     5.3 @@ -1,11 +1,14 @@
     5.4 -#!/bin/bash
     5.5 +#!/bin/sh
     5.6  # CHECK-BUILD CHECK-INSTALL
     5.7  
     5.8 -function error {
     5.9 -    echo
    5.10 -    echo "  *** Check for zlib library FAILED"
    5.11 -    exit 1
    5.12 -}
    5.13 +RC=0
    5.14  
    5.15  set -e
    5.16 -ldconfig -p | grep -q libz.so || error
    5.17 +ldconfig -v 2>&1 | grep -q libz.so || RC=1
    5.18 +
    5.19 +if test ${RC} -ne 0; then
    5.20 +	echo
    5.21 +	echo " *** Check for zlib library FAILED"
    5.22 +fi
    5.23 +
    5.24 +exit ${RC} 
     6.1 --- a/tools/check/chk	Wed Oct 18 15:16:37 2006 +0100
     6.2 +++ b/tools/check/chk	Wed Oct 18 15:26:08 2006 +0100
     6.3 @@ -1,8 +1,9 @@
     6.4 -#!/bin/bash
     6.5 +#!/bin/sh
     6.6  
     6.7 -function usage {
     6.8 +func_usage ()
     6.9 +{
    6.10      echo "Usage:"
    6.11 -    echo "\t$0 [build|install|clean]"
    6.12 +    echo "	$0 [build|install|clean]"
    6.13      echo
    6.14      echo "Check suitability for Xen build or install."
    6.15      echo "Exit with 0 if OK, 1 if not."
    6.16 @@ -12,9 +13,13 @@ function usage {
    6.17      exit 1
    6.18  }
    6.19  
    6.20 -export PATH=${PATH}:/sbin:/usr/sbin
    6.21 +PATH=${PATH}:/sbin:/usr/sbin
    6.22 +OS=`uname -s`
    6.23 +export PATH OS
    6.24  
    6.25 -[ `uname -s` = SunOS ] && exit 0
    6.26 +if test "${OS}" = "SunOS"; then
    6.27 +	exit 0
    6.28 +fi
    6.29  
    6.30  case $1 in
    6.31      build)
    6.32 @@ -27,7 +32,7 @@ case $1 in
    6.33          exit 0
    6.34          ;;
    6.35      *)
    6.36 -        usage
    6.37 +        func_usage
    6.38          ;;
    6.39  esac
    6.40  
    6.41 @@ -56,4 +61,4 @@ for f in check_* ; do
    6.42      fi
    6.43  done
    6.44  
    6.45 -exit $failed
    6.46 +exit ${failed}