* [PATCH] Minor fixes for non-Linux platforms
@ 2006-10-12 8:33 Christoph Egger
2006-10-13 9:56 ` Bastian Blank
0 siblings, 1 reply; 10+ messages in thread
From: Christoph Egger @ 2006-10-12 8:33 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1: Type: text/plain, Size: 240 bytes --]
Hello!
The attached patch makes the stuff in tools/check/ work for *BSD systems.
Consider this as a start to make xen buildable on non-Linux platforms.
I don't expect to get this into xen 3.0.3, but I hope this can go into
-unstable.
[-- Attachment #2: tools_check.diff --]
[-- Type: text/x-diff, Size: 2469 bytes --]
diff -r f14a67a35bec tools/check/check_brctl
--- a/tools/check/check_brctl Thu Oct 12 17:53:51 2006 +0100
+++ b/tools/check/check_brctl Thu Oct 12 10:17:33 2006 +0200
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# CHECK-INSTALL
function error {
@@ -7,4 +7,18 @@ function error {
exit 1
}
-which brctl 1>/dev/null 2>&1 || error
+
+case ${OS} in
+OpenBSD|NetBSD|FreeBSD)
+ # These systems have a bridge builtin
+ which brconfig 1>/dev/null 2>&1 || error
+ ;;
+Linux)
+ which brctl 1>/dev/null 2>&1 || error
+ ;;
+*)
+ echo "Unknown OS" && error
+ ;;
+esac
+
+exit 0
diff -r f14a67a35bec tools/check/check_iproute
--- a/tools/check/check_iproute Thu Oct 12 17:53:51 2006 +0100
+++ b/tools/check/check_iproute Thu Oct 12 10:17:33 2006 +0200
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# CHECK-INSTALL
function error {
@@ -7,5 +7,16 @@ function error {
exit 1
}
-ip addr list 1>/dev/null 2>&1 || error
+case ${OS} in
+OpenBSD|NetBSD|FreeBSD)
+ ifconfig -a 1>/dev/null 2>&1 || error
+ ;;
+Linux)
+ ip addr list 1>/dev/null 2>&1 || error
+ ;;
+*)
+ echo "Unknown OS" && error
+ ;;
+esac
+exit 0
diff -r f14a67a35bec tools/check/check_python
--- a/tools/check/check_python Thu Oct 12 17:53:51 2006 +0100
+++ b/tools/check/check_python Thu Oct 12 10:17:33 2006 +0200
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# CHECK-BUILD CHECK-INSTALL
function error {
diff -r f14a67a35bec tools/check/check_zlib_devel
--- a/tools/check/check_zlib_devel Thu Oct 12 17:53:51 2006 +0100
+++ b/tools/check/check_zlib_devel Thu Oct 12 10:17:33 2006 +0200
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# CHECK-BUILD
function error {
diff -r f14a67a35bec tools/check/check_zlib_lib
--- a/tools/check/check_zlib_lib Thu Oct 12 17:53:51 2006 +0100
+++ b/tools/check/check_zlib_lib Thu Oct 12 10:17:33 2006 +0200
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# CHECK-BUILD CHECK-INSTALL
function error {
@@ -8,4 +8,4 @@ function error {
}
set -e
-ldconfig -p | grep -q libz.so || error
+ldconfig -v 2>&1 | grep -q libz.so || error
diff -r f14a67a35bec tools/check/chk
--- a/tools/check/chk Thu Oct 12 17:53:51 2006 +0100
+++ b/tools/check/chk Thu Oct 12 10:17:33 2006 +0200
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
function usage {
echo "Usage:"
@@ -13,6 +13,7 @@ function usage {
}
export PATH=${PATH}:/sbin:/usr/sbin
+export OS=`uname -s`
case $1 in
build)
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Minor fixes for non-Linux platforms
2006-10-13 11:54 ` Keir Fraser
@ 2006-10-12 12:33 ` Christoph Egger
2006-10-13 16:45 ` Christian Limpach
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Christoph Egger @ 2006-10-12 12:33 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1: Type: text/plain, Size: 703 bytes --]
On Friday 13 October 2006 13:54, Keir Fraser wrote:
> On 13/10/06 10:56, "Bastian Blank" <bastian@waldi.eu.org> wrote:
> >> diff -r f14a67a35bec tools/check/check_brctl
> >> --- a/tools/check/check_brctl Thu Oct 12 17:53:51 2006 +0100
> >> +++ b/tools/check/check_brctl Thu Oct 12 10:17:33 2006 +0200
> >> @@ -1,4 +1,4 @@
> >> -#!/bin/bash
> >> +#!/bin/sh
> >
> > Thats a bad idea. Some of the scripts uses non-POSIX extensions and
> > /bin/sh is normaly only defined as POSIX compilant.
>
> The scripts are tiny. We should stop them using those non-compliant
> extensions. We use /bin/sh in just about all our other scripts (and some of
> those are *way* more complex).
One more try. Patch attached.
[-- Attachment #2: tools_check.diff --]
[-- Type: text/x-diff, Size: 4250 bytes --]
diff -r 49d096ef3d76 tools/check/check_brctl
--- a/tools/check/check_brctl Fri Oct 13 10:58:29 2006 +0100
+++ b/tools/check/check_brctl Thu Oct 12 14:31:08 2006 +0200
@@ -1,10 +1,25 @@
-#!/bin/bash
+#!/bin/sh
# CHECK-INSTALL
-function error {
- echo
- echo ' *** Check for the bridge control utils (brctl) FAILED'
- exit 1
-}
+RC=0
-which brctl 1>/dev/null 2>&1 || error
+case ${OS} in
+OpenBSD|NetBSD|FreeBSD)
+ # These systems have a bridge builtin
+ which brconfig 1>/dev/null 2>&1 || RC=1
+ ;;
+Linux)
+ which brctl 1>/dev/null 2>&1 || RC=1
+ ;;
+*)
+ echo "Unknown OS" && error
+ ;;
+esac
+
+
+if test ${RC} -ne 0; then
+ echo
+ echo ' *** Check for the bridge control utils (brctl) FAILED'
+fi
+
+exit ${RC}
diff -r 49d096ef3d76 tools/check/check_iproute
--- a/tools/check/check_iproute Fri Oct 13 10:58:29 2006 +0100
+++ b/tools/check/check_iproute Thu Oct 12 14:31:08 2006 +0200
@@ -1,11 +1,23 @@
-#!/bin/bash
+#!/bin/sh
# CHECK-INSTALL
-function error {
- echo
- echo ' *** Check for iproute (ip addr) FAILED'
- exit 1
-}
+RC=0
-ip addr list 1>/dev/null 2>&1 || error
+case ${OS} in
+OpenBSD|NetBSD|FreeBSD)
+ ifconfig -a 1>/dev/null 2>&1 || RC=1
+ ;;
+Linux)
+ ip addr list 1>/dev/null 2>&1 || RC=1
+ ;;
+*)
+ echo "Unknown OS" && RC=1
+ ;;
+esac
+if test ${RC} -ne 0; then
+ echo
+ echo ' *** Check for iproute (ip addr) FAILED'
+fi
+
+exit ${RC}
diff -r 49d096ef3d76 tools/check/check_python
--- a/tools/check/check_python Fri Oct 13 10:58:29 2006 +0100
+++ b/tools/check/check_python Thu Oct 12 14:31:08 2006 +0200
@@ -1,10 +1,13 @@
-#!/bin/bash
+#!/bin/sh
# CHECK-BUILD CHECK-INSTALL
-function error {
- echo
- echo " *** Check for Python version >= 2.2 FAILED"
- exit 1
-}
+RC=0
-python -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=1
+
+if test ${RC} -ne 0; then
+ echo
+ echo " *** Check for Python version >= 2.2 FAILED"
+fi
+
+exit ${RC}
diff -r 49d096ef3d76 tools/check/check_zlib_devel
--- a/tools/check/check_zlib_devel Fri Oct 13 10:58:29 2006 +0100
+++ b/tools/check/check_zlib_devel Thu Oct 12 14:31:08 2006 +0200
@@ -1,11 +1,14 @@
-#!/bin/bash
+#!/bin/sh
# CHECK-BUILD
-function error {
- echo
- echo " *** Check for zlib headers FAILED"
- exit 1
-}
+RC=0
set -e
-[ -e /usr/include/zlib.h ] || error
+test -r /usr/include/zlib.h || RC=1
+
+if test ${RC} -ne 0; then
+ echo
+ echo " *** Check for zlib headers FAILED"
+fi
+
+exit ${RC}
diff -r 49d096ef3d76 tools/check/check_zlib_lib
--- a/tools/check/check_zlib_lib Fri Oct 13 10:58:29 2006 +0100
+++ b/tools/check/check_zlib_lib Thu Oct 12 14:31:08 2006 +0200
@@ -1,11 +1,14 @@
-#!/bin/bash
+#!/bin/sh
# CHECK-BUILD CHECK-INSTALL
-function error {
- echo
- echo " *** Check for zlib library FAILED"
- exit 1
-}
+RC=0
set -e
-ldconfig -p | grep -q libz.so || error
+ldconfig -v 2>&1 | grep -q libz.so || RC=1
+
+if test ${RC} -ne 0; then
+ echo
+ echo " *** Check for zlib library FAILED"
+fi
+
+exit ${RC}
diff -r 49d096ef3d76 tools/check/chk
--- a/tools/check/chk Fri Oct 13 10:58:29 2006 +0100
+++ b/tools/check/chk Thu Oct 12 14:31:08 2006 +0200
@@ -1,18 +1,7 @@
-#!/bin/bash
-
-function usage {
- echo "Usage:"
- echo "\t$0 [build|install|clean]"
- echo
- echo "Check suitability for Xen build or install."
- echo "Exit with 0 if OK, 1 if not."
- echo "Prints only failed tests."
- echo
- echo "Calling with 'clean' removes generated files."
- exit 1
-}
+#!/bin/sh
export PATH=${PATH}:/sbin:/usr/sbin
+export OS=`uname -s`
case $1 in
build)
@@ -25,7 +14,15 @@ case $1 in
exit 0
;;
*)
- usage
+ echo "Usage:"
+ echo "\t$0 [build|install|clean]"
+ echo
+ echo "Check suitability for Xen build or install."
+ echo "Exit with 0 if OK, 1 if not."
+ echo "Prints only failed tests."
+ echo
+ echo "Calling with 'clean' removes generated files."
+ exit 1
;;
esac
@@ -54,4 +51,4 @@ for f in check_* ; do
fi
done
-exit $failed
+exit ${failed}
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Minor fixes for non-Linux platforms
2006-10-12 8:33 [PATCH] Minor fixes for non-Linux platforms Christoph Egger
@ 2006-10-13 9:56 ` Bastian Blank
2006-10-13 11:54 ` Keir Fraser
0 siblings, 1 reply; 10+ messages in thread
From: Bastian Blank @ 2006-10-13 9:56 UTC (permalink / raw)
To: Christoph Egger; +Cc: xen-devel
On Thu, Oct 12, 2006 at 10:33:41AM +0200, Christoph Egger wrote:
> diff -r f14a67a35bec tools/check/check_brctl
> --- a/tools/check/check_brctl Thu Oct 12 17:53:51 2006 +0100
> +++ b/tools/check/check_brctl Thu Oct 12 10:17:33 2006 +0200
> @@ -1,4 +1,4 @@
> -#!/bin/bash
> +#!/bin/sh
Thats a bad idea. Some of the scripts uses non-POSIX extensions and
/bin/sh is normaly only defined as POSIX compilant.
Bastian
--
Men will always be men -- no matter where they are.
-- Harry Mudd, "Mudd's Women", stardate 1329.8
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Minor fixes for non-Linux platforms
2006-10-13 9:56 ` Bastian Blank
@ 2006-10-13 11:54 ` Keir Fraser
2006-10-12 12:33 ` Christoph Egger
0 siblings, 1 reply; 10+ messages in thread
From: Keir Fraser @ 2006-10-13 11:54 UTC (permalink / raw)
To: Bastian Blank, Christoph Egger; +Cc: xen-devel
On 13/10/06 10:56, "Bastian Blank" <bastian@waldi.eu.org> wrote:
>> diff -r f14a67a35bec tools/check/check_brctl
>> --- a/tools/check/check_brctl Thu Oct 12 17:53:51 2006 +0100
>> +++ b/tools/check/check_brctl Thu Oct 12 10:17:33 2006 +0200
>> @@ -1,4 +1,4 @@
>> -#!/bin/bash
>> +#!/bin/sh
>
> Thats a bad idea. Some of the scripts uses non-POSIX extensions and
> /bin/sh is normaly only defined as POSIX compilant.
The scripts are tiny. We should stop them using those non-compliant
extensions. We use /bin/sh in just about all our other scripts (and some of
those are *way* more complex).
-- Keir
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Minor fixes for non-Linux platforms
2006-10-12 12:33 ` Christoph Egger
@ 2006-10-13 16:45 ` Christian Limpach
2006-10-13 21:27 ` Aron Griffis
2006-10-13 21:56 ` Aron Griffis
2 siblings, 0 replies; 10+ messages in thread
From: Christian Limpach @ 2006-10-13 16:45 UTC (permalink / raw)
To: Christoph Egger; +Cc: xen-devel
On 10/12/06, Christoph Egger <Christoph.Egger@amd.com> wrote:
> One more try. Patch attached.
In check_brctl, you remove the error function but you don't remove all
users of it.
christian
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Minor fixes for non-Linux platforms
2006-10-12 12:33 ` Christoph Egger
2006-10-13 16:45 ` Christian Limpach
@ 2006-10-13 21:27 ` Aron Griffis
2006-10-15 8:39 ` Christoph Egger
2006-10-13 21:56 ` Aron Griffis
2 siblings, 1 reply; 10+ messages in thread
From: Aron Griffis @ 2006-10-13 21:27 UTC (permalink / raw)
To: Christoph Egger; +Cc: xen-devel
Christoph Egger wrote: [Thu Oct 12 2006, 08:33:22AM EDT]
> diff -r 49d096ef3d76 tools/check/chk
> --- a/tools/check/chk Fri Oct 13 10:58:29 2006 +0100
> +++ b/tools/check/chk Thu Oct 12 14:31:08 2006 +0200
> @@ -1,18 +1,7 @@
> -#!/bin/bash
> -
> -function usage {
> - echo "Usage:"
> - echo "\t$0 [build|install|clean]"
> - echo
> - echo "Check suitability for Xen build or install."
> - echo "Exit with 0 if OK, 1 if not."
> - echo "Prints only failed tests."
> - echo
> - echo "Calling with 'clean' removes generated files."
> - exit 1
> -}
> +#!/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
> case $1 in
> build)
> @@ -25,7 +14,15 @@ case $1 in
> exit 0
> ;;
> *)
> - 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.
Aron
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Minor fixes for non-Linux platforms
2006-10-12 12:33 ` Christoph Egger
2006-10-13 16:45 ` Christian Limpach
2006-10-13 21:27 ` Aron Griffis
@ 2006-10-13 21:56 ` Aron Griffis
2006-10-14 15:29 ` Ewan Mellor
2 siblings, 1 reply; 10+ messages in thread
From: Aron Griffis @ 2006-10-13 21:56 UTC (permalink / raw)
To: Christoph Egger; +Cc: xen-devel
Christoph,
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
}
Aron
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Minor fixes for non-Linux platforms
2006-10-13 21:56 ` Aron Griffis
@ 2006-10-14 15:29 ` Ewan Mellor
0 siblings, 0 replies; 10+ messages in thread
From: Ewan Mellor @ 2006-10-14 15:29 UTC (permalink / raw)
To: Christoph Egger, xen-devel
On Fri, Oct 13, 2006 at 05:56:21PM -0400, Aron Griffis wrote:
> Christoph,
>
> 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
> }
IEEE 1003.1 section 2.9.5 seems to be appropriate:
http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_09_05
And that indeed shows functions being supported as above. Surely we can work to
this spec on this matter?
Ewan.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Minor fixes for non-Linux platforms
2006-10-13 21:27 ` Aron Griffis
@ 2006-10-15 8:39 ` Christoph Egger
2006-10-17 14:08 ` Christoph Egger
0 siblings, 1 reply; 10+ messages in thread
From: Christoph Egger @ 2006-10-15 8:39 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1: Type: text/plain, Size: 1239 bytes --]
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.
[-- Attachment #2: tools_check.diff --]
[-- Type: text/x-diff, Size: 4132 bytes --]
diff -r 6ed4368b4a9e tools/check/check_brctl
--- 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 @@
-#!/bin/bash
+#!/bin/sh
# CHECK-INSTALL
-function error {
- echo
- echo ' *** Check for the bridge control utils (brctl) FAILED'
- exit 1
-}
+RC=0
-which brctl 1>/dev/null 2>&1 || error
+case ${OS} in
+OpenBSD|NetBSD|FreeBSD)
+ # These systems have a bridge builtin
+ TOOL="brconfig"
+ which ${TOOL} 1>/dev/null 2>&1 || RC=1
+ ;;
+Linux)
+ TOOL="brctl"
+ which ${TOOL} 1>/dev/null 2>&1 || RC=1
+ ;;
+*)
+ TOOL=""
+ echo "Unknown OS" && RC=1
+ ;;
+esac
+
+if test ${RC} -ne 0; then
+ echo
+ echo " *** Check for the bridge control utils (${TOOL}) FAILED"
+fi
+
+exit ${RC}
diff -r 6ed4368b4a9e tools/check/check_iproute
--- 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 @@
-#!/bin/bash
+#!/bin/sh
# CHECK-INSTALL
-function error {
- echo
- echo ' *** Check for iproute (ip addr) FAILED'
- exit 1
-}
+RC=0
-ip addr list 1>/dev/null 2>&1 || error
+case ${OS} in
+OpenBSD|NetBSD|FreeBSD)
+ TOOL="ifconfig"
+ eval ${TOOL} -a 1>/dev/null 2>&1 || RC=1
+ ;;
+Linux)
+ TOOL="ip addr"
+ eval ${TOOL} list 1>/dev/null 2>&1 || RC=1
+ ;;
+*)
+ TOOL=""
+ echo "Unknown OS" && RC=1
+ ;;
+esac
+if test ${RC} -ne 0; then
+ echo
+ echo " *** Check for iproute (${TOOL}) FAILED"
+fi
+
+exit ${RC}
diff -r 6ed4368b4a9e tools/check/check_python
--- 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 @@
-#!/bin/bash
+#!/bin/sh
# CHECK-BUILD CHECK-INSTALL
-function error {
- echo
- echo " *** Check for Python version >= 2.2 FAILED"
- exit 1
-}
+RC=0
-python -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=1
+
+if test ${RC} -ne 0; then
+ echo
+ echo " *** Check for Python version >= 2.2 FAILED"
+fi
+
+exit ${RC}
diff -r 6ed4368b4a9e tools/check/check_zlib_devel
--- 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 @@
-#!/bin/bash
+#!/bin/sh
# CHECK-BUILD
-function error {
- echo
- echo " *** Check for zlib headers FAILED"
- exit 1
-}
+RC=0
set -e
-[ -e /usr/include/zlib.h ] || error
+test -r /usr/include/zlib.h || RC=1
+
+if test ${RC} -ne 0; then
+ echo
+ echo " *** Check for zlib headers FAILED"
+fi
+
+exit ${RC}
diff -r 6ed4368b4a9e tools/check/check_zlib_lib
--- 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 @@
-#!/bin/bash
+#!/bin/sh
# CHECK-BUILD CHECK-INSTALL
-function error {
- echo
- echo " *** Check for zlib library FAILED"
- exit 1
-}
+RC=0
set -e
-ldconfig -p | grep -q libz.so || error
+ldconfig -v 2>&1 | grep -q libz.so || RC=1
+
+if test ${RC} -ne 0; then
+ echo
+ echo " *** Check for zlib library FAILED"
+fi
+
+exit ${RC}
diff -r 6ed4368b4a9e tools/check/chk
--- 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 @@
-#!/bin/bash
+#!/bin/sh
-function usage {
+func_usage ()
+{
echo "Usage:"
- 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
}
-export PATH=${PATH}:/sbin:/usr/sbin
+PATH=${PATH}:/sbin:/usr/sbin
+OS=`uname -s`
+export PATH OS
case $1 in
build)
@@ -25,7 +28,7 @@ case $1 in
exit 0
;;
*)
- usage
+ func_usage
;;
esac
@@ -54,4 +57,4 @@ for f in check_* ; do
fi
done
-exit $failed
+exit ${failed}
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Minor fixes for non-Linux platforms
2006-10-15 8:39 ` Christoph Egger
@ 2006-10-17 14:08 ` Christoph Egger
0 siblings, 0 replies; 10+ messages in thread
From: Christoph Egger @ 2006-10-17 14:08 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1: Type: text/plain, Size: 142 bytes --]
This is a resend of the patch with a minor adaption for the Solaris patches.
The patch is against C/S 11791.
Please apply to xen-unstable.
[-- Attachment #2: tools_check.diff --]
[-- Type: text/x-diff, Size: 4024 bytes --]
diff -r 5525b18b7224 tools/check/check_brctl
--- a/tools/check/check_brctl Wed Oct 18 11:38:59 2006 +0100
+++ b/tools/check/check_brctl Tue Oct 17 15:57:03 2006 +0200
@@ -1,10 +1,27 @@
-#!/bin/bash
+#!/bin/sh
# CHECK-INSTALL
-function error {
- echo
- echo ' *** Check for the bridge control utils (brctl) FAILED'
- exit 1
-}
+RC=0
-which brctl 1>/dev/null 2>&1 || error
+case ${OS} in
+OpenBSD|NetBSD|FreeBSD)
+ # These systems have a bridge builtin
+ TOOL="brconfig"
+ which ${TOOL} 1>/dev/null 2>&1 || RC=1
+ ;;
+Linux)
+ TOOL="brctl"
+ which ${TOOL} 1>/dev/null 2>&1 || RC=1
+ ;;
+*)
+ TOOL=""
+ echo "Unknown OS" && RC=1
+ ;;
+esac
+
+if test ${RC} -ne 0; then
+ echo
+ echo " *** Check for the bridge control utils (${TOOL}) FAILED"
+fi
+
+exit ${RC}
diff -r 5525b18b7224 tools/check/check_iproute
--- a/tools/check/check_iproute Wed Oct 18 11:38:59 2006 +0100
+++ b/tools/check/check_iproute Tue Oct 17 15:57:03 2006 +0200
@@ -1,11 +1,26 @@
-#!/bin/bash
+#!/bin/sh
# CHECK-INSTALL
-function error {
- echo
- echo ' *** Check for iproute (ip addr) FAILED'
- exit 1
-}
+RC=0
-ip addr list 1>/dev/null 2>&1 || error
+case ${OS} in
+OpenBSD|NetBSD|FreeBSD)
+ TOOL="ifconfig"
+ eval ${TOOL} -a 1>/dev/null 2>&1 || RC=1
+ ;;
+Linux)
+ TOOL="ip addr"
+ eval ${TOOL} list 1>/dev/null 2>&1 || RC=1
+ ;;
+*)
+ TOOL=""
+ echo "Unknown OS" && RC=1
+ ;;
+esac
+if test ${RC} -ne 0; then
+ echo
+ echo " *** Check for iproute (${TOOL}) FAILED"
+fi
+
+exit ${RC}
diff -r 5525b18b7224 tools/check/check_python
--- a/tools/check/check_python Wed Oct 18 11:38:59 2006 +0100
+++ b/tools/check/check_python Tue Oct 17 15:57:03 2006 +0200
@@ -1,10 +1,13 @@
-#!/bin/bash
+#!/bin/sh
# CHECK-BUILD CHECK-INSTALL
-function error {
- echo
- echo " *** Check for Python version >= 2.2 FAILED"
- exit 1
-}
+RC=0
-python -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=1
+
+if test ${RC} -ne 0; then
+ echo
+ echo " *** Check for Python version >= 2.2 FAILED"
+fi
+
+exit ${RC}
diff -r 5525b18b7224 tools/check/check_zlib_devel
--- a/tools/check/check_zlib_devel Wed Oct 18 11:38:59 2006 +0100
+++ b/tools/check/check_zlib_devel Tue Oct 17 15:57:03 2006 +0200
@@ -1,11 +1,14 @@
-#!/bin/bash
+#!/bin/sh
# CHECK-BUILD
-function error {
- echo
- echo " *** Check for zlib headers FAILED"
- exit 1
-}
+RC=0
set -e
-[ -e /usr/include/zlib.h ] || error
+test -r /usr/include/zlib.h || RC=1
+
+if test ${RC} -ne 0; then
+ echo
+ echo " *** Check for zlib headers FAILED"
+fi
+
+exit ${RC}
diff -r 5525b18b7224 tools/check/check_zlib_lib
--- a/tools/check/check_zlib_lib Wed Oct 18 11:38:59 2006 +0100
+++ b/tools/check/check_zlib_lib Tue Oct 17 15:57:03 2006 +0200
@@ -1,11 +1,14 @@
-#!/bin/bash
+#!/bin/sh
# CHECK-BUILD CHECK-INSTALL
-function error {
- echo
- echo " *** Check for zlib library FAILED"
- exit 1
-}
+RC=0
set -e
-ldconfig -p | grep -q libz.so || error
+ldconfig -v 2>&1 | grep -q libz.so || RC=1
+
+if test ${RC} -ne 0; then
+ echo
+ echo " *** Check for zlib library FAILED"
+fi
+
+exit ${RC}
diff -r 5525b18b7224 tools/check/chk
--- a/tools/check/chk Wed Oct 18 11:38:59 2006 +0100
+++ b/tools/check/chk Tue Oct 17 15:57:03 2006 +0200
@@ -1,8 +1,9 @@
-#!/bin/bash
+#!/bin/sh
-function usage {
+func_usage ()
+{
echo "Usage:"
- 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,9 +13,13 @@ function usage {
exit 1
}
-export PATH=${PATH}:/sbin:/usr/sbin
+PATH=${PATH}:/sbin:/usr/sbin
+OS=`uname -s`
+export PATH OS
-[ `uname -s` = SunOS ] && exit 0
+if test "${OS}" = "SunOS"; then
+ exit 0
+fi
case $1 in
build)
@@ -27,7 +32,7 @@ case $1 in
exit 0
;;
*)
- usage
+ func_usage
;;
esac
@@ -56,4 +61,4 @@ for f in check_* ; do
fi
done
-exit $failed
+exit ${failed}
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2006-10-17 14:08 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-12 8:33 [PATCH] Minor fixes for non-Linux platforms Christoph Egger
2006-10-13 9:56 ` Bastian Blank
2006-10-13 11:54 ` Keir Fraser
2006-10-12 12:33 ` Christoph Egger
2006-10-13 16:45 ` Christian Limpach
2006-10-13 21:27 ` Aron Griffis
2006-10-15 8:39 ` Christoph Egger
2006-10-17 14:08 ` Christoph Egger
2006-10-13 21:56 ` Aron Griffis
2006-10-14 15:29 ` Ewan Mellor
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.