summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonas Gorski2023-08-23 07:47:57 +0000
committerJonas Gorski2023-08-26 12:00:36 +0000
commit3210aa8e0a113cc4354628b08b608c5c8f792941 (patch)
tree8c10c0722b198b79e30f798a35fa0d614c163535
parentc1ef10c8d873254ce7c1f3019d821c4a87227474 (diff)
prereq: merge common cases in SetupHostCommand
Now that most cases do the same thing in SetupHostCommand, merge them together into one. To allow moving the generic symlink check, invert the check and let it check for relative links by matching on link targets that do not start with a slash. This then allows us to also drop the absolute link case, shortening the case statement further. This reorders the check to * if it is not a symlink, do not change it * if it is a symlink and it points to the found command, do not change it * if it is a symlink with a relative path, do not change it * else, update/replace it Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
-rw-r--r--include/prereq.mk12
1 files changed, 3 insertions, 9 deletions
diff --git a/include/prereq.mk b/include/prereq.mk
index a4a07c223f..1039c5540c 100644
--- a/include/prereq.mk
+++ b/include/prereq.mk
@@ -107,15 +107,9 @@ define SetupHostCommand
bin="$$$$$$$$(command -v "$$$$$$$${cmd%% *}")"; \
if [ -x "$$$$$$$$bin" ] && eval "$$$$$$$$cmd" >/dev/null 2>/dev/null; then \
case "$$$$$$$$(ls -dl -- $(STAGING_DIR_HOST)/bin/$(strip $(1)))" in \
- *" -> $$$$$$$$bin"*) \
- [ -x "$(STAGING_DIR_HOST)/bin/$(strip $(1))" ] && exit 0 \
- ;; \
- "-"*) \
- [ -x "$(STAGING_DIR_HOST)/bin/$(strip $(1))" ] && exit 0 \
- ;; \
- *" -> /"*) \
- ;; \
- *" -> "*) \
+ "-"* | \
+ *" -> $$$$$$$$bin"* | \
+ *" -> "[!/]*) \
[ -x "$(STAGING_DIR_HOST)/bin/$(strip $(1))" ] && exit 0 \
;; \
esac; \