[buildd-tools-devel] [PATCH] Fix shell script comparison.

Cyril Brulebois kibi at debian.org
Sun Oct 31 16:28:18 UTC 2010


The proper operator to compare strings is =, not ==. On dash for
example, one gets:
    $ [ "a" == "b" ]
    [: 1: a: unexpected operator
---
 bin/create-chroot                       |   12 ++++++------
 etc/profile-templates/buildd/all/config |    2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/bin/create-chroot b/bin/create-chroot
index 4c8761b..6359a7e 100755
--- a/bin/create-chroot
+++ b/bin/create-chroot
@@ -187,10 +187,10 @@ EOT
     fi
 
     if \
-        [ "$ARCH" == "mips" ] || \
-        [ "$ARCH" == "sparc" ] || \
-        [ "$ARCH" == "i386" ] || \
-        [ "$ARCH" == "powerpc" ]; then
+        [ "$ARCH" = "mips" ] || \
+        [ "$ARCH" = "sparc" ] || \
+        [ "$ARCH" = "i386" ] || \
+        [ "$ARCH" = "powerpc" ]; then
             echo "personality=linux32" >>"${TEMPFILE}"
     fi
     sudo mv "${TEMPFILE}" "/etc/schroot/chroot.d/buildd-${IDENTIFIER}${EXTRA}-${ARCH}"
@@ -491,11 +491,11 @@ do_debootstrap
 setup_schroot
 if ! [ -z "$VGNAME" ] && [ -z "$VARIANT" ]; then
     variants="security volatile backports"
-    if [ "$BASE" == "sid" ]; then variants="experimental"; fi
+    if [ "$BASE" = "sid" ]; then variants="experimental"; fi
     for EXTRA in $variants; do
         EXTRA=-${EXTRA}
         SUITEEXTRA=${SUITE}${EXTRA}
-        if [ "$BASE" == "sid" ]; then SUITEEXTRA="experimental"; fi
+        if [ "$BASE" = "sid" ]; then SUITEEXTRA="experimental"; fi
 
         setup_schroot_variant
 
diff --git a/etc/profile-templates/buildd/all/config b/etc/profile-templates/buildd/all/config
index 6b4b8e3..95e1567 100644
--- a/etc/profile-templates/buildd/all/config
+++ b/etc/profile-templates/buildd/all/config
@@ -1,5 +1,5 @@
 
-if [ "$CHROOT_SESSION_PURGE" == "true" ]; then
+if [ "$CHROOT_SESSION_PURGE" = "true" ]; then
     case $CHROOT_NAME in
         *-*-*-*-sbuild*)
         SUITE_BASE=$(echo $CHROOT_NAME | cut -f1 -d-)
-- 
1.7.2.3




More information about the Buildd-tools-devel mailing list