MycroftOS: Bump mycroft to 19.8.5 and proper systemd support.
- Make it more robust - In preparation for watchdog support - Do not start Mycroft if network is not up - Wait for internet connectivity
This commit is contained in:
parent
e1c343a762
commit
181bb4c98d
|
@ -0,0 +1,15 @@
|
|||
[Unit]
|
||||
Description=Mycroft Audio
|
||||
PartOf=mycroft.service
|
||||
After=mycroft.service
|
||||
|
||||
[Service]
|
||||
User=mycroft
|
||||
WorkingDirectory=/home/mycroft
|
||||
ExecStart=mycroft-audio
|
||||
StandardOutput=file:/var/log/mycroft/audio.log
|
||||
StandardError=file:/var/log/mycroft/audio.error.log
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=mycroft.service
|
|
@ -0,0 +1,16 @@
|
|||
[Unit]
|
||||
Description=Mycroft Enclosure
|
||||
PartOf=mycroft.service
|
||||
After=mycroft.service
|
||||
After=mycroft-messagebus.service
|
||||
|
||||
[Service]
|
||||
User=mycroft
|
||||
WorkingDirectory=/home/mycroft
|
||||
ExecStart=mycroft-enclosure-client
|
||||
StandardOutput=file:/var/log/mycroft/enclosure.log
|
||||
StandardError=file:/var/log/mycroft/enclosure.error.log
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=mycroft.service
|
|
@ -0,0 +1,15 @@
|
|||
[Unit]
|
||||
Description=Mycroft Messagebus
|
||||
PartOf=mycroft.service
|
||||
After=mycroft.service
|
||||
|
||||
[Service]
|
||||
User=mycroft
|
||||
WorkingDirectory=/home/mycroft
|
||||
ExecStart=mycroft-messagebus
|
||||
StandardOutput=file:/var/log/mycroft/bus.log
|
||||
StandardError=file:/var/log/mycroft/bus.error.log
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=mycroft.service
|
|
@ -11,13 +11,31 @@ MYCROFT_SERVICE_LICENSE = Apache License 2.0
|
|||
MYCROFT_SERVICE_LICENSE_FILES = LICENSE
|
||||
|
||||
define MYCROFT_SERVICE_INSTALL_TARGET_CMDS
|
||||
$(INSTALL) -m 0755 $(@D)/start-mycroft.sh $(TARGET_DIR)/usr/bin/
|
||||
$(INSTALL) -m 0755 $(@D)/stop-mycroft.sh $(TARGET_DIR)/usr/bin/
|
||||
$(INSTALL) -D -m 644 $(@D)/mycroft.service \
|
||||
$(TARGET_DIR)/usr/lib/systemd/system/mycroft.service
|
||||
$(INSTALL) -D -m 644 $(@D)/mycroft-messagebus.service \
|
||||
$(TARGET_DIR)/usr/lib/systemd/system/mycroft-messagebus.service
|
||||
$(INSTALL) -D -m 644 $(@D)/mycroft-audio.service \
|
||||
$(TARGET_DIR)/usr/lib/systemd/system/mycroft-audio.service
|
||||
$(INSTALL) -D -m 644 $(@D)/mycroft-voice.service \
|
||||
$(TARGET_DIR)/usr/lib/systemd/system/mycroft-voice.service
|
||||
$(INSTALL) -D -m 644 $(@D)/mycroft-enclosure.service \
|
||||
$(TARGET_DIR)/usr/lib/systemd/system/mycroft-enclosure.service
|
||||
$(INSTALL) -D -m 644 $(@D)/mycroft-skills.service \
|
||||
$(TARGET_DIR)/usr/lib/systemd/system/mycroft-skills.service
|
||||
mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
|
||||
ln -fs ../../../../usr/lib/systemd/system/mycroft.service \
|
||||
$(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/mycroft.service
|
||||
ln -fs ../../../../usr/lib/systemd/system/mycroft-messagebus.service \
|
||||
$(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/mycroft-messagebus.service
|
||||
ln -fs ../../../../usr/lib/systemd/system/mycroft-audio.service \
|
||||
$(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/mycroft-audio.service
|
||||
ln -fs ../../../../usr/lib/systemd/system/mycroft-voice.service \
|
||||
$(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/mycroft-voice.service
|
||||
ln -fs ../../../../usr/lib/systemd/system/mycroft-enclosure.service \
|
||||
$(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/mycroft-enclosure.service
|
||||
ln -fs ../../../../usr/lib/systemd/system/mycroft-skills.service \
|
||||
$(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/mycroft-skills.service
|
||||
endef
|
||||
|
||||
$(eval $(generic-package))
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
[Unit]
|
||||
Description=Mycroft Skills
|
||||
PartOf=mycroft.service
|
||||
After=mycroft.service
|
||||
|
||||
[Service]
|
||||
User=mycroft
|
||||
WorkingDirectory=/home/mycroft
|
||||
ExecStart=mycroft-skills
|
||||
StandardOutput=file:/var/log/mycroft/skills.log
|
||||
StandardError=file:/var/log/mycroft/skills.error.log
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=mycroft.service
|
|
@ -0,0 +1,15 @@
|
|||
[Unit]
|
||||
Description=Mycroft Voice
|
||||
PartOf=mycroft.service
|
||||
After=mycroft.service
|
||||
|
||||
[Service]
|
||||
User=mycroft
|
||||
WorkingDirectory=/home/mycroft
|
||||
ExecStart=mycroft-speech-client
|
||||
StandardOutput=file:/var/log/mycroft/voice.log
|
||||
StandardError=file:/var/log/mycroft/voice.error.log
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=mycroft.service
|
|
@ -1,15 +1,15 @@
|
|||
[Unit]
|
||||
Description=Mycroft AI
|
||||
Description=Mycroft A.I. Software stack.
|
||||
After=pulseaudio.service
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
User=mycroft
|
||||
WorkingDirectory=/home/mycroft
|
||||
ExecStart=start-mycroft.sh all
|
||||
ExecStop=stop-mycroft.sh all
|
||||
Type=forking
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
Type=oneshot
|
||||
ExecStartPre=/bin/bash -c 'while ! ping -q -c 1 -W 1 1.1.1.1 >/dev/null 2>&1; do sleep 1; done'
|
||||
ExecStart=/bin/true
|
||||
RemainAfterExit=yes
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
|
@ -1,231 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2017 Mycroft AI Inc.
|
||||
#
|
||||
# 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.
|
||||
|
||||
SOURCE="${BASH_SOURCE[0]}"
|
||||
|
||||
script=${0}
|
||||
script=${script##*/}
|
||||
cd -P "$( dirname "$SOURCE" )"
|
||||
DIR="$( pwd )"
|
||||
|
||||
function help() {
|
||||
echo "${script}: Mycroft command/service launcher"
|
||||
echo "usage: ${script} [COMMAND] [restart] [params]"
|
||||
echo
|
||||
echo "Services COMMANDs:"
|
||||
echo " all runs core services: bus, audio, skills, voice"
|
||||
echo " debug runs core services, then starts the CLI"
|
||||
echo " audio the audio playback service"
|
||||
echo " bus the messagebus service"
|
||||
echo " skills the skill service"
|
||||
echo " voice voice capture service"
|
||||
# echo " wifi wifi setup service"
|
||||
echo " enclosure mark_1 enclosure service"
|
||||
echo
|
||||
echo "Tool COMMANDs:"
|
||||
echo " cli the Command Line Interface"
|
||||
echo " unittest run mycroft-core unit tests (requires pytest)"
|
||||
echo " skillstest run the skill autotests for all skills (requires pytest)"
|
||||
echo
|
||||
echo "Util COMMANDs:"
|
||||
echo " audiotest attempt simple audio validation"
|
||||
echo " audioaccuracytest more complex audio validation"
|
||||
echo " sdkdoc generate sdk documentation"
|
||||
echo
|
||||
echo "Options:"
|
||||
echo " restart (optional) Force the service to restart if running"
|
||||
echo
|
||||
echo "Examples:"
|
||||
echo " ${script} all"
|
||||
echo " ${script} all restart"
|
||||
echo " ${script} cli"
|
||||
echo " ${script} unittest"
|
||||
|
||||
exit 1
|
||||
}
|
||||
|
||||
_module=""
|
||||
function name-to-script-path() {
|
||||
case ${1} in
|
||||
"bus") _module="mycroft.messagebus.service" ;;
|
||||
"skills") _module="mycroft.skills" ;;
|
||||
"audio") _module="mycroft.audio" ;;
|
||||
"voice") _module="mycroft.client.speech" ;;
|
||||
"cli") _module="mycroft.client.text" ;;
|
||||
"audiotest") _module="mycroft.util.audio_test" ;;
|
||||
"audioaccuracytest") _module="mycroft.audio-accuracy-test" ;;
|
||||
"enclosure") _module="mycroft.client.enclosure" ;;
|
||||
|
||||
*)
|
||||
echo "Error: Unknown name '${1}'"
|
||||
exit 1
|
||||
esac
|
||||
}
|
||||
|
||||
first_time=true
|
||||
|
||||
# set the right locale / language settings
|
||||
export LC_ALL=en_US.UTF-8
|
||||
export LANG=en_US.UTF-8
|
||||
export LANGUAGE=en_US.UTF-8
|
||||
|
||||
function init-once() {
|
||||
sudo fbv -f -d 1 /opt/mycroft/splash/logo.png > /dev/null 2>&1
|
||||
if ($first_time) ; then
|
||||
echo "Initializing..."
|
||||
# Check if Mycroft log folders are present and if not
|
||||
# create those logging folders
|
||||
if [[ ! -w /var/log/mycroft/ ]] ; then
|
||||
# Creating needed folders
|
||||
printf "Creating /var/log/mycroft/ directory"
|
||||
if [[ ! -d /var/log/mycroft/ ]] ; then
|
||||
mkdir /var/log/mycroft/
|
||||
fi
|
||||
fi
|
||||
first_time=false
|
||||
fi
|
||||
}
|
||||
|
||||
function launch-process() {
|
||||
init-once
|
||||
|
||||
name-to-script-path ${1}
|
||||
|
||||
# Launch process in foreground
|
||||
echo "Starting $1"
|
||||
python3 -m ${_module} $_params
|
||||
}
|
||||
|
||||
function require-process() {
|
||||
# Launch process if not found
|
||||
name-to-script-path ${1}
|
||||
if ! pgrep -f "python3 -m ${_module}" > /dev/null ; then
|
||||
# Start required process
|
||||
launch-background ${1}
|
||||
fi
|
||||
}
|
||||
|
||||
function launch-background() {
|
||||
init-once
|
||||
|
||||
# Check if given module is running and start (or restart if running)
|
||||
name-to-script-path ${1}
|
||||
if pgrep -f "python3 -m ${_module}" > /dev/null ; then
|
||||
if ($_force_restart) ; then
|
||||
echo "Restarting: ${1}"
|
||||
"${DIR}/stop-mycroft.sh" ${1}
|
||||
else
|
||||
# Already running, no need to restart
|
||||
return
|
||||
fi
|
||||
else
|
||||
echo "Starting background service $1"
|
||||
fi
|
||||
|
||||
# Security warning/reminder for the user
|
||||
if [[ "${1}" == "bus" ]] ; then
|
||||
echo "CAUTION: The Mycroft bus is an open websocket with no built-in security"
|
||||
echo " measures. You are responsible for protecting the local port"
|
||||
echo " 8181 with a firewall as appropriate."
|
||||
fi
|
||||
|
||||
# Launch process in background, sending logs to standard location
|
||||
python3 -m ${_module} $_params >> /var/log/mycroft/${1}.log 2>&1 &
|
||||
}
|
||||
|
||||
function launch-all() {
|
||||
echo "Starting all mycroft-core services"
|
||||
launch-background bus
|
||||
launch-background skills
|
||||
launch-background audio
|
||||
launch-background voice
|
||||
launch-background enclosure
|
||||
}
|
||||
|
||||
_opt=$1
|
||||
_force_restart=false
|
||||
shift
|
||||
if [[ "${1}" == "restart" ]] || [[ "${_opt}" == "restart" ]] ; then
|
||||
_force_restart=true
|
||||
if [[ "${_opt}" == "restart" ]] ; then
|
||||
# Support "start-mycroft.sh restart all" as well as "start-mycroft.sh all restart"
|
||||
_opt=$1
|
||||
fi
|
||||
shift
|
||||
fi
|
||||
_params=$@
|
||||
|
||||
case ${_opt} in
|
||||
"all")
|
||||
launch-all
|
||||
;;
|
||||
|
||||
"bus")
|
||||
launch-background ${_opt}
|
||||
;;
|
||||
"audio")
|
||||
launch-background ${_opt}
|
||||
;;
|
||||
"skills")
|
||||
launch-background ${_opt}
|
||||
;;
|
||||
"voice")
|
||||
launch-background ${_opt}
|
||||
;;
|
||||
|
||||
"debug")
|
||||
launch-all
|
||||
launch-process cli
|
||||
;;
|
||||
|
||||
"cli")
|
||||
require-process bus
|
||||
require-process skills
|
||||
launch-process ${_opt}
|
||||
;;
|
||||
|
||||
# TODO: Restore support for Wifi Setup on a Picroft, etc.
|
||||
# "wifi")
|
||||
# launch-background ${_opt}
|
||||
# ;;
|
||||
"unittest")
|
||||
pytest test/unittests/ --cov=mycroft "$@"
|
||||
;;
|
||||
"singleunittest")
|
||||
pytest "$@"
|
||||
;;
|
||||
"skillstest")
|
||||
pytest test/integrationtests/skills/discover_tests.py "$@"
|
||||
;;
|
||||
"audiotest")
|
||||
launch-process ${_opt}
|
||||
;;
|
||||
"audioaccuracytest")
|
||||
launch-process ${_opt}
|
||||
;;
|
||||
"sdkdoc")
|
||||
cd doc
|
||||
make ${opt}
|
||||
cd ..
|
||||
;;
|
||||
"enclosure")
|
||||
launch-background ${_opt}
|
||||
;;
|
||||
|
||||
*)
|
||||
help
|
||||
;;
|
||||
esac
|
|
@ -1,129 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2017 Mycroft AI Inc.
|
||||
#
|
||||
# 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.
|
||||
|
||||
SOURCE="${BASH_SOURCE[0]}"
|
||||
|
||||
script=${0}
|
||||
script=${script##*/}
|
||||
cd -P "$( dirname "$SOURCE" )"
|
||||
|
||||
function help() {
|
||||
echo "${script}: Mycroft service stopper"
|
||||
echo "usage: ${script} [service]"
|
||||
echo
|
||||
echo "Service:"
|
||||
echo " all ends core services: bus, audio, skills, voice"
|
||||
echo " (none) same as \"all\""
|
||||
echo " bus stop the Mycroft messagebus service"
|
||||
echo " audio stop the audio playback service"
|
||||
echo " skills stop the skill service"
|
||||
echo " voice stop voice capture service"
|
||||
echo " enclosure stop enclosure (hardware/gui interface) service"
|
||||
echo
|
||||
echo "Examples:"
|
||||
echo " ${script}"
|
||||
echo " ${script} audio"
|
||||
|
||||
exit 0
|
||||
}
|
||||
|
||||
function process-running() {
|
||||
if [[ $( pgrep -f "python3 -m mycroft.*${1}" ) ]] ; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function end-process() {
|
||||
if process-running $1 ; then
|
||||
# Find the process by name, only returning the oldest if it has children
|
||||
pid=$( pgrep -o -f "python3 -m mycroft.*${1}" )
|
||||
echo -n "Stopping $1 (${pid})..."
|
||||
kill -SIGINT ${pid}
|
||||
|
||||
# Wait up to 5 seconds (50 * 0.1) for process to stop
|
||||
c=1
|
||||
while [ $c -le 50 ] ; do
|
||||
if process-running $1 ; then
|
||||
sleep 0.1
|
||||
(( c++ ))
|
||||
else
|
||||
c=999 # end loop
|
||||
fi
|
||||
done
|
||||
|
||||
if process-running $1 ; then
|
||||
echo "failed to stop."
|
||||
pid=$( pgrep -o -f "python3 -m mycroft.*${1}" )
|
||||
echo -n " Killing $1 (${pid})..."
|
||||
kill -9 ${pid}
|
||||
echo "killed."
|
||||
result=120
|
||||
else
|
||||
echo "stopped."
|
||||
if [ $result -eq 0 ] ; then
|
||||
result=100
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
result=0 # default, no change
|
||||
|
||||
|
||||
OPT=$1
|
||||
shift
|
||||
|
||||
case ${OPT} in
|
||||
"all")
|
||||
;&
|
||||
"")
|
||||
echo "Stopping all mycroft-core services"
|
||||
end-process messagebus.service
|
||||
end-process skills
|
||||
end-process audio
|
||||
end-process speech
|
||||
end-process enclosure
|
||||
sudo fbv -f -d 1 /opt/mycroft/splash/background.png > /dev/null 2>&1
|
||||
;;
|
||||
"bus")
|
||||
end-process messagebus.service
|
||||
;;
|
||||
"audio")
|
||||
end-process audio
|
||||
;;
|
||||
"skills")
|
||||
end-process skills
|
||||
;;
|
||||
"voice")
|
||||
end-process speech
|
||||
;;
|
||||
"enclosure")
|
||||
end-process enclosure
|
||||
;;
|
||||
|
||||
*)
|
||||
help
|
||||
;;
|
||||
esac
|
||||
|
||||
# Exit codes:
|
||||
# 0 if nothing changed (e.g. --help or no process was running)
|
||||
# 100 at least one process was stopped
|
||||
# 120 if any process had to be killed
|
||||
exit $result
|
|
@ -1,25 +0,0 @@
|
|||
From 79bfc57404cd8d42236283b44f956209ff486e21 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Steenbergen <info@j1nx.nl>
|
||||
Date: Sun, 8 Dec 2019 12:54:33 +0100
|
||||
Subject: [PATCH 1/1] Only install typing if Python version < 3.5
|
||||
|
||||
---
|
||||
setup.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/setup.py b/setup.py
|
||||
index 5e3167a..18eb0fc 100644
|
||||
--- a/setup.py
|
||||
+++ b/setup.py
|
||||
@@ -26,7 +26,7 @@ setup(
|
||||
version='0.8.3',
|
||||
packages=['msm'],
|
||||
install_requires=[
|
||||
- 'GitPython', 'typing', 'fasteners', 'pyyaml', 'pako',
|
||||
+ 'GitPython', 'typing;python_version<"3.5"', 'fasteners', 'pyyaml', 'pako',
|
||||
'lazy'
|
||||
],
|
||||
url='https://github.com/MycroftAI/mycroft-skills-manager',
|
||||
--
|
||||
2.24.0.rc1
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
# md5, sha256 from https://pypi.org/pypi/msm/json
|
||||
md5 fe54a2aecd6751bef66fdcd27ffd3cdc msm-0.5.19.tar.gz
|
||||
sha256 c201785997f3b766ec376a89bbb3367889ac542183ca26733ffe002bb94917b4 msm-0.8.3.tar.gz
|
||||
sha256 214d524e24d10b111f9769c6f860fa63115c529f0a9aec3b0a928083c94bba02 msm-0.8.4.tar.gz
|
||||
# Locally computed sha256 checksums
|
||||
sha256 a6cba85bc92e0cff7a450b1d873c0eaa2e9fc96bf472df0247a26bec77bf3ff9 LICENSE
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
#
|
||||
################################################################################
|
||||
|
||||
PYTHON_MSM_VERSION = 0.8.3
|
||||
PYTHON_MSM_VERSION = 0.8.4
|
||||
PYTHON_MSM_SOURCE = msm-$(PYTHON_MSM_VERSION).tar.gz
|
||||
PYTHON_MSM_SITE = https://files.pythonhosted.org/packages/d5/b5/a7b53d4fc7ccbca6fe41f19c26a61c4a67a38068fe823e571b3e3519eb4b
|
||||
PYTHON_MSM_SITE = https://files.pythonhosted.org/packages/04/e0/e9522b675e72d1de6c3991b1cb7ecc0fbb53a3d625ba329db6f08bfa4de2
|
||||
PYTHON_MSM_SETUP_TYPE = setuptools
|
||||
PYTHON_MSM_LICENSE = Apache-2.0
|
||||
PYTHON_MSM_LICENSE_FILES = LICENSE
|
||||
|
|
|
@ -1 +1 @@
|
|||
sha256 879c8c5ecb3aabe20480569b791ddcf22f105b9e8156ccad7d5c4eb17a2a452a python-mycroft-599fc576905b2dfc22bfdecbf9f478cc68ebd480.tar.gz
|
||||
sha256 a3ce3024f7759e15d15010bc1a4b906cc2c7bbb944fad3af49c51a18e818f12b python-mycroft-cafffd8b62c1376e42e13364c4e1e358d7af41e8.tar.gz
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#
|
||||
################################################################################
|
||||
|
||||
PYTHON_MYCROFT_VERSION = 599fc576905b2dfc22bfdecbf9f478cc68ebd480
|
||||
PYTHON_MYCROFT_VERSION = cafffd8b62c1376e42e13364c4e1e358d7af41e8
|
||||
PYTHON_MYCROFT_SITE = $(call github,MycroftAI,mycroft-core,$(PYTHON_MYCROFT_VERSION))
|
||||
PYTHON_MYCROFT_SETUP_TYPE = setuptools
|
||||
PYTHON_MYCROFT_LICENSE_FILES = LICENSE
|
||||
|
|
Loading…
Reference in New Issue