Browse Source

Move test of USB

Joachim M. Giæver 3 years ago
parent
commit
61d4a6a983
1 changed files with 7 additions and 7 deletions
  1. 7 7
      src/bin/env-wrapper

+ 7 - 7
src/bin/env-wrapper

@@ -40,13 +40,6 @@ if [ ${OZW_AUTH_KEY:=false} != false ]; then
     export OZW_AUTH_KEY
 fi
 
-if [ ! -c "${USB_PATH}" ]; then 
-    lprint "usb-path (${USB_PATH}) does not exist,"
-    lprint "or is not a Character Device"
-    lprint "See: snap get ${SNAP_NAME} -d usb-path"
-    exit 1
-fi
-
 OPT_HELP=false
 
 ARGV=( "$@" )
@@ -66,6 +59,13 @@ if [ $(snapctl services ozwdaemon | grep inactive | wc -l) -eq 0 -a ${OPT_HELP}
 fi
 
 if [ ${OPT_HELP} = false ]; then
+    if [ ! -c "${USB_PATH}" ]; then 
+        lprint "usb-path (${USB_PATH}) does not exist,"
+        lprint "or is not a Character Device"
+        lprint "See: snap get ${SNAP_NAME} -d usb-path"
+        exit 1
+    fi
+
     OZW_ARGS+=(--serial-port "${USB_PATH}")
 
     if [ ${STOP_ON_FAILURE} == true ]; then