Blame 0028-dracut-functions-remove-double-slashes-for-symlink-c.patch

Harald Hoyer 428fde
From 626d9eba9c421640da5bb8f881a892a460067929 Mon Sep 17 00:00:00 2001
Harald Hoyer 428fde
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer 428fde
Date: Mon, 25 Jul 2011 14:28:55 +0200
Harald Hoyer 428fde
Subject: [PATCH] dracut-functions: remove double slashes, for symlink
Harald Hoyer 428fde
 conversion
Harald Hoyer 428fde
Harald Hoyer 428fde
remove double slashes for symlink conversion from absolute to relative
Harald Hoyer 428fde
---
Harald Hoyer 428fde
 dracut-functions |   14 +++++++++++---
Harald Hoyer 428fde
 1 files changed, 11 insertions(+), 3 deletions(-)
Harald Hoyer 428fde
Harald Hoyer 428fde
diff --git a/dracut-functions b/dracut-functions
Harald Hoyer 428fde
index a261ddd..61e10e8 100755
Harald Hoyer 428fde
--- a/dracut-functions
Harald Hoyer 428fde
+++ b/dracut-functions
Harald Hoyer 428fde
@@ -82,6 +82,13 @@ print_vars() {
Harald Hoyer 428fde
     done
Harald Hoyer 428fde
 }
Harald Hoyer 428fde
 
Harald Hoyer 428fde
+normalize_path() {
Harald Hoyer 428fde
+    p=$1
Harald Hoyer 428fde
+    while [[ ${p#*//*} != $p ]]; do
Harald Hoyer 428fde
+        p=${p/\/\///}
Harald Hoyer 428fde
+    done
Harald Hoyer 428fde
+    echo $p
Harald Hoyer 428fde
+}
Harald Hoyer 428fde
 
Harald Hoyer 428fde
 convert_abs_rel() {
Harald Hoyer 428fde
     local __current __absolute __abssize __cursize __i __level __newpath
Harald Hoyer 428fde
@@ -92,11 +99,12 @@ convert_abs_rel() {
Harald Hoyer 428fde
         echo "."
Harald Hoyer 428fde
         return
Harald Hoyer 428fde
     fi
Harald Hoyer 428fde
-
Harald Hoyer 428fde
+    __current=$(normalize_path "$1")
Harald Hoyer 428fde
+    __absolute=$(normalize_path "$2")
Harald Hoyer 428fde
     IFS="/"
Harald Hoyer 428fde
 
Harald Hoyer 428fde
-    __current=($1)
Harald Hoyer 428fde
-    __absolute=($2)
Harald Hoyer 428fde
+    __current=($__current)
Harald Hoyer 428fde
+    __absolute=($__absolute)
Harald Hoyer 428fde
 
Harald Hoyer 428fde
     __abssize=${#__absolute[@]}
Harald Hoyer 428fde
     __cursize=${#__current[@]}