public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] remove bashisms from scripts/extract-ikconfig
@ 2008-11-12 18:39 Werner Almesberger
  2008-11-12 19:13 ` Randy Dunlap
  2008-11-22 11:24 ` Sam Ravnborg
  0 siblings, 2 replies; 10+ messages in thread
From: Werner Almesberger @ 2008-11-12 18:39 UTC (permalink / raw)
  To: linux-kernel

unbashify-extract-ikconfig.patch

scripts/extract-ikconfig contains a lot of gratuituous bashisms,
which make it fail if /bin/sh isn't bash. This patch replaces them
with regular Bourne shell constructs.

Signed-off-by: Werner Almesberger <werner@openmoko.org>

---

diff --git a/scripts/extract-ikconfig b/scripts/extract-ikconfig
index 8187e6f..72997c3 100755
--- a/scripts/extract-ikconfig
+++ b/scripts/extract-ikconfig
@@ -8,8 +8,8 @@ test -e $binoffset || cc -o $binoffset ./scripts/binoffset.c || exit 1
 
 IKCFG_ST="0x49 0x4b 0x43 0x46 0x47 0x5f 0x53 0x54"
 IKCFG_ED="0x49 0x4b 0x43 0x46 0x47 0x5f 0x45 0x44"
-function dump_config {
-    typeset file="$1"
+dump_config() {
+    file="$1"
 
     start=`$binoffset $file $IKCFG_ST 2>/dev/null`
     [ "$?" != "0" ] && start="-1"
@@ -18,8 +18,8 @@ function dump_config {
     fi
     end=`$binoffset $file $IKCFG_ED 2>/dev/null`
 
-    let start="$start + 8"
-    let size="$end - $start"
+    start=`expr $start + 8`
+    size=`expr $end - $start`
 
     dd if="$file" ibs=1 skip="$start" count="$size" 2>/dev/null | zcat
 

^ permalink raw reply related	[flat|nested] 10+ messages in thread
* [PATCH] Remove bashisms from scripts/extract-ikconfig
@ 2007-06-09 19:22 Christian Kujau
  2007-06-09 19:26 ` Julio M. Merino Vidal
  0 siblings, 1 reply; 10+ messages in thread
From: Christian Kujau @ 2007-06-09 19:22 UTC (permalink / raw)
  To: linux-kernel

Hi,

I noticed that scripts/extract-ikconfig is using /bin/sh in its shebang 
but when /bin/sh is not a symlink to bash, it breaks with:

# scripts/extract-ikconfig /boot/vmlinux
scripts/extract-ikconfig: 11: function: not found
scripts/extract-ikconfig: 12: typeset: not found

The diff below seems to fix this.

Signed-off-by: Christian Kujau <lists@nerdbynature.de>

--- linux-2.6-dev/scripts/extract-ikconfig.orig	2007-06-01 22:53:49.000000000 +0200
+++ linux-2.6-dev/scripts/extract-ikconfig	2007-06-01 23:00:54.000000000 +0200
@@ -8,8 +8,8 @@ test -e $binoffset || cc -o $binoffset .

  IKCFG_ST="0x49 0x4b 0x43 0x46 0x47 0x5f 0x53 0x54"
  IKCFG_ED="0x49 0x4b 0x43 0x46 0x47 0x5f 0x45 0x44"
-function dump_config {
-    typeset file="$1"
+dump_config() {
+    file="$1"

      start=`$binoffset $file $IKCFG_ST 2>/dev/null`
      [ "$?" != "0" ] && start="-1"
@@ -18,8 +18,8 @@ function dump_config {
      fi
      end=`$binoffset $file $IKCFG_ED 2>/dev/null`

-    let start="$start + 8"
-    let size="$end - $start"
+    start="`expr $start + 8`"
+    size="`expr $end - $start`"

      dd if="$file" ibs=1 skip="$start" count="$size" 2>/dev/null | zcat


-- 
make bzImage, not war

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2008-11-22 11:25 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-12 18:39 [PATCH] remove bashisms from scripts/extract-ikconfig Werner Almesberger
2008-11-12 19:13 ` Randy Dunlap
2008-11-22 11:24 ` Sam Ravnborg
  -- strict thread matches above, loose matches on Subject: below --
2007-06-09 19:22 [PATCH] Remove " Christian Kujau
2007-06-09 19:26 ` Julio M. Merino Vidal
2007-06-09 19:34   ` Christian Kujau
2007-06-09 19:39     ` Julio M. Merino Vidal
2007-06-09 19:53     ` Willy Tarreau
2007-06-09 20:14       ` Christian Kujau
2007-11-14 23:44         ` Randy Dunlap

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox