[projects/geninitrd] revert bogus commit
glen
glen at pld-linux.org
Mon Aug 15 22:45:05 CEST 2016
commit 9d45e9b492b0114bf5a536918b5ca511e8c5dcef
Author: Elan Ruusamäe <glen at delfi.ee>
Date: Mon Aug 15 23:43:06 2016 +0300
revert bogus commit
no actual change recorded, instead some formatting fuckup
Revert "save 19 lines of debug output (debugrd)"
This reverts commit 6ed0f7b1ebdba0a6aaed765e3f4c293ac09f975b.
geninitrd | 43 +++++++++++++++++++++++++++++++------------
1 file changed, 31 insertions(+), 12 deletions(-)
---
diff --git a/geninitrd b/geninitrd
index d152eec..0b838e6 100755
--- a/geninitrd
+++ b/geninitrd
@@ -937,40 +937,59 @@ initrd_gen_initramfs_switchroot() {
add_linuxrc <<-'EOF'
device=
eval "$(busybox awk -v root="$ROOT" '
- function h2d(str, hstr, res, num, n, digit, i) { # http://9fans.net/archive/2006/09/261
- hstr = "0123456789abdcef"; res = 0;
+ # http://9fans.net/archive/2006/09/261
+ function h2d(str, hstr, res, num, n, digit, i) {
+ 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;
-
- 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"
+ 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"
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/9d45e9b492b0114bf5a536918b5ca511e8c5dcef
More information about the pld-cvs-commit
mailing list