diff --git a/scripts/activate.sh b/scripts/activate.sh index 811f98351762f4..4c82647ca87d0a 100644 --- a/scripts/activate.sh +++ b/scripts/activate.sh @@ -13,9 +13,12 @@ # See the License for the specific language governing permissions and # limitations under the License. # - -if [[ ! -d "${CHIP_ROOT}" ]]; then - CHIP_ROOT=$(cd "$(dirname "$0")/.." && pwd) +if [[ ! -d ${CHIP_ROOT} ]]; then + if [[ -n ${BASH_SOURCE[0]} ]]; then + CHIP_ROOT=$(cd "${BASH_SOURCE[0]%/*}/.." && pwd) + else + CHIP_ROOT=$(cd "${0%/*}/.." && pwd) + fi fi export PW_BRANDING_BANNER="$CHIP_ROOT/.chip-banner.txt" diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index c26a06d5f303df..6fa79dde5b8d07 100644 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -14,7 +14,13 @@ # limitations under the License. # -CHIP_ROOT=$(cd "$(dirname "$0")/.." && pwd) +if [[ ! -d ${CHIP_ROOT} ]]; then + if [[ -n ${BASH_SOURCE[0]} ]]; then + CHIP_ROOT=$(cd "${BASH_SOURCE[0]%/*}/.." && pwd) + else + CHIP_ROOT=$(cd "${0%/*}/.." && pwd) + fi +fi export PW_BRANDING_BANNER="$CHIP_ROOT/.chip-banner.txt" export PW_BRANDING_BANNER_COLOR="bold_white"