From: "Christoph Egger" Subject: Re: [PATCH] Minor fixes for non-Linux platforms Date: Sun, 15 Oct 2006 10:39:32 +0200 Message-ID: <200610151039.32995.Christoph.Egger@amd.com> References: <200610121433.23484.Christoph.Egger@amd.com> <20061013212750.GG416@fc.hp.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Boundary-00=_EPfMFP1d/8cz3nL" Return-path: In-Reply-To: <20061013212750.GG416@fc.hp.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --Boundary-00=_EPfMFP1d/8cz3nL Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Friday 13 October 2006, Aron Griffis wrote: > Christoph Egger wrote: [Thu Oct 12 2006, 08:33:22AM EDT] > [...] > > +#!/bin/sh > > > > export PATH=${PATH}:/sbin:/usr/sbin > > +export OS=`uname -s` > > export with variable assignment doesn't work on most Bourne shells. > These need to be split up: > > PATH=${PATH}:/sbin:/usr/sbin > OS=`uname -s` > export PATH OS > Fixed. [...] > > - usage > > + echo "Usage:" > > + echo "\t$0 [build|install|clean]" > > \t isn't standard (it doesn't even work on Linux without -e). > You should insert a real tab there instead. Fixed. > Just wondering, why did you get rid of all the functions from these > scripts? AFAIK, every Bourne shell ever made supports functions, > though they might need to be declared with the older syntax: > > func() { > asdfasdf > } The scripts are so small, you gain nothing with functions - not even just for readability. One exception: The usage function in the chk script actually improves readability. So I converted it to the old and portable Bourne Shell syntax. On Friday 13 October 2006, Christian Limpach wrote: > In check_brctl, you remove the error function but you don't remove all > users of it. Fixed. New Patch attached. --Boundary-00=_EPfMFP1d/8cz3nL Content-Type: text/x-diff; charset=utf-8; name=tools_check.diff Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=tools_check.diff diff -r 6ed4368b4a9e tools/check/check_brctl =2D-- a/tools/check/check_brctl Sun Oct 15 09:53:20 2006 +0100 +++ b/tools/check/check_brctl Sun Oct 15 10:36:00 2006 +0200 @@ -1,10 +1,27 @@ =2D#!/bin/bash +#!/bin/sh # CHECK-INSTALL =20 =2Dfunction error { =2D echo =2D echo ' *** Check for the bridge control utils (brctl) FAILED' =2D exit 1 =2D} +RC=3D0 =20 =2Dwhich brctl 1>/dev/null 2>&1 || error +case ${OS} in +OpenBSD|NetBSD|FreeBSD) + # These systems have a bridge builtin + TOOL=3D"brconfig" + which ${TOOL} 1>/dev/null 2>&1 || RC=3D1=20 + ;; +Linux) + TOOL=3D"brctl" + which ${TOOL} 1>/dev/null 2>&1 || RC=3D1 + ;; +*) + TOOL=3D"" + echo "Unknown OS" && RC=3D1 + ;; +esac + +if test ${RC} -ne 0; then + echo + echo " *** Check for the bridge control utils (${TOOL}) FAILED" +fi + +exit ${RC}=20 diff -r 6ed4368b4a9e tools/check/check_iproute =2D-- a/tools/check/check_iproute Sun Oct 15 09:53:20 2006 +0100 +++ b/tools/check/check_iproute Sun Oct 15 10:36:00 2006 +0200 @@ -1,11 +1,26 @@ =2D#!/bin/bash +#!/bin/sh # CHECK-INSTALL =20 =2Dfunction error { =2D echo =2D echo ' *** Check for iproute (ip addr) FAILED' =2D exit 1 =2D} +RC=3D0 =20 =2Dip addr list 1>/dev/null 2>&1 || error +case ${OS} in +OpenBSD|NetBSD|FreeBSD) + TOOL=3D"ifconfig" + eval ${TOOL} -a 1>/dev/null 2>&1 || RC=3D1=20 + ;; +Linux) + TOOL=3D"ip addr" + eval ${TOOL} list 1>/dev/null 2>&1 || RC=3D1=20 + ;; +*) + TOOL=3D"" + echo "Unknown OS" && RC=3D1=20 + ;; +esac =20 +if test ${RC} -ne 0; then + echo + echo " *** Check for iproute (${TOOL}) FAILED" +fi + +exit ${RC}=20 diff -r 6ed4368b4a9e tools/check/check_python =2D-- a/tools/check/check_python Sun Oct 15 09:53:20 2006 +0100 +++ b/tools/check/check_python Sun Oct 15 10:36:00 2006 +0200 @@ -1,10 +1,13 @@ =2D#!/bin/bash +#!/bin/sh # CHECK-BUILD CHECK-INSTALL =20 =2Dfunction error { =2D echo =2D echo " *** Check for Python version >=3D 2.2 FAILED" =2D exit 1 =2D} +RC=3D0 =20 =2Dpython -V 2>&1 | cut -d ' ' -f 2 | grep -q '^2.[2345]' || error +python -V 2>&1 | cut -d ' ' -f 2 | grep -q '^2.[2345]' || RC=3D1 + +if test ${RC} -ne 0; then + echo + echo " *** Check for Python version >=3D 2.2 FAILED" +fi + +exit ${RC}=20 diff -r 6ed4368b4a9e tools/check/check_zlib_devel =2D-- a/tools/check/check_zlib_devel Sun Oct 15 09:53:20 2006 +0100 +++ b/tools/check/check_zlib_devel Sun Oct 15 10:36:00 2006 +0200 @@ -1,11 +1,14 @@ =2D#!/bin/bash +#!/bin/sh # CHECK-BUILD =20 =2Dfunction error { =2D echo =2D echo " *** Check for zlib headers FAILED" =2D exit 1 =2D} +RC=3D0 =20 set -e =2D[ -e /usr/include/zlib.h ] || error +test -r /usr/include/zlib.h || RC=3D1 + +if test ${RC} -ne 0; then + echo + echo " *** Check for zlib headers FAILED" +fi=20 + +exit ${RC} diff -r 6ed4368b4a9e tools/check/check_zlib_lib =2D-- a/tools/check/check_zlib_lib Sun Oct 15 09:53:20 2006 +0100 +++ b/tools/check/check_zlib_lib Sun Oct 15 10:36:00 2006 +0200 @@ -1,11 +1,14 @@ =2D#!/bin/bash +#!/bin/sh # CHECK-BUILD CHECK-INSTALL =20 =2Dfunction error { =2D echo =2D echo " *** Check for zlib library FAILED" =2D exit 1 =2D} +RC=3D0 =20 set -e =2Dldconfig -p | grep -q libz.so || error +ldconfig -v 2>&1 | grep -q libz.so || RC=3D1 + +if test ${RC} -ne 0; then + echo + echo " *** Check for zlib library FAILED" +fi + +exit ${RC}=20 diff -r 6ed4368b4a9e tools/check/chk =2D-- a/tools/check/chk Sun Oct 15 09:53:20 2006 +0100 +++ b/tools/check/chk Sun Oct 15 10:36:00 2006 +0200 @@ -1,8 +1,9 @@ =2D#!/bin/bash +#!/bin/sh =20 =2Dfunction usage { +func_usage () +{ echo "Usage:" =2D echo "\t$0 [build|install|clean]" + echo " $0 [build|install|clean]" echo echo "Check suitability for Xen build or install." echo "Exit with 0 if OK, 1 if not." @@ -12,7 +13,9 @@ function usage { exit 1 } =20 =2Dexport PATH=3D${PATH}:/sbin:/usr/sbin +PATH=3D${PATH}:/sbin:/usr/sbin +OS=3D`uname -s` +export PATH OS =20 case $1 in build) @@ -25,7 +28,7 @@ case $1 in exit 0 ;; *) =2D usage + func_usage ;; esac =20 @@ -54,4 +57,4 @@ for f in check_* ; do fi done =20 =2Dexit $failed +exit ${failed} --Boundary-00=_EPfMFP1d/8cz3nL Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --Boundary-00=_EPfMFP1d/8cz3nL--