Advertisement
Guest User

Untitled

a guest
Sep 10th, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.75 KB | None | 0 0
  1. #!/bin/bash
  2. set -e
  3.  
  4. CONFIG_PATH=./options.json
  5. CLIENT_JSON=./client.json
  6. CRED_JSON=./cred.json
  7.  
  8. CLIENT_SECRETS=$(jq --raw-output '.client_secrets' $CONFIG_PATH)
  9.  
  10. # check if a new assistant file exists
  11. if [ -f "/share/$CLIENT_SECRETS" ]; then
  12.     echo "[Info] Install/Update service client_secrets file"
  13.     cp -f "/share/$CLIENT_SECRETS" "$CLIENT_JSON"
  14. fi
  15.  
  16. if [ ! -f "$CRED_JSON" ] && [ -f "$CLIENT_JSON" ]; then
  17.     echo "[Info] Start WebUI for handling oauth2"
  18.     <virtualenv dir>/python3 ./hassio_oauth.py "$CLIENT_JSON" "$CRED_JSON"
  19. elif [ ! -f "$CRED_JSON" ]; then
  20.     echo "[Error] You need initialize GoogleAssistant with a client secret json!"
  21.     exit 1
  22. fi
  23.  
  24. exec <virtualenv dir>/python3 ./hassio_gassistant.py "$CRED_JSON" < /dev/null
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement