[Buildd-tools-devel] Bug#354526: bashisms/XSIisms in scripts

Clint Adams schizo at debian.org
Mon Feb 27 03:17:56 UTC 2006


Package: schroot
Version: 0.2.5-1

This should make things more portable.

diff -ur schroot-0.2.5.orig/schroot/run/00check schroot-0.2.5/schroot/run/00check
--- schroot-0.2.5.orig/schroot/run/00check	2006-02-24 08:53:40.000000000 -0500
+++ schroot-0.2.5/schroot/run/00check	2006-02-26 22:13:22.028859155 -0500
@@ -20,7 +20,7 @@
 	    :
 	elif [ "$CHROOT_TYPE" = "file" ]; then
 	    echo "CHROOT_FILE=$CHROOT_FILE"
-	elif [ "$CHROOT_TYPE" = "block-device" -o "$CHROOT_TYPE" = "lvm-snapshot" ]; then
+	elif [ "$CHROOT_TYPE" = "block-device" ] || [ "$CHROOT_TYPE" = "lvm-snapshot" ]; then
 	    echo "CHROOT_DEVICE=$CHROOT_DEVICE"
 	    echo "CHROOT_MOUNT_OPTIONS=$CHROOT_MOUNT_OPTIONS"
 	    if [ "$CHROOT_TYPE" = "lvm-snapshot" ]; then
diff -ur schroot-0.2.5.orig/schroot/setup/00check schroot-0.2.5/schroot/setup/00check
--- schroot-0.2.5.orig/schroot/setup/00check	2006-02-24 17:48:14.000000000 -0500
+++ schroot-0.2.5/schroot/setup/00check	2006-02-26 22:09:50.935641969 -0500
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-if [ $1 = "setup-start" -o $1 = "setup-recover" ]; then
+if [ $1 = "setup-start" ] || [ $1 = "setup-recover" ]; then
 
     if [ "$AUTH_VERBOSITY" = "verbose" ]; then
 	echo "AUTH_USER=$AUTH_USER"
@@ -20,7 +20,7 @@
 	    :
 	elif [ "$CHROOT_TYPE" = "file" ]; then
 	    echo "CHROOT_FILE=$CHROOT_FILE"
-	elif [ "$CHROOT_TYPE" = "block-device" -o "$CHROOT_TYPE" = "lvm-snapshot" ]; then
+	elif [ "$CHROOT_TYPE" = "block-device" ] || [ "$CHROOT_TYPE" = "lvm-snapshot" ]; then
 	    echo "CHROOT_DEVICE=$CHROOT_DEVICE"
 	    echo "CHROOT_MOUNT_OPTIONS=$CHROOT_MOUNT_OPTIONS"
 	    if [ "$CHROOT_TYPE" = "lvm-snapshot" ]; then
@@ -58,7 +58,7 @@
 
     # A basic safety check, so that the root filesystem doesn't get
     # toasted by accident.
-    if [ -z "$CHROOT_PATH" -o "$CHROOT_PATH" = "/" ]; then
+    if [ -z "$CHROOT_PATH" ] || [ "$CHROOT_PATH" = "/" ]; then
 	echo "Invalid chroot mount location: '$CHROOT_PATH'"
 	exit 1
     fi
diff -ur schroot-0.2.5.orig/schroot/setup/05file schroot-0.2.5/schroot/setup/05file
--- schroot-0.2.5.orig/schroot/setup/05file	2006-01-29 13:50:20.000000000 -0500
+++ schroot-0.2.5/schroot/setup/05file	2006-02-26 22:11:05.647149022 -0500
@@ -3,7 +3,7 @@
 set -e
 
 # Check file type
-function check_filetype()
+check_filetype()
 {
     if echo "$CHROOT_FILE" | grep -q '.tar$'; then
 	filetype="tar"
@@ -20,7 +20,7 @@
 }
 
 # Unpack archive
-function unpack_file()
+unpack_file()
 {
 	if [ "$filetype" = "tar" ]; then
 	    tar $VERBOSE -xf "$CHROOT_FILE"
diff -ur schroot-0.2.5.orig/schroot/setup/10mount schroot-0.2.5/schroot/setup/10mount
--- schroot-0.2.5.orig/schroot/setup/10mount	2006-02-24 18:49:32.000000000 -0500
+++ schroot-0.2.5/schroot/setup/10mount	2006-02-26 22:12:30.011629018 -0500
@@ -6,7 +6,7 @@
 # $1: mount options
 # $2: mount device
 # $3: mount location
-function do_mount()
+do_mount()
 {
     if [ "$AUTH_VERBOSITY" = "verbose" ]; then
 	echo "Mounting $2 on $3"
@@ -16,7 +16,7 @@
 
 # Unmount a filesystem
 # $1: mount location
-function do_umount()
+do_umount()
 {
     if [ "$AUTH_VERBOSITY" = "verbose" ]; then
 	echo "Unmounting $1"
@@ -26,7 +26,7 @@
 
 # Unmount all filesystem under specified location
 # $1: mount base location
-function do_umount_all
+do_umount_all()
 {
     for dir in $(mount | grep $1 | sed -e 's/.* on \(.*\) type.*/\1/' | sort -r); do
 	do_umount "$dir"
@@ -38,7 +38,7 @@
 #  FSCK_VERBOSE="-V"
 fi
 
-if [ "$CHROOT_TYPE" = "plain" -o "$CHROOT_TYPE" = "file" -o "$CHROOT_TYPE" = "block-device" -o "$CHROOT_TYPE" = "lvm-snapshot" ]; then
+if [ "$CHROOT_TYPE" = "plain" ] || [ "$CHROOT_TYPE" = "file" ] || [ "$CHROOT_TYPE" = "block-device" ] || [ "$CHROOT_TYPE" = "lvm-snapshot" ]; then
 
     if [ "$CHROOT_TYPE" = "plain" ]; then
 	CHROOT_MOUNT_OPTIONS="--bind"
@@ -49,7 +49,7 @@
 	CHROOT_MOUNT_DEVICE="$CHROOT_LVM_SNAPSHOT_DEVICE"
     fi
 
-    if [ $1 = "setup-start" -o $1 = "setup-recover" ]; then
+    if [ $1 = "setup-start" ] || [ $1 = "setup-recover" ]; then
 
         # fsck doesn't like being run non-interactively
 	#/sbin/fsck $FSCK_VERBOSE -n "$CHROOT_MOUNT_DEVICE"
diff -ur schroot-0.2.5.orig/schroot/setup/20network schroot-0.2.5/schroot/setup/20network
--- schroot-0.2.5.orig/schroot/setup/20network	2006-02-24 09:00:19.000000000 -0500
+++ schroot-0.2.5/schroot/setup/20network	2006-02-26 22:12:36.840315549 -0500
@@ -4,7 +4,7 @@
   VERBOSE="--verbose"
 fi
 
-if [ $1 = "setup-start" -o $1 = "setup-recover" ]; then
+if [ $1 = "setup-start" ] || [ $1 = "setup-recover" ]; then
   cp $VERBOSE /etc/resolv.conf "${CHROOT_PATH}/etc/resolv.conf"
 fi
 
diff -ur schroot-0.2.5.orig/schroot/setup/30passwd schroot-0.2.5/schroot/setup/30passwd
--- schroot-0.2.5.orig/schroot/setup/30passwd	2006-02-24 09:00:24.000000000 -0500
+++ schroot-0.2.5/schroot/setup/30passwd	2006-02-26 22:12:48.673505264 -0500
@@ -4,7 +4,7 @@
   VERBOSE="--verbose"
 fi
 
-if [ $1 = "setup-start" -o $1 = "setup-recover" ]; then
+if [ $1 = "setup-start" ] || [ $1 = "setup-recover" ]; then
   cp $VERBOSE /etc/passwd "${CHROOT_PATH}/etc/passwd"
   cp $VERBOSE /etc/shadow "${CHROOT_PATH}/etc/shadow"
   cp $VERBOSE /etc/group  "${CHROOT_PATH}/etc/group"
diff -ur schroot-0.2.5.orig/schroot/setup/50chrootname schroot-0.2.5/schroot/setup/50chrootname
--- schroot-0.2.5.orig/schroot/setup/50chrootname	2006-02-24 09:00:29.000000000 -0500
+++ schroot-0.2.5/schroot/setup/50chrootname	2006-02-26 22:13:03.763022459 -0500
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-if [ $1 = "setup-start" -o $1 = "setup-recover" ]; then
+if [ $1 = "setup-start" ] || [ $1 = "setup-recover" ]; then
   if [ "$AUTH_VERBOSITY" = "verbose" ]; then
     echo "Setting chroot name to ${CHROOT_NAME}"
   fi




More information about the Buildd-tools-devel mailing list