diff --git a/build_raspOVOS.sh b/build_raspOVOS.sh index d3a1bf90..9c8c1f61 100644 --- a/build_raspOVOS.sh +++ b/build_raspOVOS.sh @@ -1,10 +1,17 @@ #!/bin/bash +# Exit on error +# If something goes wrong just stop. +# it allows the user to see issues at once rather than having +# scroll back and figure out what went wrong. +set -e # Update package list and install necessary tools +echo "Updating base system..." apt-get update -apt-get install -y --no-install-recommends git curl i2c-tools swig libssl-dev libfann-dev portaudio19-dev libpulse-dev +apt-get install -y --no-install-recommends git curl i2c-tools swig libssl-dev libfann-dev portaudio19-dev libpulse-dev build-essential python3-dev python3-pip # setup ovos-i2csound +echo "Installing ovos-i2csound..." git clone https://github.com/OpenVoiceOS/ovos-i2csound /tmp/ovos-i2csound mkdir /etc/OpenVoiceOS @@ -19,7 +26,7 @@ chmod +x /usr/libexec/ovos-i2csound systemctl enable i2csound.service # Create virtual environment for ovos -echo_green "Creating virtual environment..." +echo "Creating virtual environment..." mkdir -p ~/.venvs python3 -m venv ~/.venvs/ovos @@ -27,11 +34,30 @@ python3 -m venv ~/.venvs/ovos source ~/.venvs/ovos/bin/activate # install OVOS in venv -echo_green "Installing OVOS..." -pip3 install sdnotify, tflite_runtime +echo "Installing OVOS..." +pip3 install sdnotify tflite_runtime pip3 install ovos-core[lgpl,mycroft,plugins,skills-audio,skills-essential,skills-internet,skills-media] pip3 install ovos-dinkum-listener[extras,linux,onnx] pip3 install ovos-phal[extras,linux,mk1] # copy system scripts over +cp -v /mounted-github-repo/ovos.service /home/pi/.config/systemd/user/ +cp -v /mounted-github-repo/ovos-skills.service /home/pi/.config/systemd/user/ +cp -v /mounted-github-repo/ovos-messagebus.service /home/pi/.config/systemd/user/ +cp -v /mounted-github-repo/ovos-audio.service /home/pi/.config/systemd/user/ +cp -v /mounted-github-repo/ovos-dinkum-listener.service /home/pi/.config/systemd/user/ +cp -v /mounted-github-repo/ovos-phal.service /home/pi/.config/systemd/user/ +cp -v /mounted-github-repo/ovos-admin-phal.service /etc/systemd/system/ + +systemctl --user enable ovos +systemctl --user enable ovos-messagebus +systemctl --user enable ovos-dinkum-listener +systemctl --user enable ovos-audio +systemctl --user enable ovos-skills +systemctl --user enable ovos-phal +systemctl enable ovos-admin-phal + +systemctl --user daemon-reload +systemctl daemon-reload +#chown -v pi:pi /home/pi/README.md \ No newline at end of file diff --git a/ovos-admin-phal.service b/ovos-admin-phal.service new file mode 100644 index 00000000..7bac75c6 --- /dev/null +++ b/ovos-admin-phal.service @@ -0,0 +1,18 @@ +[Unit] +Description=OVOS ADMIN PHAL +PartOf=ovos.service +After=ovos.service +After=ovos-messagebus.service + +[Service] +Type=notify +#User=ovos +ExecStart=/home/pi/.venvs/ovos/bin/python /usr/libexec/ovos-systemd-admin-phal +TimeoutStartSec=1m +TimeoutStopSec=1m +Restart=on-failure +StartLimitInterval=5min +StartLimitBurst=4 + +[Install] +WantedBy=ovos.service diff --git a/ovos-audio.service b/ovos-audio.service new file mode 100644 index 00000000..484129fd --- /dev/null +++ b/ovos-audio.service @@ -0,0 +1,17 @@ +[Unit] +Description=OVOS Audio +PartOf=ovos.service +After=ovos.service +After=ovos-messagebus.service + +[Service] +Type=notify +ExecStart=/home/pi/.venvs/ovos/bin/python /usr/libexec/ovos-systemd-audio +TimeoutStartSec=1m +TimeoutStopSec=1m +Restart=on-failure +StartLimitInterval=5min +StartLimitBurst=4 + +[Install] +WantedBy=ovos.service diff --git a/ovos-dinkum-listener.service b/ovos-dinkum-listener.service new file mode 100644 index 00000000..6744dde2 --- /dev/null +++ b/ovos-dinkum-listener.service @@ -0,0 +1,18 @@ +[Unit] +Description=OVOS Dinkum Listener +PartOf=ovos.service +After=ovos.service +After=ovos-messagebus.service + +[Service] +Type=notify +ExecStart=/home/pi/.venvs/ovos/bin/python /usr/libexec/ovos-systemd-listener +TimeoutStartSec=1m +TimeoutStopSec=1m +Restart=on-failure +StartLimitInterval=5min +StartLimitBurst=4 + +[Install] +WantedBy=ovos.service + diff --git a/ovos-messagebus.service b/ovos-messagebus.service new file mode 100644 index 00000000..57947793 --- /dev/null +++ b/ovos-messagebus.service @@ -0,0 +1,16 @@ +[Unit] +Description=OVOS Messagebus +PartOf=ovos.service +After=ovos.service + +[Service] +Type=notify +ExecStart=/home/pi/.venvs/ovos/bin/python /usr/libexec/ovos-systemd-messagebus +TimeoutStartSec=1m +TimeoutStopSec=1m +Restart=on-failure +StartLimitInterval=5min +StartLimitBurst=4 + +[Install] +WantedBy=ovos.service diff --git a/ovos-phal.service b/ovos-phal.service new file mode 100644 index 00000000..d2fdaed2 --- /dev/null +++ b/ovos-phal.service @@ -0,0 +1,18 @@ +[Unit] +Description=OVOS PHAL +PartOf=ovos.service +After=ovos.service +After=ovos-messagebus.service + +[Service] +Type=notify +ExecStart=/home/pi/.venvs/ovos/bin/python /usr/libexec/ovos-systemd-phal +TimeoutStartSec=1m +TimeoutStopSec=1m +Restart=on-failure +StartLimitInterval=5min +StartLimitBurst=4 + +[Install] +WantedBy=ovos.service + diff --git a/ovos-skills.service b/ovos-skills.service new file mode 100644 index 00000000..e9f5e662 --- /dev/null +++ b/ovos-skills.service @@ -0,0 +1,18 @@ +[Unit] +Description=OVOS Skills +PartOf=ovos.service +After=ovos.service +After=ovos-messagebus.service + +[Service] +Type=notify +ExecStart=/home/pi/.venvs/ovos/bin/python /usr/libexec/ovos-systemd-skills +TimeoutStartSec=10m +TimeoutStopSec=1m +Restart=on-failure +StartLimitInterval=5min +StartLimitBurst=4 + +[Install] +WantedBy=ovos.service + diff --git a/ovos-systemd-admin-phal b/ovos-systemd-admin-phal new file mode 100644 index 00000000..7ebd2df1 --- /dev/null +++ b/ovos-systemd-admin-phal @@ -0,0 +1,33 @@ +#!/usr/bin/env python +########################################################################## +# ovos-systemd-admin-phal.py +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +########################################################################## +import sdnotify +from ovos_PHAL.admin import main + +n = sdnotify.SystemdNotifier() + + +def notify_ready(): + n.notify('READY=1') + print('Startup of admin PHAL service complete') + + +def notify_stopping(): + n.notify('STOPPING=1') + print('Stopping the admin PHAL service') + + +main(ready_hook=notify_ready, stopping_hook=notify_stopping) diff --git a/ovos-systemd-audio b/ovos-systemd-audio new file mode 100644 index 00000000..14e66f32 --- /dev/null +++ b/ovos-systemd-audio @@ -0,0 +1,33 @@ +#!/usr/bin/env python +########################################################################## +# ovos-systemd_audio.py +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +########################################################################## +import sdnotify +from ovos_audio.__main__ import main + +n = sdnotify.SystemdNotifier() + + +def notify_ready(): + n.notify('READY=1') + print('Startup of OVOS Audio service complete') + + +def notify_stopping(): + n.notify('STOPPING=1') + print('Stopping the OVOS Audio service') + + +main(ready_hook=notify_ready, stopping_hook=notify_stopping) diff --git a/ovos-systemd-dinkum-listener b/ovos-systemd-dinkum-listener new file mode 100644 index 00000000..fc0c2b16 --- /dev/null +++ b/ovos-systemd-dinkum-listener @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 + +import sdnotify +from ovos_dinkum_listener.__main__ import main + +n = sdnotify.SystemdNotifier() + + +def notify_ready(): + n.notify('READY=1') + print('Startup of Mycroft Voice service complete') + + +def notify_stopping(): + n.notify('STOPPING=1') + print('Stopping the Mycroft Voice service') + + +main(ready_hook=notify_ready, stopping_hook=notify_stopping) diff --git a/ovos-systemd-messagebus b/ovos-systemd-messagebus new file mode 100644 index 00000000..fce55853 --- /dev/null +++ b/ovos-systemd-messagebus @@ -0,0 +1,33 @@ +#!/usr/bin/env python +########################################################################## +# ovos-systemd_messagebus.py +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +########################################################################## +import sdnotify +from ovos_messagebus.__main__ import main + +n = sdnotify.SystemdNotifier() + + +def notify_ready(): + n.notify('READY=1') + print('Startup of OVOS Messagebus service complete') + + +def notify_stopping(): + n.notify('STOPPING=1') + print('Stopping the OVOS Messagebus service') + + +main(ready_hook=notify_ready, stopping_hook=notify_stopping) diff --git a/ovos-systemd-phal b/ovos-systemd-phal new file mode 100644 index 00000000..fb29d280 --- /dev/null +++ b/ovos-systemd-phal @@ -0,0 +1,33 @@ +#!/usr/bin/env python +########################################################################## +# ovos-systemd_enclosure.py +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +########################################################################## +import sdnotify +from ovos_PHAL.__main__ import main + +n = sdnotify.SystemdNotifier() + + +def notify_ready(): + n.notify('READY=1') + print('Startup of OVOS PHAL service complete') + + +def notify_stopping(): + n.notify('STOPPING=1') + print('Stopping the OVOS PHAL service') + + +main(ready_hook=notify_ready, stopping_hook=notify_stopping) diff --git a/ovos-systemd-skills b/ovos-systemd-skills new file mode 100644 index 00000000..73199790 --- /dev/null +++ b/ovos-systemd-skills @@ -0,0 +1,33 @@ +#!/usr/bin/env python +########################################################################## +# ovos-systemd_skills.py +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +########################################################################## +import sdnotify +from ovos_core.__main__ import main + +n = sdnotify.SystemdNotifier() + + +def notify_ready(): + n.notify('READY=1') + print('Startup of OVOS Skills service complete') + + +def notify_stopping(): + n.notify('STOPPING=1') + print('Stopping the OVOS Skills service') + + +main(ready_hook=notify_ready, stopping_hook=notify_stopping) diff --git a/ovos.service b/ovos.service new file mode 100644 index 00000000..cf5399ae --- /dev/null +++ b/ovos.service @@ -0,0 +1,10 @@ +[Unit] +Description=OVOS A.I. Software stack. + +[Service] +Type=oneshot +ExecStart=/bin/true +RemainAfterExit=yes + +[Install] +WantedBy=default.target diff --git a/scenario.yaml b/scenario.yaml deleted file mode 100644 index 1241c6ce..00000000 --- a/scenario.yaml +++ /dev/null @@ -1,10 +0,0 @@ -uninstall: false -method: virtualenv -channel: development -profile: ovos -features: - skills: true - extra_skills: true - gui: false -rapsberry_pi_tuning: true -share_telemetry: false \ No newline at end of file