From e7da9734d892ace96b4717fd622f5b9be9149227 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Amadeusz=20=C5=BBo=C5=82nowski?= Date: Mon, 26 Mar 2012 09:39:34 +0200 Subject: [PATCH] inst_symlink: create parent dir if doesn't exist If symlink is yet alone in target directory, inst_symlink will fail to create it. This is how to reproduce the bug: # mkdir /tmp/test # ln -s /bin/cp /tmp/test/cp # ./dracut -l -f -H /tmp/test.img -I /tmp/test/cp Result: [...] I: *** Including modules done *** ln: failed to create symbolic link `/var/tmp/initramfs.Z5isVu//tmp/test/cp': No such file or directory ln: failed to create symbolic link `/var/tmp/initramfs.Z5isVu//tmp/test/cp': No such file or directory I: Wrote /tmp/test.img: [...] Following patch creates directory for the symlink if it doesn't exist. --- dracut-functions.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/dracut-functions.sh b/dracut-functions.sh index f4ccf53a..80824667 100755 --- a/dracut-functions.sh +++ b/dracut-functions.sh @@ -545,6 +545,7 @@ inst_symlink() { inst "$_realsrc" fi fi + [[ ! -e $initdir/${_target%/*} ]] && inst_dir "${_target%/*}" [[ -d ${_target%/*} ]] && _target=$(readlink -f ${_target%/*})/${_target##*/} ln -sfn $(convert_abs_rel "${_target}" "${_realsrc}") "$initdir/$_target" } -- 2.11.4.GIT