X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=scripts%2Fgen_initramfs_list.sh;h=43f75d6e4d9629a963806d6b4108d2dbd7164d01;hb=cbe56159a3e60624b5f44cf48b640fa470436e34;hp=4c723fd18648daba8926e8b73e727b45c90fc1d9;hpb=c4366889dda8110247be59ca41fddb82951a8c26;p=pandora-kernel.git diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh index 4c723fd18648..43f75d6e4d96 100644 --- a/scripts/gen_initramfs_list.sh +++ b/scripts/gen_initramfs_list.sh @@ -1,6 +1,6 @@ #!/bin/bash # Copyright (C) Martin Schlemmer -# Copyright (c) 2006 Sam Ravnborg +# Copyright (C) 2006 Sam Ravnborg # # Released under the terms of the GNU GPL # @@ -17,15 +17,15 @@ cat << EOF Usage: $0 [-o ] [-u ] [-g ] {-d | } ... -o Create gzipped initramfs file named using - gen_init_cpio and gzip + gen_init_cpio and gzip -u User ID to map to user ID 0 (root). - is only meaningful if - is a directory. + is only meaningful if + is a directory. -g Group ID to map to group ID 0 (root). - is only meaningful if - is a directory. + is only meaningful if + is a directory. File list or directory for cpio archive. - If is a .cpio file it will be used + If is a .cpio file it will be used as direct input to initramfs. -d Output the default cpio list. @@ -36,6 +36,12 @@ to reset the root/group mapping. EOF } +# awk style field access +# $1 - field number; rest is argument string +field() { + shift $1 ; echo $1 +} + list_default_initramfs() { # echo usr/kinit/kinit : @@ -119,22 +125,17 @@ parse() { str="${ftype} ${name} ${location} ${str}" ;; "nod") - local dev_type= - local maj=$(LC_ALL=C ls -l "${location}" | \ - gawk '{sub(/,/, "", $5); print $5}') - local min=$(LC_ALL=C ls -l "${location}" | \ - gawk '{print $6}') - - if [ -b "${location}" ]; then - dev_type="b" - else - dev_type="c" - fi - str="${ftype} ${name} ${str} ${dev_type} ${maj} ${min}" + local dev=`LC_ALL=C ls -l "${location}"` + local maj=`field 5 ${dev}` + local min=`field 6 ${dev}` + maj=${maj%,} + + [ -b "${location}" ] && dev="b" || dev="c" + + str="${ftype} ${name} ${str} ${dev} ${maj} ${min}" ;; "slink") - local target=$(LC_ALL=C ls -l "${location}" | \ - gawk '{print $11}') + local target=`field 11 $(LC_ALL=C ls -l "${location}")` str="${ftype} ${name} ${target} ${str}" ;; *)