Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 695992ca authored by Khalid Zubair's avatar Khalid Zubair Committed by Steve Kondik
Browse files

envsetup: add function to detect shell

Add a function to detect shell, other functions can now use this to
handle shell specific behavior.

Change-Id: I4aabc0068e836c5433053b144d163fb0ed49f752
parent ebddb95a
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -2457,16 +2457,25 @@ function make()
    mk_timer $(get_make_command) "$@"
}

if [ "x$SHELL" != "x/bin/bash" ]; then
function __detect_shell() {
    case `ps -o command -p $$` in
        *bash*)
            echo bash
            ;;
        *zsh*)
            echo zsh
            ;;
        *)
            echo "WARNING: Only bash and zsh are supported, use of other shell may lead to erroneous results"
            echo unknown
            return 1
            ;;
    esac
    return
}


if ! __detect_shell > /dev/null; then
    echo "WARNING: Only bash and zsh are supported, use of other shell may lead to erroneous results"
fi

# Execute the contents of any vendorsetup.sh files we can find.