|
Harald Hoyer |
5414ff |
From a20d24ded292bfcf96f4fdab78ec20b92a07bbf1 Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
5414ff |
From: Harald Hoyer <harald@redhat.com>
|
|
Harald Hoyer |
5414ff |
Date: Thu, 21 Jun 2012 01:57:11 +0200
|
|
Harald Hoyer |
5414ff |
Subject: [PATCH] dracut-functions.sh: use "ln -r" instead of shell functions
|
|
Harald Hoyer |
5414ff |
|
|
Harald Hoyer |
5414ff |
---
|
|
Harald Hoyer |
5414ff |
dracut-functions.sh | 20 ++++++++++++++++----
|
|
Harald Hoyer |
5414ff |
1 file changed, 16 insertions(+), 4 deletions(-)
|
|
Harald Hoyer |
5414ff |
|
|
Harald Hoyer |
5414ff |
diff --git a/dracut-functions.sh b/dracut-functions.sh
|
|
Harald Hoyer |
5414ff |
index 1137919..d4a766b 100755
|
|
Harald Hoyer |
5414ff |
--- a/dracut-functions.sh
|
|
Harald Hoyer |
5414ff |
+++ b/dracut-functions.sh
|
|
Harald Hoyer |
5414ff |
@@ -188,6 +188,19 @@ convert_abs_rel() {
|
|
Harald Hoyer |
5414ff |
echo "$__newpath"
|
|
Harald Hoyer |
5414ff |
}
|
|
Harald Hoyer |
5414ff |
|
|
Harald Hoyer |
5414ff |
+if strstr "$(ln --help)" "relative"; then
|
|
Harald Hoyer |
5414ff |
+ ln_r() {
|
|
Harald Hoyer |
5414ff |
+ ln -sfnr "${initdir}/$1" "${initdir}/$2"
|
|
Harald Hoyer |
5414ff |
+ }
|
|
Harald Hoyer |
5414ff |
+else
|
|
Harald Hoyer |
5414ff |
+ ln_r() {
|
|
Harald Hoyer |
5414ff |
+ local _source=$1
|
|
Harald Hoyer |
5414ff |
+ local _dest=$2
|
|
Harald Hoyer |
5414ff |
+ [[ -d "${_dest%/*}" ]] && _dest=$(readlink -f "${_dest%/*}")/${_dest##*/}
|
|
Harald Hoyer |
5414ff |
+ ln -sfn $(convert_abs_rel "${_dest}" "${_source}") "${initdir}/${_dest}"
|
|
Harald Hoyer |
5414ff |
+ }
|
|
Harald Hoyer |
5414ff |
+fi
|
|
Harald Hoyer |
5414ff |
+
|
|
Harald Hoyer |
5414ff |
# get_fs_env <device>
|
|
Harald Hoyer |
5414ff |
# Get and set the ID_FS_TYPE and ID_FS_UUID variable from udev for a device.
|
|
Harald Hoyer |
5414ff |
# Example:
|
|
Harald Hoyer |
5414ff |
@@ -465,8 +478,7 @@ inst_library() {
|
|
Harald Hoyer |
5414ff |
_reallib=$(readlink -f "$_src")
|
|
Harald Hoyer |
5414ff |
inst_simple "$_reallib" "$_reallib"
|
|
Harald Hoyer |
5414ff |
inst_dir "${_dest%/*}"
|
|
Harald Hoyer |
5414ff |
- [[ -d "${_dest%/*}" ]] && _dest=$(readlink -f "${_dest%/*}")/${_dest##*/}
|
|
Harald Hoyer |
5414ff |
- ln -sfn $(convert_abs_rel "${_dest}" "${_reallib}") "${initdir}/${_dest}"
|
|
Harald Hoyer |
5414ff |
+ ln_r "${_reallib}" "${_dest}"
|
|
Harald Hoyer |
5414ff |
else
|
|
Harald Hoyer |
5414ff |
inst_simple "$_src" "$_dest"
|
|
Harald Hoyer |
5414ff |
fi
|
|
Harald Hoyer |
5414ff |
@@ -555,8 +567,8 @@ inst_symlink() {
|
|
Harald Hoyer |
5414ff |
fi
|
|
Harald Hoyer |
5414ff |
fi
|
|
Harald Hoyer |
5414ff |
[[ ! -e $initdir/${_target%/*} ]] && inst_dir "${_target%/*}"
|
|
Harald Hoyer |
5414ff |
- [[ -d ${_target%/*} ]] && _target=$(readlink -f ${_target%/*})/${_target##*/}
|
|
Harald Hoyer |
5414ff |
- ln -sfn $(convert_abs_rel "${_target}" "${_realsrc}") "$initdir/$_target"
|
|
Harald Hoyer |
5414ff |
+
|
|
Harald Hoyer |
5414ff |
+ ln_r "${_realsrc}" "${_target}"
|
|
Harald Hoyer |
5414ff |
}
|
|
Harald Hoyer |
5414ff |
|
|
Harald Hoyer |
5414ff |
# attempt to install any programs specified in a udev rule
|