]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Allow $DRACUT_INSTALL to be not an absolute path
authorMikhail Novosyolov <m.novosyolov@rosalinux.ru>
Fri, 27 Mar 2020 13:16:07 +0000 (16:16 +0300)
committerDaniel Molkentin <daniel@molkentin.de>
Wed, 5 Aug 2020 15:46:30 +0000 (17:46 +0200)
/usr/sbin/dracut-install is a symlink:
$ file /usr/sbin/dracut-install
/usr/sbin/dracut-install: symbolic link to ../lib/dracut/dracut-install

It resulted to "dracut-install not found" error:

+++ for p in $DRACUT_PATH
+++ [[ -L /sbin/dracut-install ]]
+++ [[ -x /sbin/dracut-install ]]
+++ for p in $DRACUT_PATH
+++ [[ -L /bin/dracut-install ]]
+++ [[ -x /bin/dracut-install ]]
+++ for p in $DRACUT_PATH
+++ [[ -L /usr/sbin/dracut-install ]]
+++ printf '%s\n' dracut-install
+++ return 0
++ DRACUT_INSTALL=dracut-install
++ [[ -n dracut-install ]]
++ [[ -n dracut-install ]]
++ DRINSTALLPARTS=0
++ for i in $DRACUT_INSTALL
++ DRINSTALLPARTS=1
++ [[ 1 = 1 ]]
++ [[ -x dracut-install ]]
++ dfatal 'dracut-install not found!'
++ set +x
dracut: dracut-install not found!

[ -x <not a path to file> ] is not correct and will always be false.
But actually it is available. Let's just allow it to be not an absolute path.
Maybe some other places can be improved to avoid DRACUT_INSTALL being not an absolute path.

Signed-off-by: Mikhail Novosyolov <m.novosyolov@rosalinux.ru>
dracut-init.sh

index a8348b79291fce9a8dd1a0371b7f287834d0ee87..837267aa8d691e05918bac1d609522bc180484e8 100644 (file)
@@ -183,7 +183,7 @@ for i in $DRACUT_INSTALL ; do
     DRINSTALLPARTS=$(($DRINSTALLPARTS+1))
 done
 
-if [[ $DRINSTALLPARTS = 1 ]] && ! [[ -x $DRACUT_INSTALL ]]; then
+if [[ $DRINSTALLPARTS = 1 ]] && ! command -v "$DRACUT_INSTALL" > /dev/null 2>&1 ; then
     dfatal "dracut-install not found!"
     exit 10
 fi