Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752091AbXAXWgq (ORCPT ); Wed, 24 Jan 2007 17:36:46 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752090AbXAXWgq (ORCPT ); Wed, 24 Jan 2007 17:36:46 -0500 Received: from raven.upol.cz ([158.194.120.4]:43878 "EHLO raven.upol.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932835AbXAXWgn (ORCPT ); Wed, 24 Jan 2007 17:36:43 -0500 To: Rob Landley , Andrew Morton Cc: Sam Ravnborg , LKML Subject: [patch, rft] scripts/gen_initramfs_list.sh: replace gawk with shell, whitespace cleanup In-Reply-To: References: <200701151624.18033.rob@landley.net> <20070115221146.GA12698@uranus.ravnborg.org> <20070123164944.db8acbad.akpm@osdl.org> <200701241230.40996.rob@landley.net> Organization: Palacky University in Olomouc, experimental physics department. Date: Wed, 24 Jan 2007 22:44:34 +0000 Message-Id: From: Oleg Verych Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2694 Lines: 76 scripts/gen_initramfs_list.sh: replace gawk with shell, whitespace cleanup Signed-off-by: Oleg Verych --- -o--=O`C #oo'L O <___=E M --- linux~2.6.20-rc5/scripts/gen_initramfs_list.sh~ 2007-01-12 19:54:26.000000000 +0100 +++ linux~2.6.20-rc5/scripts/gen_initramfs_list.sh 2007-01-24 22:54:49.721441250 +0100 @@ -1,5 +1,6 @@ #!/bin/bash # Copyright (C) Martin Schlemmer -# Copyright (c) 2006 Sam Ravnborg +# Copyright (C) 2006 Sam Ravnborg +# Copyright (C) 2007 Oleg Verych # # Released under the terms of the GNU GPL @@ -18,13 +19,13 @@ $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. @@ -95,4 +96,11 @@ } +# accessing fields, as in `awk' +# $1 - field number; rest is argument string +pos_param() { + shift $1 + echo $1 +} + # for each file print a line in following format # @@ -120,9 +128,7 @@ ;; "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}') + maj=`pos_param 5 $(LC_ALL=C ls -l "${location}")` + min=`pos_param 6 $(LC_ALL=C ls -l "${location}")` + maj=${maj%,} if [ -b "${location}" ]; then @@ -134,6 +140,5 @@ ;; "slink") - local target=$(LC_ALL=C ls -l "${location}" | \ - gawk '{print $11}') + target=`pos_param 11 $(LC_ALL=C ls -l "${location}")` str="${ftype} ${name} ${target} ${str}" ;; - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/