From: Harald Hoyer Date: Mon, 2 May 2016 10:48:12 +0000 (+0200) Subject: move ln_r() to dracut-init.sh X-Git-Tag: 045~157 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=190150018798f88107fba119e92bd32e2a8d4b0b;p=thirdparty%2Fdracut.git move ln_r() to dracut-init.sh --- diff --git a/dracut-functions.sh b/dracut-functions.sh index c7ea9f580..4496bfe6c 100755 --- a/dracut-functions.sh +++ b/dracut-functions.sh @@ -167,18 +167,6 @@ convert_abs_rel() { printf "%s\n" "$__newpath" } -if [[ "$(ln --help)" == *--relative* ]]; then - ln_r() { - ln -sfnr "${initdir}/$1" "${initdir}/$2" - } -else - ln_r() { - local _source=$1 - local _dest=$2 - [[ -d "${_dest%/*}" ]] && _dest=$(readlink -f "${_dest%/*}")/${_dest##*/} - ln -sfn -- "$(convert_abs_rel "${_dest}" "${_source}")" "${initdir}/${_dest}" - } -fi # get_fs_env # Get and the ID_FS_TYPE variable from udev for a device. diff --git a/dracut-init.sh b/dracut-init.sh index a195c32b5..d2bb84570 100644 --- a/dracut-init.sh +++ b/dracut-init.sh @@ -997,3 +997,16 @@ instmods() { [[ "$optional" ]] && return 0 return $_ret } + +if [[ "$(ln --help)" == *--relative* ]]; then + ln_r() { + ln -sfnr "${initdir}/$1" "${initdir}/$2" + } +else + ln_r() { + local _source=$1 + local _dest=$2 + [[ -d "${_dest%/*}" ]] && _dest=$(readlink -f "${_dest%/*}")/${_dest##*/} + ln -sfn -- "$(convert_abs_rel "${_dest}" "${_source}")" "${initdir}/${_dest}" + } +fi