aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJamey Sharp <jamey@minilop.net>2011-05-05 15:03:47 -0400
committerMichal Marek <mmarek@suse.cz>2011-05-12 10:48:39 -0400
commit153f01147065cb3628493dcb79417bc4474320c7 (patch)
treecf5d3352b915da7c2a0274a23b61c9e7ffbe4191 /scripts
parent43f67c98161c65f1b2e3af3a9ce6741850072c06 (diff)
scripts/gen_initramfs_list.sh: Convert to a /bin/sh script
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> Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/gen_initramfs_list.sh14
1 files changed, 7 insertions, 7 deletions
diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh
index d44cf675bc22..8da7890310d6 100644
--- a/scripts/gen_initramfs_list.sh
+++ b/scripts/gen_initramfs_list.sh
@@ -1,4 +1,4 @@
1#!/bin/bash 1#!/bin/sh
2# Copyright (C) Martin Schlemmer <azarah@nosferatu.za.org> 2# Copyright (C) Martin Schlemmer <azarah@nosferatu.za.org>
3# Copyright (C) 2006 Sam Ravnborg <sam@ravnborg.org> 3# Copyright (C) 2006 Sam Ravnborg <sam@ravnborg.org>
4# 4#
@@ -105,9 +105,9 @@ list_parse() {
105# for links, devices etc the format differs. See gen_init_cpio for details 105# for links, devices etc the format differs. See gen_init_cpio for details
106parse() { 106parse() {
107 local location="$1" 107 local location="$1"
108 local name="${location/${srcdir}//}" 108 local name="/${location#${srcdir}}"
109 # change '//' into '/' 109 # change '//' into '/'
110 name="${name//\/\///}" 110 name=$(echo "$name" | sed -e 's://*:/:g')
111 local mode="$2" 111 local mode="$2"
112 local uid="$3" 112 local uid="$3"
113 local gid="$4" 113 local gid="$4"
@@ -117,8 +117,8 @@ parse() {
117 [ "$root_gid" = "squash" ] && gid=0 || [ "$gid" -eq "$root_gid" ] && gid=0 117 [ "$root_gid" = "squash" ] && gid=0 || [ "$gid" -eq "$root_gid" ] && gid=0
118 local str="${mode} ${uid} ${gid}" 118 local str="${mode} ${uid} ${gid}"
119 119
120 [ "${ftype}" == "invalid" ] && return 0 120 [ "${ftype}" = "invalid" ] && return 0
121 [ "${location}" == "${srcdir}" ] && return 0 121 [ "${location}" = "${srcdir}" ] && return 0
122 122
123 case "${ftype}" in 123 case "${ftype}" in
124 "file") 124 "file")
@@ -192,7 +192,7 @@ input_file() {
192 if [ -f "$1" ]; then 192 if [ -f "$1" ]; then
193 ${dep_list}header "$1" 193 ${dep_list}header "$1"
194 is_cpio="$(echo "$1" | sed 's/^.*\.cpio\(\..*\)\?/cpio/')" 194 is_cpio="$(echo "$1" | sed 's/^.*\.cpio\(\..*\)\?/cpio/')"
195 if [ $2 -eq 0 -a ${is_cpio} == "cpio" ]; then 195 if [ $2 -eq 0 -a ${is_cpio} = "cpio" ]; then
196 cpio_file=$1 196 cpio_file=$1
197 echo "$1" | grep -q '^.*\.cpio\..*' && is_cpio_compressed="compressed" 197 echo "$1" | grep -q '^.*\.cpio\..*' && is_cpio_compressed="compressed"
198 [ ! -z ${dep_list} ] && echo "$1" 198 [ ! -z ${dep_list} ] && echo "$1"
@@ -204,7 +204,7 @@ input_file() {
204 else 204 else
205 echo "$1 \\" 205 echo "$1 \\"
206 cat "$1" | while read type dir file perm ; do 206 cat "$1" | while read type dir file perm ; do
207 if [ "$type" == "file" ]; then 207 if [ "$type" = "file" ]; then
208 echo "$file \\"; 208 echo "$file \\";
209 fi 209 fi
210 done 210 done