[projects/geninitrd] Revert "revert bogus commit"

gotar gotar at pld-linux.org
Mon Aug 29 19:42:26 CEST 2016


commit 512f35991fc4b3f9c12469094f6c52c56e0309dd
Author: Tomasz Pala <gotar at pld-linux.org>
Date:   Mon Aug 29 19:31:57 2016 +0200

    Revert "revert bogus commit"
    
    This 'formatting fuckup' was the point for saving scrollback buffer.
    As you probably don't put it together, issuing debuginitrd throws all that function
    contents to your face during boot.
    
    This reverts commit 9d45e9b492b0114bf5a536918b5ca511e8c5dcef.

 geninitrd | 43 ++++++++++++-------------------------------
 1 file changed, 12 insertions(+), 31 deletions(-)
---
diff --git a/geninitrd b/geninitrd
index 0b838e6..d152eec 100755
--- a/geninitrd
+++ b/geninitrd
@@ -937,59 +937,40 @@ initrd_gen_initramfs_switchroot() {
 	add_linuxrc <<-'EOF'
 		device=
 		eval "$(busybox awk -v root="$ROOT" '
-			# http://9fans.net/archive/2006/09/261
-			function h2d(str, hstr, res, num, n, digit, i) {
-				hstr = "0123456789abdcef";
-				res = 0;
+			function h2d(str, hstr, res, num, n, digit, i) {	# http://9fans.net/archive/2006/09/261
+				hstr = "0123456789abdcef"; res = 0;
 				n = split(tolower(str), digit, "");
 
 				for (i = 1; i <= n; i++) {
 					num = index(hstr, digit[i]) - 1;
 					res = res + (num * 16 ^ (n - i));
 				}
-
 				return res;
 			}
 			BEGIN {
-
 				num_pattern_short = "[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]";
 				num_pattern = "[0-9a-fA-F]" num_pattern_short;
 				dev_pattern = "[hms][a-z][a-z]([0-9])+";
-				partition = "";
-				min = -1; maj = -1;
-
-				# see if we have /dev/hdX or hdX, we can just take partition name
-				if (root ~ "^\/dev\/" dev_pattern "$" || root ~ "^" dev_pattern "$") {
-					partition = root
-					sub("^/dev/", "", partition);
-
-				} else {
-					# unify values first
-					if (root ~ "^" num_pattern_short "$")  {
-						# change "303" => "0x0303"
+				partition = ""; min = -1; maj = -1;
+
+				if (root ~ "^\/dev\/" dev_pattern "$" || root ~ "^" dev_pattern "$") {	# see if we have /dev/hdX or hdX, we can just take partition name
+					partition = root; sub("^/dev/", "", partition);
+				} else {	# unify values first
+					if (root ~ "^" num_pattern_short "$")  {	# change "303" => "0x0303"
 						root = "0x0" root
-					} else if (root ~ "^" num_pattern "$")  {
-						# change "0303" => "0x0303"
+					} else if (root ~ "^" num_pattern "$")  {	# change "0303" => "0x0303"
 						root = "0x" root
 					}
-
 					maj = h2d(substr(root, 3, 2));
 					min = h2d(substr(root, 5, 2));
 				}
 			}
-
 			partition && $4 == partition { maj = $1; min = $2; }
 			$1 == maj && $2 == min { partition = $4; }
-
 			END {
-				if (maj >= 0 && min >= 0) {
-					printf("maj=%s; min=%s;\n", maj, min);
-				}
-				if (partition) {
-					printf("device=/dev/%s;\n", partition);
-				}
-			}
-			' /proc/partitions)"
+				if (maj >= 0 && min >= 0) {	printf("maj=%s; min=%s;\n", maj, min);	}
+				if (partition) {		printf("device=/dev/%s;\n", partition);	}
+			}' /proc/partitions)"
 
 		if [ -z "$device" ]; then
 			if [ "$DEBUGINITRD" -a "$DEBUGINITRD" != 'sh' ]; then
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/geninitrd.git/commitdiff/512f35991fc4b3f9c12469094f6c52c56e0309dd



More information about the pld-cvs-commit mailing list