initramfs-framework: fix bashism
authorChen Qi <Qi.Chen@windriver.com>
Fri, 2 Aug 2013 07:48:47 +0000 (15:48 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 6 Aug 2013 11:39:53 +0000 (12:39 +0100)
(From OE-Core rev: e6039e6e3b98d6ab91252a5012d76279b1fac6e8)

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/initrdscripts/initramfs-framework/finish
meta/recipes-core/initrdscripts/initramfs-framework/init

index bedd803..325f47b 100755 (executable)
@@ -16,8 +16,9 @@ finish_run() {
                if [ -n "$bootparam_root" ]; then
                        debug "No e2fs compatible filesystem has been mounted, mounting $bootparam_root..."
 
-                       if [ "${bootparam_root:0:5}" = "UUID=" ]; then
-                               bootparam_root="/dev/disk/by-uuid/${bootparam_root/UUID=/}"
+                       if [ "`echo ${bootparam_root} | cut -c1-5`" = "UUID=" ]; then
+                               root_uuid=`echo $bootparam_root | cut -c6-`
+                               bootparam_root="/dev/disk/by-uuid/$root_uuid"
                        fi
 
                        if [ -e "$bootparam_root" ]; then
index 0be8f4d..20774aa 100755 (executable)
@@ -78,12 +78,13 @@ mount -t sysfs sysfs /sys
 
 # populate bootparam environment
 for p in `cat /proc/cmdline`; do
-       opt="${p%%=*}"
-       opt=${opt/-/_}
-       if [ "${p/=/}" = "$p" ]; then
+       opt=`echo $p | cut -d'=' -f1`
+       opt=`echo $opt | sed -e 's/-/_/'`
+       if [ "`echo $p | cut -d'=' -f1`" = "$p" ]; then
                eval "bootparam_${opt}=true"
        else
-               eval "bootparam_${opt}=\"${p#*=}\""
+               value="`echo $p | cut -d'=' -f2-`"
+               eval "bootparam_${opt}=\"${value}\""
        fi
 done
 
@@ -102,7 +103,7 @@ mkdir $ROOTFS_DIR
 # Load and run modules
 for m in $MODULES_DIR/*; do
        # Skip backup files
-       if [ "${m/\~/}" != "$m" ]; then
+       if [ "`echo $m | sed -e 's/\~$//'`" = "$m" ]; then
                continue
        fi
 
@@ -117,7 +118,7 @@ for m in $MODULES_DIR/*; do
        done
 
        # process module
-       source $m
+       . $m
 
        if ! eval "${module}_enabled"; then
                debug "Skipping module $module"