Skip to content

Commit 3f22c09

Browse files
committed
fix(base): support readlink applet from busybox
busybox's `readlink` applet does not support the option `-e` option. Replace these `readlink` calls by `realpath`. Since `realpath` will return successfully on non-existing path, check the path exists if needed. Part of: #2437
1 parent 725caac commit 3f22c09

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

modules.d/80base/dracut-lib.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ udevproperty() {
497497

498498
find_mount() {
499499
local dev wanted_dev
500-
wanted_dev="$(readlink -e -q "$1")"
500+
wanted_dev="$(realpath "$1")"
501501
while read -r dev _ || [ -n "$dev" ]; do
502502
[ "$dev" = "$wanted_dev" ] && echo "$dev" && return 0
503503
done < /proc/mounts
@@ -628,7 +628,7 @@ copytree() {
628628
local src="$1" dest="$2"
629629
[ -d "$src" ] || return 1
630630
mkdir -p "$dest" || return 1
631-
dest=$(readlink -e -q "$dest") || return 1
631+
dest=$(realpath "$dest") || return 1
632632
(
633633
cd "$src" || exit 1
634634
cp -af . -t "$dest"
@@ -710,8 +710,9 @@ devnames() {
710710
esac
711711

712712
for d in $dev; do
713+
[ -e "$d" ] || return 255
713714
names="$names
714-
$(readlink -e -q "$d")" || return 255
715+
$(realpath "$d")"
715716
done
716717

717718
echo "${names#

0 commit comments

Comments
 (0)