mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] scripts/gen_initramfs_list.sh: Convert to a /bin/sh script
       [not found] <1304622227-18204-1-git-send-email-jamey@minilop.net>
@ 2011-05-05 19:03 ` Jamey Sharp
  2011-05-12 14:59   ` Michal Marek
  0 siblings, 1 reply; 2+ messages in thread
From: Jamey Sharp @ 2011-05-05 19:03 UTC (permalink / raw)
  To: linux-kernel; +Cc: Josh Triplett, Andrew Morton

Replace bashisms with POSIX-compatible shell scripting.

Notably, de-duplicate '/' using a sed command from elsewhere in the same script
rather than "${name//\/\///}".

Commit by Jamey Sharp and Josh Triplett.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
 scripts/gen_initramfs_list.sh |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh
index e12b1a7..cf0537b 100644
--- a/scripts/gen_initramfs_list.sh
+++ b/scripts/gen_initramfs_list.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 # Copyright (C) Martin Schlemmer <azarah@nosferatu.za.org>
 # Copyright (C) 2006 Sam Ravnborg <sam@ravnborg.org>
 #
@@ -105,9 +105,9 @@ list_parse() {
 # for links, devices etc the format differs. See gen_init_cpio for details
 parse() {
 	local location="$1"
-	local name="${location/${srcdir}//}"
+	local name="/${location#${srcdir}}"
 	# change '//' into '/'
-	name="${name//\/\///}"
+	name=$(echo "$name" | sed -e 's://*:/:g')
 	local mode="$2"
 	local uid="$3"
 	local gid="$4"
@@ -117,8 +117,8 @@ parse() {
 	[ "$root_gid" = "squash" ] && gid=0 || [ "$gid" -eq "$root_gid" ] && gid=0
 	local str="${mode} ${uid} ${gid}"
 
-	[ "${ftype}" == "invalid" ] && return 0
-	[ "${location}" == "${srcdir}" ] && return 0
+	[ "${ftype}" = "invalid" ] && return 0
+	[ "${location}" = "${srcdir}" ] && return 0
 
 	case "${ftype}" in
 		"file")
@@ -192,7 +192,7 @@ input_file() {
 	if [ -f "$1" ]; then
 		${dep_list}header "$1"
 		is_cpio="$(echo "$1" | sed 's/^.*\.cpio\(\..*\)\?/cpio/')"
-		if [ $2 -eq 0 -a ${is_cpio} == "cpio" ]; then
+		if [ $2 -eq 0 -a ${is_cpio} = "cpio" ]; then
 			cpio_file=$1
 			echo "$1" | grep -q '^.*\.cpio\..*' && is_cpio_compressed="compressed"
 			[ ! -z ${dep_list} ] && echo "$1"
@@ -204,7 +204,7 @@ input_file() {
 		else
 		        echo "$1 \\"
 			cat "$1" | while read type dir file perm ; do
-				if [ "$type" == "file" ]; then
+				if [ "$type" = "file" ]; then
 					echo "$file \\";
 				fi
 			done
-- 
1.7.4.4


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

* Re: [PATCH] scripts/gen_initramfs_list.sh: Convert to a /bin/sh script
  2011-05-05 19:03 ` [PATCH] scripts/gen_initramfs_list.sh: Convert to a /bin/sh script Jamey Sharp
@ 2011-05-12 14:59   ` Michal Marek
  0 siblings, 0 replies; 2+ messages in thread
From: Michal Marek @ 2011-05-12 14:59 UTC (permalink / raw)
  To: Jamey Sharp; +Cc: linux-kernel, Josh Triplett, Andrew Morton

On Thu, May 05, 2011 at 12:03:47PM -0700, Jamey Sharp wrote:
> Replace bashisms with POSIX-compatible shell scripting.
> 
> Notably, de-duplicate '/' using a sed command from elsewhere in the same script
> rather than "${name//\/\///}".
> 
> Commit by Jamey Sharp and Josh Triplett.
> 
> Signed-off-by: Jamey Sharp <jamey@minilop.net>
> Signed-off-by: Josh Triplett <josh@joshtriplett.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> ---
>  scripts/gen_initramfs_list.sh |   14 +++++++-------
>  1 files changed, 7 insertions(+), 7 deletions(-)

Applied to kbuild-2.6.git#kbuild, thanks.

Michal

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

end of thread, other threads:[~2011-05-12 14:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1304622227-18204-1-git-send-email-jamey@minilop.net>
2011-05-05 19:03 ` [PATCH] scripts/gen_initramfs_list.sh: Convert to a /bin/sh script Jamey Sharp
2011-05-12 14:59   ` Michal Marek

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

all inboxes | Powered by JetHome®