LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Oleg Verych <olecom@flower.upol.cz>
To: Rob Landley <rob@landley.net>, Andrew Morton <akpm@osdl.org>
Cc: Sam Ravnborg <sam@ravnborg.org>, LKML <linux-kernel@vger.kernel.org>
Subject: [patch, rft] scripts/gen_initramfs_list.sh: replace gawk with shell, whitespace cleanup
Date: Wed, 24 Jan 2007 22:44:34 +0000	[thread overview]
Message-ID: <E1H9qr4-0002Nu-RL@flower> (raw)
In-Reply-To: <E1H9pHf-0002Iu-4D@flower>

scripts/gen_initramfs_list.sh: replace gawk with shell, whitespace cleanup

Signed-off-by: Oleg Verych <olecom@flower.upol.cz>
---
-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 <azarah@nosferatu.za.org>
-# Copyright (c) 2006           Sam Ravnborg <sam@ravnborg.org>
+# Copyright (C) 2006 Sam Ravnborg <sam@ravnborg.org>
+# Copyright (C) 2007 Oleg Verych <olecom@flower.upol.cz>
 #
 # Released under the terms of the GNU GPL
@@ -18,13 +19,13 @@
 $0 [-o <file>] [-u <uid>] [-g <gid>] {-d | <cpio_source>} ...
 	-o <file>      Create gzipped initramfs file named <file> using
-	               gen_init_cpio and gzip
+		       gen_init_cpio and gzip
 	-u <uid>       User ID to map to user ID 0 (root).
-	               <uid> is only meaningful if <cpio_source>
-	               is a directory.
+		       <uid> is only meaningful if <cpio_source>
+		       is a directory.
 	-g <gid>       Group ID to map to group ID 0 (root).
-	               <gid> is only meaningful if <cpio_source>
-	               is a directory.
+		       <gid> is only meaningful if <cpio_source>
+		       is a directory.
 	<cpio_source>  File list or directory for cpio archive.
-	               If <cpio_source> is a .cpio file it will be used
+		       If <cpio_source> 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
 # <filetype> <name> <path to file> <octal mode> <uid> <gid>
@@ -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}"
 			;;

  reply	other threads:[~2007-01-24 22:36 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-15 21:24 [PATCH] sed s/gawk/awk/ scripts/gen_init_ramfs.sh Rob Landley
2007-01-15 22:11 ` Sam Ravnborg
2007-01-24  0:49   ` Andrew Morton
2007-01-24 17:30     ` Rob Landley
2007-01-24 21:03       ` [rft] (g)awk substitution (Re: [PATCH] sed s/gawk/awk/scripts/gen_init_ramfs.sh) Oleg Verych
2007-01-24 22:44         ` Oleg Verych [this message]
2007-01-24 23:30         ` [patch, rft] scripts/makelst: replace gawk with shell, update Oleg Verych
2007-01-25  1:51         ` [rft] (g)awk substitution (Re: [PATCH] sed s/gawk/awk/scripts/gen_init_ramfs.sh) Rob Landley
2007-01-25  9:40           ` sed _s_gnu_alternatives_ (Re: [rft] (g)awk substitution) Oleg Verych
2007-01-25 18:03             ` Rob Landley
2007-01-25 19:14               ` Oleg Verych
2007-01-25 19:38                 ` Rob Landley
2007-01-25 21:18                   ` Oleg Verych
2007-01-26 17:47                     ` Rob Landley
2007-01-26 20:14                       ` Oleg Verych
2007-01-27  0:18                         ` Tim Schmielau
2007-01-27  6:38                           ` scripts/makelst: bc -> shell " Oleg Verych
2007-02-03 11:24                             ` David Weinehall
2007-02-03 13:10                               ` Oleg Verych
2007-02-03 11:13                 ` David Weinehall
2007-02-02 16:36     ` [PATCH] sed s/gawk/awk/ scripts/gen_init_ramfs.sh Adrian Bunk
2007-02-02 21:01       ` Oleg Verych

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1H9qr4-0002Nu-RL@flower \
    --to=olecom@flower.upol.cz \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rob@landley.net \
    --cc=sam@ravnborg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).