Blob Blame History Raw
From b01885338bb0b3daa087f71cfbf895e999e90b9f Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 20 Oct 2011 13:04:30 +0200
Subject: [PATCH] dracut-functions: inst_dir() handle relative symlinks

---
 dracut-functions |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/dracut-functions b/dracut-functions
index 1ef5269..70a467b 100755
--- a/dracut-functions
+++ b/dracut-functions
@@ -290,12 +290,12 @@ inst_dir() {
             inst_dir "$target"
             inst_symlink "$_file"
         else
-            [[ -h ${initdir}$_file ]] && _file=$(readlink "${initdir}$_file")
+            [[ -h ${initdir}/$_file ]] && _file=$(readlink "${initdir}/$_file")
             # create directory
-            mkdir -m 0755 -p "${initdir}$_file" || return 1
+            [[ -e "${initdir}/$_file" ]] || mkdir -m 0755 -p "${initdir}/$_file" || return 1
             if [[ -d "$_file" ]]; then
-                chmod --reference="$_file" "${initdir}$_file"
-                chmod u+w "${initdir}$_file"
+                chmod --reference="$_file" "${initdir}/$_file"
+                chmod u+w "${initdir}/$_file"
             fi
         fi
     done