[patch, rft] scripts/gen_initramfs_list.sh: replace gawk with shell, whitespace cleanup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Oleg Verych <[email protected]>
---
-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 <[email protected]>
-# Copyright (c) 2006           Sam Ravnborg <[email protected]>
+# Copyright (C) 2006 Sam Ravnborg <[email protected]>
+# Copyright (C) 2007 Oleg Verych <[email protected]>
 #
 # 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}"
 			;;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux