dracut/0009-dracut-functions-speed-up-inst_dir.patch
2011-10-19 15:30:00 +02:00

42 lines
1.1 KiB
Diff

From a76dc2780143a4b04eb33a6699ec2ca7a7898b65 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Fri, 19 Aug 2011 10:24:49 +0200
Subject: [PATCH] dracut-functions: speed up inst_dir()
---
dracut-functions | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/dracut-functions b/dracut-functions
index 241d89a..d7f2e5f 100755
--- a/dracut-functions
+++ b/dracut-functions
@@ -274,18 +274,18 @@ inst_dir() {
local _oldifs="$IFS"
local _part
local _dir="$1"
- IFS="/"
- set -- $_dir
- IFS=$_oldifs
- _dir="$@"
+
+ # fast out
[[ -e ${initdir}$_dir ]] && return 0
- # iterate over parent directories
- for _part in $_dir; do
- [[ $_part ]] || continue
- _file="$_file/$_part"
- [[ -e ${initdir}$_file ]] && continue
+ _part=${_dir%/*}
+ while ! [[ -e "${initdir}${_part}" ]]; do
+ _dir="$_part $_dir"
+ _part=${_part%/*}
+ done
+ # iterate over parent directories
+ for _file in $_dir; do
if [[ -L $_file ]]; then
# create link as the original
local target=$(readlink -f "$_file")