1
0
mirror of https://gitlab.alpinelinux.org/alpine/cloud/tiny-cloud.git synced 2025-12-15 11:22:43 +03:00

Fix function detecion

Different shells has slightly different output of `type`:

    $ yash -c "f(){ :; }; type f"
    f: a function

    $ dash -c "f(){ :; }; type f"
    f is a shell function

    $ zsh -c "f(){ :; }; type f"
    f is a shell function from zsh

Lets only look for the word "function" which seems to be the only common
thing.
This commit is contained in:
Natanael Copa 2023-03-09 17:16:02 +01:00
parent e9b4350617
commit 33257650c8

View File

@ -32,7 +32,7 @@ install_hotplugs() {
for module in $HOTPLUG_MODULES; do
result='-'
printf " $module"
if type "mod__$module" | grep -q "is a function"; then
if type "mod__$module" | grep -q -w "function"; then
"mod__$module" && result='+' || { result='!'; rc=1; }
fi
printf "($result)"