CB-5909 Fixed issue where check-reqs skipped checking logic on second pass-through

- Removed dependency on npm in init scripts for product builds
- Skip logic if _BOTH_ variables are set
diff --git a/blackberry10/bin/init b/blackberry10/bin/init
index faabe6e..212a85c 100755
--- a/blackberry10/bin/init
+++ b/blackberry10/bin/init
@@ -12,7 +12,7 @@
 
        Unless required by applicable law or agreed to in writing,
        software distributed under the License is distributed on an
-       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
        KIND, either express or implied.  See the License for the
        specific language governing permissions and limitations
        under the License.
@@ -23,7 +23,7 @@
 LOCAL_BBTOOLS=$CORDOVA_HOME_DIR/bin/dependencies/bb-tools/bin
 
 #Skip all logic if init has already been run (env variable have been set already...)
-if [ -z "$CORDOVA_NODE" ] && [ -z "$CORDOVA_BBTOOLS" ]; then
+if [ -z "$CORDOVA_NODE" ] || [ -z "$CORDOVA_BBTOOLS" ]; then
 
     #set CORDOVA_NODE
     if [ -x "$LOCAL_NODE_BIN" ]; then
@@ -51,42 +51,44 @@
     fi
     export CORDOVA_BBTOOLS=$CORDOVA_BBTOOLS
 
-    #-------------check reqs---------------#
-    NODE="$CORDOVA_NODE/node"
-    NPM="$CORDOVA_NODE/npm"
-    JAVA=$(command -v java)
-    PACKAGER="$CORDOVA_BBTOOLS/blackberry-nativepackager"
-    DEPLOYER="$CORDOVA_BBTOOLS/blackberry-deploy"
-    SIGNER="$CORDOVA_BBTOOLS/blackberry-signer"
-    DEBUGTOKENREQUEST="$CORDOVA_BBTOOLS/blackberry-debugtokenrequest"
+fi
 
-    if [ ! -x "$NODE" ]; then
-        echo node cannot be found on the path. Aborting.
-        EXIT_CODE=2
-    elif [ ! -x "$LOCAL_NODE_BIN" ] && [ ! -x "$NPM" ]; then
-        echo npm cannot be found on the path. Aborting.
-        EXIT_CODE=2
-    elif [ ! -x "$JAVA" ]; then
-        echo java cannot be found on the path. Aborting.
-        EXIT_CODE=2
-    elif [ ! -x "$PACKAGER" ]; then
-        echo blackberry-nativepackager cannot be found on the path. Aborting.
-        EXIT_CODE=2
-    elif [ ! -x "$DEPLOYER" ]; then
-        echo blackberry-deploy cannot be found on the path. Aborting.
-        EXIT_CODE=2
-    elif [ ! -x "$SIGNER" ]; then
-        echo blackberry-signer cannot be found on the path. Aborting.
-        EXIT_CODE=2
-    elif [ ! -x "$DEBUGTOKENREQUEST" ]; then
-        echo blackberry-debugtokenrequest cannot be found on the path. Aborting.
-        EXIT_CODE=2
-    else
-        "$NODE" "$CURRENT_DIR/check_reqs.js" "$@"
-    fi
+#-------------check reqs---------------#
+NODE="$CORDOVA_NODE/node"
+NPM="$CORDOVA_NODE/npm"
+JAVA=$(command -v java)
+PACKAGER="$CORDOVA_BBTOOLS/blackberry-nativepackager"
+DEPLOYER="$CORDOVA_BBTOOLS/blackberry-deploy"
+SIGNER="$CORDOVA_BBTOOLS/blackberry-signer"
+DEBUGTOKENREQUEST="$CORDOVA_BBTOOLS/blackberry-debugtokenrequest"
+NPM_PACKAGE_JSON="$BIN_DIR"/../package.json
 
-    if [ ! -z "$EXIT_CODE" ]; then
-        exit $EXIT_CODE
-    fi
+if [ ! -x "$NODE" ]; then
+    echo node cannot be found on the path. Aborting.
+    EXIT_CODE=2
+elif [ ! -x "$LOCAL_NODE_BIN" ] && [ ! -x "$NPM" ] && [ -e "$NPM_PACKAGE_JSON" ]; then
+    echo npm cannot be found on the path. Aborting.
+    EXIT_CODE=2
+elif [ ! -x "$JAVA" ]; then
+    echo java cannot be found on the path. Aborting.
+    EXIT_CODE=2
+elif [ ! -x "$PACKAGER" ]; then
+    echo blackberry-nativepackager cannot be found on the path. Aborting.
+    EXIT_CODE=2
+elif [ ! -x "$DEPLOYER" ]; then
+    echo blackberry-deploy cannot be found on the path. Aborting.
+    EXIT_CODE=2
+elif [ ! -x "$SIGNER" ]; then
+    echo blackberry-signer cannot be found on the path. Aborting.
+    EXIT_CODE=2
+elif [ ! -x "$DEBUGTOKENREQUEST" ]; then
+    echo blackberry-debugtokenrequest cannot be found on the path. Aborting.
+    EXIT_CODE=2
+else
+    "$NODE" "$CURRENT_DIR/check_reqs.js" "$@"
+fi
+
+if [ ! -z "$EXIT_CODE" ]; then
+    exit $EXIT_CODE
 fi
 
diff --git a/blackberry10/bin/init.bat b/blackberry10/bin/init.bat
index a67bbb7..b90e871 100644
--- a/blackberry10/bin/init.bat
+++ b/blackberry10/bin/init.bat
@@ -83,13 +83,19 @@
     )
 )
 
-if not exist "%LOCAL_NODE_BINARY%" && not exist "%CORDOVA_NODE%\node.exe" (
-  echo node cannot be found on the path. Aborting.
-  exit /b 2
+:end
+
+if not exist "%LOCAL_NODE_BINARY%" (
+  if not exist "%CORDOVA_NODE%\node.exe" (
+    echo node cannot be found on the path. Aborting.
+    exit /b 2
+  )
 )
-if not exist "%CORDOVA_NODE%\npm" (
-  echo npm cannot be found on the path. Aborting.
-  exit /b 2
+if exist "%~dp0..\package.json" (
+  if not exist "%CORDOVA_NODE%\npm" (
+    echo npm cannot be found on the path. Aborting.
+    exit /b 2
+  )
 )
 if not defined FOUNDJAVA (
   echo java cannot be found on the path. Aborting.
@@ -114,6 +120,4 @@
 
 "%CORDOVA_NODE%\node" "%~dp0\check_reqs.js" %*
 
-:end
-
 exit /b 0