dracut-functions: speed up inst_dir()

master
Harald Hoyer 2011-08-19 10:24:49 +02:00
parent bc313467bd
commit a76dc27801
1 changed files with 9 additions and 9 deletions

View File

@ -274,18 +274,18 @@ inst_dir() {
local _oldifs="$IFS" local _oldifs="$IFS"
local _part local _part
local _dir="$1" local _dir="$1"
IFS="/"
set -- $_dir # fast out
IFS=$_oldifs
_dir="$@"
[[ -e ${initdir}$_dir ]] && return 0 [[ -e ${initdir}$_dir ]] && return 0


# iterate over parent directories _part=${_dir%/*}
for _part in $_dir; do while ! [[ -e "${initdir}${_part}" ]]; do
[[ $_part ]] || continue _dir="$_part $_dir"
_file="$_file/$_part" _part=${_part%/*}
[[ -e ${initdir}$_file ]] && continue done


# iterate over parent directories
for _file in $_dir; do
if [[ -L $_file ]]; then if [[ -L $_file ]]; then
# create link as the original # create link as the original
local target=$(readlink -f "$_file") local target=$(readlink -f "$_file")