1
1
mirror of https://github.com/OpenVoiceOS/OpenVoiceOS synced 2025-02-03 20:17:46 +01:00

[WIP] Preinstall vosk so we can remove unneeded firstboot service

This commit is contained in:
j1nx 2021-01-28 14:11:04 +01:00
parent 607f7f7418
commit 16f6b8e187
15 changed files with 174 additions and 61 deletions

View File

@ -1,4 +1,3 @@
source "$BR2_EXTERNAL_OPENVOICEOS_PATH/package/firstboot-service/Config.in"
source "$BR2_EXTERNAL_OPENVOICEOS_PATH/package/prepare_system-service/Config.in"
source "$BR2_EXTERNAL_OPENVOICEOS_PATH/package/ovos-splash/Config.in"
menu "Additional drivers, libraries and/or applications"

View File

@ -483,7 +483,6 @@ BR2_PACKAGE_HOST_PYTHON_SIX=y
BR2_PACKAGE_HOST_PYTHON_XLRD=y
BR2_PACKAGE_HOST_PYTHON3=y
BR2_PACKAGE_HOST_PYTHON3_SSL=y
BR2_PACKAGE_FIRSTBOOT_SERVICE=y
BR2_PACKAGE_PREPARE_SYSTEM_SERVICE=y
BR2_PACKAGE_OVOS_SPLASH=y
BR2_PACKAGE_ALSA_PLUGINS=y

View File

@ -1,8 +0,0 @@
config BR2_PACKAGE_FIRSTBOOT_SERVICE
bool "firstboot-service"
help
A systemd service that only runs on first boot
which can be used to run certain scripts that
prepare the rootfs. For now being used to auto
expand the filesystem over the full size of the
SD card.

View File

@ -1,4 +0,0 @@
#!/bin/bash
#
pip install /home/mycroft/vosk-0.3.17-cp38-cp38-linux_aarch64.whl &&
rm /etc/firstboot

View File

@ -1,20 +0,0 @@
################################################################################
#
# firstboot-service
#
################################################################################
FIRSTBOOT_SERVICE_VERSION = 0.1.0
FIRSTBOOT_SERVICE_SITE = $(BR2_EXTERNAL_OPENVOICEOS_PATH)/package/firstboot-service
FIRSTBOOT_SERVICE_SITE_METHOD = local
FIRSTBOOT_SERVICE_LICENSE = Apache License 2.0
FIRSTBOOT_SERVICE_LICENSE_FILES = LICENSE
define FIRSTBOOT_SERVICE_INSTALL_TARGET_CMDS
$(INSTALL) -m 0755 $(@D)/firstboot $(TARGET_DIR)/usr/sbin/
$(INSTALL) -D -m 644 $(@D)/firstboot.service \
$(TARGET_DIR)/usr/lib/systemd/system/firstboot.service
touch $(TARGET_DIR)/etc/firstboot
endef
$(eval $(generic-package))

View File

@ -1,16 +0,0 @@
[Unit]
Description=First Boot run script
DefaultDependencies=no
Conflicts=shutdown.target
After=systemd-remount-fs.service
Before=sysinit.target shutdown.target
ConditionPathIsReadWrite=/etc
ConditionPathExists=/etc/firstboot
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/sbin/firstboot
[Install]
WantedBy=sysinit.target

View File

@ -1,9 +0,0 @@
#!/bin/bash
#
printf "Resize data partition ..."
parted /dev/mmcblk0 unit % resizepart 2 100% &&
partprobe /dev/mmcblk0 &&
sync &&
resize2fs /dev/mmcblk0p2 &&
echo "[OK]"

View File

@ -0,0 +1,43 @@
Metadata-Version: 2.1
Name: vosk
Version: 0.3.17
Summary: Offline open source speech recognition API based on Kaldi and Vosk
Home-page: https://github.com/alphacep/vosk-api
Author: Alpha Cephei Inc
Author-email: contact@alphacephei.com
License: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.5
Description-Content-Type: text/markdown
This is a Python module for Vosk.
Vosk is an offline open source speech recognition toolkit. It enables
speech recognition models for 17 languages and dialects - English, Indian
English, German, French, Spanish, Portuguese, Chinese, Russian, Turkish,
Vietnamese, Italian, Dutch, Catalan, Arabic, Greek, Farsi, Filipino.
Vosk models are small (50 Mb) but provide continuous large vocabulary
transcription, zero-latency response with streaming API, reconfigurable
vocabulary and speaker identification.
Vosk supplies speech recognition for chatbots, smart home appliances,
virtual assistants. It can also create subtitles for movies,
transcription for lectures and interviews.
Vosk scales from small devices like Raspberry Pi or Android smartphone to
big clusters.
# Documentation
For installation instructions, examples and documentation visit [Vosk
Website](https://alphacephei.com/vosk). See also our project on
[Github](https://github.com/alphacep/vosk-api).

View File

@ -0,0 +1,7 @@
vosk/__init__.py,sha256=ysaEVitPgA4GWu4UhQrXmltn3Jlb3ql34Zh12z0fCmM,65
vosk/_vosk.cpython-38-aarch64-linux-gnu.so,sha256=_jDXCqURdFpzF-tzA9Mt96CC3j3jugPqUfnrj3haicw,7684160
vosk/vosk.py,sha256=DsGcUqzBC7d9sSXoa2fYXfgnKO-pa-0__3U6z-UeAQk,3718
vosk-0.3.17.dist-info/METADATA,sha256=XT_g2qzqVP_LF1ohlaDHplTaWAWI62cybVfdPEUi2jc,1637
vosk-0.3.17.dist-info/WHEEL,sha256=Jx4-5BnxSuM-PzrRtSkXf3tgQrnNJxq0xf03F56B1aM,104
vosk-0.3.17.dist-info/top_level.txt,sha256=VyhCKFInHWKAvlbaAYoqHJ2Y35GrQNYA-Ul2CRc30Uk,5
vosk-0.3.17.dist-info/RECORD,,

View File

@ -0,0 +1,5 @@
Wheel-Version: 1.0
Generator: bdist_wheel (0.36.2)
Root-Is-Purelib: false
Tag: cp38-cp38-linux_aarch64

View File

@ -0,0 +1,2 @@
from .vosk import KaldiRecognizer, Model, SpkModel, SetLogLevel

View File

@ -0,0 +1,116 @@
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 4.0.1
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info as _swig_python_version_info
if _swig_python_version_info < (2, 7, 0):
raise RuntimeError("Python 2.7 or later required")
# Import the low-level C/C++ module
if __package__ or "." in __name__:
from . import _vosk
else:
import _vosk
try:
import builtins as __builtin__
except ImportError:
import __builtin__
def _swig_repr(self):
try:
strthis = "proxy of " + self.this.__repr__()
except __builtin__.Exception:
strthis = ""
return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
def _swig_setattr_nondynamic_instance_variable(set):
def set_instance_attr(self, name, value):
if name == "thisown":
self.this.own(value)
elif name == "this":
set(self, name, value)
elif hasattr(self, name) and isinstance(getattr(type(self), name), property):
set(self, name, value)
else:
raise AttributeError("You cannot add instance attributes to %s" % self)
return set_instance_attr
def _swig_setattr_nondynamic_class_variable(set):
def set_class_attr(cls, name, value):
if hasattr(cls, name) and not isinstance(getattr(cls, name), property):
set(cls, name, value)
else:
raise AttributeError("You cannot add class attributes to %s" % cls)
return set_class_attr
def _swig_add_metaclass(metaclass):
"""Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass"""
def wrapper(cls):
return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy())
return wrapper
class _SwigNonDynamicMeta(type):
"""Meta class to enforce nondynamic attributes (no new attributes) for a class"""
__setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__)
class Model(object):
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
def __init__(self, model_path):
_vosk.Model_swiginit(self, _vosk.new_Model(model_path))
__swig_destroy__ = _vosk.delete_Model
def vosk_model_find_word(self, word):
return _vosk.Model_vosk_model_find_word(self, word)
# Register Model in _vosk:
_vosk.Model_swigregister(Model)
class SpkModel(object):
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
def __init__(self, model_path):
_vosk.SpkModel_swiginit(self, _vosk.new_SpkModel(model_path))
__swig_destroy__ = _vosk.delete_SpkModel
# Register SpkModel in _vosk:
_vosk.SpkModel_swigregister(SpkModel)
class KaldiRecognizer(object):
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
def __init__(self, *args):
_vosk.KaldiRecognizer_swiginit(self, _vosk.new_KaldiRecognizer(*args))
__swig_destroy__ = _vosk.delete_KaldiRecognizer
def AcceptWaveform(self, data):
return _vosk.KaldiRecognizer_AcceptWaveform(self, data)
def Result(self):
return _vosk.KaldiRecognizer_Result(self)
def PartialResult(self):
return _vosk.KaldiRecognizer_PartialResult(self)
def FinalResult(self):
return _vosk.KaldiRecognizer_FinalResult(self)
# Register KaldiRecognizer in _vosk:
_vosk.KaldiRecognizer_swigregister(KaldiRecognizer)
def SetLogLevel(level):
return _vosk.SetLogLevel(level)

View File

@ -1,4 +1,3 @@
enable firstboot.service
enable prepare_system.service
enable hostname.service
enable sshd.service
@ -8,7 +7,6 @@ enable pulseaudio.service
enable avahi-daemon.service
enable seeed-voicecard.service
enable NetworkManager.service
enable wifi-connect.service
enable ovos-splash-start.service
enable ovos-splash-40.service