Harald Hoyer b38677
From 190150018798f88107fba119e92bd32e2a8d4b0b Mon Sep 17 00:00:00 2001
Harald Hoyer b38677
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer b38677
Date: Mon, 2 May 2016 12:48:12 +0200
Harald Hoyer b38677
Subject: [PATCH] move ln_r() to dracut-init.sh
Harald Hoyer b38677
Harald Hoyer b38677
---
Harald Hoyer b38677
 dracut-functions.sh | 12 ------------
Harald Hoyer b38677
 dracut-init.sh      | 13 +++++++++++++
Harald Hoyer b38677
 2 files changed, 13 insertions(+), 12 deletions(-)
Harald Hoyer b38677
Harald Hoyer b38677
diff --git a/dracut-functions.sh b/dracut-functions.sh
Harald Hoyer b38677
index c7ea9f5..4496bfe 100755
Harald Hoyer b38677
--- a/dracut-functions.sh
Harald Hoyer b38677
+++ b/dracut-functions.sh
Harald Hoyer b38677
@@ -167,18 +167,6 @@ convert_abs_rel() {
Harald Hoyer b38677
     printf "%s\n" "$__newpath"
Harald Hoyer b38677
 }
Harald Hoyer b38677
 
Harald Hoyer b38677
-if [[ "$(ln --help)" == *--relative* ]]; then
Harald Hoyer b38677
-    ln_r() {
Harald Hoyer b38677
-        ln -sfnr "${initdir}/$1" "${initdir}/$2"
Harald Hoyer b38677
-    }
Harald Hoyer b38677
-else
Harald Hoyer b38677
-    ln_r() {
Harald Hoyer b38677
-        local _source=$1
Harald Hoyer b38677
-        local _dest=$2
Harald Hoyer b38677
-        [[ -d "${_dest%/*}" ]] && _dest=$(readlink -f "${_dest%/*}")/${_dest##*/}
Harald Hoyer b38677
-        ln -sfn -- "$(convert_abs_rel "${_dest}" "${_source}")" "${initdir}/${_dest}"
Harald Hoyer b38677
-    }
Harald Hoyer b38677
-fi
Harald Hoyer b38677
 
Harald Hoyer b38677
 # get_fs_env <device>
Harald Hoyer b38677
 # Get and the ID_FS_TYPE variable from udev for a device.
Harald Hoyer b38677
diff --git a/dracut-init.sh b/dracut-init.sh
Harald Hoyer b38677
index a195c32..d2bb845 100644
Harald Hoyer b38677
--- a/dracut-init.sh
Harald Hoyer b38677
+++ b/dracut-init.sh
Harald Hoyer b38677
@@ -997,3 +997,16 @@ instmods() {
Harald Hoyer b38677
     [[ "$optional" ]] && return 0
Harald Hoyer b38677
     return $_ret
Harald Hoyer b38677
 }
Harald Hoyer b38677
+
Harald Hoyer b38677
+if [[ "$(ln --help)" == *--relative* ]]; then
Harald Hoyer b38677
+    ln_r() {
Harald Hoyer b38677
+        ln -sfnr "${initdir}/$1" "${initdir}/$2"
Harald Hoyer b38677
+    }
Harald Hoyer b38677
+else
Harald Hoyer b38677
+    ln_r() {
Harald Hoyer b38677
+        local _source=$1
Harald Hoyer b38677
+        local _dest=$2
Harald Hoyer b38677
+        [[ -d "${_dest%/*}" ]] && _dest=$(readlink -f "${_dest%/*}")/${_dest##*/}
Harald Hoyer b38677
+        ln -sfn -- "$(convert_abs_rel "${_dest}" "${_source}")" "${initdir}/${_dest}"
Harald Hoyer b38677
+    }
Harald Hoyer b38677
+fi