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

Commit bbcb5c26 authored by Khalid Zubair's avatar Khalid Zubair Committed by Sam Mortimer
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 b9b8cd50
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -1651,16 +1651,24 @@ function provision()
    "$ANDROID_PRODUCT_OUT/provision-device" "$@"
}

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.