Skip to content

Instantly share code, notes, and snippets.

@clebio
Last active June 17, 2018 17:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clebio/5c0d5af3fbd800e9ecf500ccbed096ac to your computer and use it in GitHub Desktop.
Save clebio/5c0d5af3fbd800e9ecf500ccbed096ac to your computer and use it in GitHub Desktop.
Mycroft with Google AIY Voicekit provisioning
cat >> ~/.ssh/config <<EOF
Host mycroft
User pi
Hostname <mycroft's IP>
EOF
ssh mycroft "mkdir ~/.ssh && chmod 700 ~/.ssh"
ssh mycroft "cat >> ~/.ssh/authorized_keys " < ~/.ssh/id_rsa.pub
while [[ "x$(ssh mycroft pgrep dpkg)" != "x" ]] ; do sleep 10; done
ssh mycroft 'sudo rpi-update'
ssh mycroft 'sudo apt-get -y autoremove'
ssh mycroft 'sudo apt-get clean'
ssh mycroft 'sudo rm -rf /var/lib/apt/lists/*'
ssh mycroft 'sudo reboot'
ssh mycroft 'sudo sed -i "s/.*spi.*/dtparam=spi=on/" /boot/config.txt'
ssh mycroft 'sudo sed -i "s/.*i2c_arm.*/dtparam=i2c_arm=on/" /boot/config.txt'
ssh mycroft 'sudo sed -i -e "\$ai2c-dev" /etc/modules'
ssh mycroft 'sudo sed -i "s/-Dhw:0,0 //" /etc/mycroft/mycroft.conf'
ssh mycroft 'git clone https://github.com/google/aiyprojects-raspbian.git ~/aiyproject'
ssh mycroft 'cd ~/aiyproject && git checkout voicekit'
ssh mycroft 'sudo ~/aiyproject/scripts/configure-driver.sh'
ssh mycroft 'sudo ~/aiyproject/scripts/install-alsa-config.sh'
ssh mycroft 'sudo reboot'
# Test audio:
# ssh mycroft '~/voice-recognizer-raspi/env/bin/python3 ~/voice-recognizer-raspi/checkpoints/check_audio.py'
# https://github.com/MycroftAI/enclosure-picroft/issues/61#issuecomment-397883213
cat > start_wifi <<EOF
#! /opt/venvs/mycroft-core/bin/python
from mycroft.messagebus.send import send
send('mycroft.wifi.start')
print("=====================================================================")
print("Wifi setup has begun. Use your phone, tablet or laptop to connect to")
print("the network 'MYCROFT' using the password '12345678'. Once connected")
print("browse to 'https://start.mycroft.ai', then follow the prompts to")
print("complete the setup.")
print("=====================================================================")
EOF
scp start_wifi mycroft:/home/pi/start_wifi.sh
# ssh mycroft '/opt/venvs/mycroft-core/bin/python /home/pi/start_wifi.sh >> /etc/rc.local'
# or replace "configure_wifi.sh" in /home/py/auto_run.sh
# ssh mycroft '~/aiyproject/checkpoints/check_audio.py'
#sudo vim /etc/wpa_supplicant/wpa_supplicant.conf
# rm ~/.ssh/authorized_keys
# history -c
# history -w
# sudo shutdown now
# on MacOS:
# hdiutil convert /dev/disk... -format UDZO -imagekey zlib-level=3 -o mycroft_aiy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment