Skip to content
This repository has been archived by the owner on Mar 15, 2022. It is now read-only.

Commit

Permalink
Add missing dependencies to install.sh and warn ARMv6 users of incomp…
Browse files Browse the repository at this point in the history
…atibility
  • Loading branch information
t1m0thyj committed Oct 25, 2018
1 parent e784d4c commit 31f8a5d
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
#!/usr/bin/env bash

MAIN_PY="
import os.path
activate_this = os.path.join(os.path.dirname(__file__), '../env/bin/activate_this.py')
with open(activate_this) as f:
exec(f.read(), {'__file__': activate_this})
import examples.voice.assistant_library_with_local_commands_demo as assistant
assistant.main()
"

SERVICE="[Unit]
Description=Google Assistant for Raspberry Pi
After=network.target
[Service]
ExecStart=/bin/bash -c 'source env/bin/activate && env/bin/python3 -u src/AssistantPi.py'
ExecStart=/usr/bin/python3 -u src/AssistantPi.py
WorkingDirectory=$HOME/AIY-projects-python
StandardOutput=inherit
StandardError=inherit
Expand All @@ -16,6 +26,13 @@ User=$USER
WantedBy=multi-user.target
"

if [ "$(uname -m)" = "armv6" ]; then
echo -e "\e[1;31mError: AssistantPi does not work on the Pi Zero and Pi 1.\e[0m
If you are using a device with an ARMv6 CPU, try this project instead:
https://github.com/warchildmd/google-assistant-hotword-raspi"
exec $SHELL
fi

if [ -f $HOME/AIY-projects-python/src/AssistantPi.py ]; then
echo -e "\e[1;31mError: AssistantPi is already installed.\e[0m
Try running upgrade.sh or uninstall.sh instead."
Expand All @@ -26,27 +43,26 @@ if [ ! -f $HOME/assistant.json ]; then
echo -e "\e[1;31mError: You need client secrets to use the Assistant API.\e[0m
Follow these instructions:
https://developers.google.com/api-client-library/python/auth/installed-app#creatingcred
and put the file at /home/pi/assistant.json"
and put the file at $HOME/assistant.json"
exec $SHELL
fi

sudo apt-get install git virtualenv
sudo apt-get install git libttspico-utils python3-dev python3-numpy virtualenv

git clone https://github.com/google/aiyprojects-raspbian.git $HOME/AIY-projects-python
cd $HOME/AIY-projects-python

virtualenv --system-site-packages -p python3 env
env/bin/pip install -e src
env/bin/pip install google-auth-oauthlib # TODO Temporary fix for missing dependency
env/bin/pip install google-auth-oauthlib # HACK Temporary fix for missing dependency

ln -s examples/voice/assistant_library_with_local_commands_demo.py src/AssistantPi.py
echo "$MAIN_PY" > src/AssistantPi.py
echo "$SERVICE" | sudo tee /lib/systemd/system/AssistantPi.service > /dev/null

sudo systemctl daemon-reload
sudo systemctl enable AssistantPi.service

source env/bin/activate
env/bin/python3 src/AssistantPi.py
python3 src/AssistantPi.py

echo
sudo systemctl start AssistantPi.service

0 comments on commit 31f8a5d

Please sign in to comment.