#!/bin/bash
source utils.sh

show_warning=0

if [ -z "$NDK_PATH" ]; then
    print_info "[VaultKeeper Nwd]"
    print_info "You cannot build vaultkeeper nwd binaries."
    print_info "You should set NDK_PATH in your .bashrc"
    print_info "Ex) export NDK_PATH=/home/ubisun/android/android-ndk-r12b"
    echo ""
    show_warning=1
fi

if [ -z "$P4_SECURITY_DEV_PATH" ]; then
    print_info "[VaultKeeper Swd Qsee]"
    print_info "You cannot build vaultkeeper Qsee TA."
    print_info "You should set P4_SECURITY_DEV_PATH in your .bashrc"
    print_info "Ex) export P4_SECURITY_DEV_PATH=/home/ubisun/hdd/merge/DEV/Solution/SecurityDev"
    print_info ""
    print_info "Also, You should download nhlos folder entirely to build normally"
    print_info "and you should do precondition. Please refer swd/build_QSEE.sh"
    echo ""
    show_warning=1
fi

if [ -z "$MOBICORE_TOOLCHAIN_PATH" ]; then
    print_info "[VaultKeeper Swd Mobicore]"
    print_info "You cannot build vaultkeeper Mobicore TA."
    print_info "You should set MOBICORE_TOOLCHAIN_PATH in your .bashrc"
    print_info "Ex) export P4_SECURITY_DEV_PATH=/home/ubisun/hdd/merge/DEV/Solution/SecurityDev"
    print_info "    export MOBICORE_TOOLCHAIN_PATH=$P4_SECURITY_DEV_PATH/SubTG/DPKM/SDK/android-security-exynos/tbase"
    echo ""
    print_info "[VaultKeeper Integration into Perforce]"
    print_info "You can push binary into device, but cannot copy to target files in Perforce"
    show_warning=1
fi

if [ -z "$P4_ID" -o -z "$P4_1716_MERGE_WORKSPACE" ]; then
    print_info "[VaultKeeper Integration into Perforce]"
    print_info "You can push binary into device, but cannot copy to target files in Perforce"
    print_info "You should set below environmen in your .bashrc"
    print_info "Ex) export P4_ID=jsm.yoo"
    print_info "    export P4_1716_MERGE_WORKSPACE=SECURITY_DPKM_jsm.yoo_HDD_MERGE"
    show_warning=1
fi

if [ $show_warning == '1' ]; then
    print_warning "Press Enter to continue..."
    read -p ""
fi

## Vaultkeeper Environment (Auto generated) #################
## Do not modify below variables
export PATH=$PATH:$(pwd):$NDK_PATH
export P4_ROOT_PATH=$P4_SECURITY_DEV_PATH/../../..
export P4_NILE_PATH=$P4_SECURITY_DEV_PATH/../../../NILE
export P4_OHIO_PATH=$P4_SECURITY_DEV_PATH/../../../OHIO
export P4_TESTBED_PATH=$P4_SECURITY_DEV3_PATH/DataProtection/VaultKeeper/testbed/VaultKeeper
export P4_NILEMM_PATH=$P4_SECURITY_DEV_PATH/../.P4_SECURITY_DEV_PATH./../TASK/201606/NILE_MM
