Skip to content

Commit

Permalink
move ln_r() to dracut-init.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
haraldh committed May 25, 2016
1 parent d6145ec commit 1901500
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
12 changes: 0 additions & 12 deletions dracut-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <device>
# Get and the ID_FS_TYPE variable from udev for a device.
Expand Down
13 changes: 13 additions & 0 deletions dracut-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 1901500

Please sign in to comment.