Browse Source

add a script for automated install on Rpi (testing only)

nico 7 years ago
parent
commit
65eea4088a

+ 0 - 78
install/install.yml

@@ -1,78 +0,0 @@
----
-#- hosts: localhost
-#  gather_facts: no
-#  connection: local
-#  vars:
-#    - git_url: "git@github.com:kalliope-project/kalliope.git"
-#    - temp_local_repo: "/tmp/kalliope_repo"
-#
-#  tasks:
-#    - name: clone project in /tmp as standart user
-#      git:
-#        repo: "{{ git_url }}"
-#        dest: /tmp/kalliope_repo
-#        accept_hostkey: yes
-
-
-- hosts: localhost
-  gather_facts: no
-  connection: local
-  become: True
-  vars:
-    - git_url: "git@github.com:kalliope-project/kalliope.git"
-    - temp_local_repo: "/tmp/kalliope_repo"
-    - install_path: "/usr/lib/kalliope"
-  tasks:
-    - name: Install packages
-      apt: name={{ item }} update_cache=yes
-      with_items:
-        - python-pip
-        - python-dev
-        - libsmpeg0
-        - libttspico-utils
-        - libsmpeg0
-        - flac
-        - dialog
-        - libffi-dev
-        - libssl-dev
-        - portaudio19-dev
-        - build-essential
-        - sox
-        - libatlas3-base
-        - mplayer
-
-    - name: Copy requirement
-      copy:
-        src: python_requirements.txt
-        dest: /tmp/requirements.txt
-
-    - name: Upgrade pip
-      pip:
-        name: pip
-        state: latest
-
-    - name: Install python libs
-      pip:
-        requirements=/tmp/requirements.txt
-
-#    - name: Check that the repo has been cloned
-#      stat:
-#        path: "{{ temp_local_repo }}"
-#      register: git_repo_stat
-#
-#    - name: Remove old version if exist
-#      file:
-#        path: "{{ install_path }}"
-#        state: absent
-#
-#    - name: Move repo in /usr/lib
-#      command: mv "{{ temp_local_repo }}" "{{ install_path }}"
-#      when: git_repo_stat.stat.exists
-#
-#    - name: Add entry in /usr/bin
-#      file:
-#        src: "{{ install_path }}/kalliope.py"
-#        dest: /usr/bin/kalliope
-#        state: link
-#        force: True
-

+ 0 - 15
install/install_kalliope.sh

@@ -1,15 +0,0 @@
-#!/usr/bin/env bash
-
-# install packages
-sudo apt-get install -y python-pip libssl-dev
-
-# this is used to help the RPI
-sudo apt-get install -y libportaudio0 libportaudio2 libportaudiocpp0 portaudio19-dev
-sudo apt-get install -y libffi-dev python-yaml python-pycparser python-paramiko python-markupsafe apt-transport-https
-
-# install ansible
-sudo pip install ansible==2.1.1.0
-
-# Install the project
-cd kalliope/install
-ansible-playbook install.yml -K

+ 47 - 0
install/rpi_install_kalliope.sh

@@ -0,0 +1,47 @@
+#!/usr/bin/env bash
+
+# This script will install automatically everything needed for Kalliope
+# usage: ./rpi_install_kalliope.sh [<branch_name>]
+# E.g: ./rpi_install_kalliope.sh dev
+# If no branch are set, the master branch will be installed
+
+# name of the branch to install
+branch="master"
+
+# get the branch name to install from passed arguments if exist
+if [ $# -eq 0 ]
+  then
+    echo "No arguments supplied. Master branch will be installed"
+else
+    branch=$1
+    echo "Selected branch name to install: ${branch}"
+fi
+
+echo "Installing python pip..."
+wget https://bootstrap.pypa.io/get-pip.py
+sudo python get-pip.py
+echo "Installing python pip... [OK]"
+
+# install packages
+echo "Installing system packages..."
+sudo apt-get update
+sudo apt-get install -y git python-dev libsmpeg0 libttspico-utils libsmpeg0 \
+flac dialog libffi-dev libffi-dev libssl-dev portaudio19-dev build-essential \
+libssl-dev libffi-dev sox libatlas3-base mplayer libyaml-dev libpython2.7-dev pulseaudio pulseaudio-utils
+
+# this is used to help the RPI
+sudo apt-get install -y libportaudio0 libportaudio2 libportaudiocpp0 portaudio19-dev
+sudo apt-get install -y libffi-dev python-yaml python-pycparser python-paramiko python-markupsafe apt-transport-https
+echo "Installing system packages...[OK]"
+
+echo "Cloning the project"
+# clone the project
+git clone https://github.com/kalliope-project/kalliope.git
+echo "Cloning the project...[OK]"
+
+# Install the project
+echo "Installing Kalliope..."
+cd kalliope
+git checkout ${branch}
+sudo python setup.py install
+echo "Installing Kalliope...[OK]"

+ 1 - 0
kalliope/core/MainController.py

@@ -87,6 +87,7 @@ class MainController:
         logger.debug("Entering state: %s" % self.state)
         self.trigger_instance = self._get_default_trigger()
         self.trigger_callback_called = False
+        self.trigger_instance.daemon = True
         # Wait that the kalliope trigger is pronounced by the user
         self.trigger_instance.start()
         self.next_state()

+ 1 - 1
kalliope/trigger/snowboy/snowboy.py

@@ -60,7 +60,7 @@ class Snowboy(Thread):
         :return:
         """
         # start snowboy loop forever
-        # self.detector.daemon = True
+        self.detector.daemon = True
         self.detector.start()
         self.detector.join()