1
1
mirror of https://github.com/OpenVoiceOS/OpenVoiceOS synced 2025-01-31 19:05:14 +01:00

MycroftOS: Different OS layout changes

- Prepare system script to run at boot to prepare the system.
  Now used to restore sound configuration files to default before
  udev takes over and configures the system for what it sees.
  Later can be used to prepare the system for read-only OS similar
  as I have done during my Kodi developemtn years.
- Sound config changes to default settings.
- Remove forgotten wifi-setup system.
This commit is contained in:
Peter Steenbergen 2019-11-11 08:53:55 +01:00
parent 7f7f8522ed
commit 5ccd33e78f
14 changed files with 169 additions and 38 deletions

View File

@ -1,9 +1,9 @@
menu "Mycroft A.I. Personal Assistant"
source "$BR2_EXTERNAL_MYCROFTOS_PATH/package/firstboot-service/Config.in"
source "$BR2_EXTERNAL_MYCROFTOS_PATH/package/prepare_system-service/Config.in"
source "$BR2_EXTERNAL_MYCROFTOS_PATH/package/python-mycroft/Config.in"
source "$BR2_EXTERNAL_MYCROFTOS_PATH/package/mycroft-service/Config.in"
source "$BR2_EXTERNAL_MYCROFTOS_PATH/package/mycroft-splash/Config.in"
source "$BR2_EXTERNAL_MYCROFTOS_PATH/package/wifisetup-service/Config.in"
menu "Additional drivers, libraries and/or applications"
source "$BR2_EXTERNAL_MYCROFTOS_PATH/package/fann/Config.in"
source "$BR2_EXTERNAL_MYCROFTOS_PATH/package/respeaker/Config.in"

View File

@ -292,6 +292,7 @@ BR2_PACKAGE_HOST_PYTHON_LXML=y
BR2_PACKAGE_HOST_PYTHON_SIX=y
BR2_PACKAGE_HOST_PYTHON_XLRD=y
BR2_PACKAGE_FIRSTBOOT_SERVICE=y
BR2_PACKAGE_PREPARE_SYSTEM_SERVICE=y
BR2_PACKAGE_PYTHON_MYCROFT=y
BR2_PACKAGE_MYCROFT_SERVICE=y
BR2_PACKAGE_MYCROFT_SPLASH=y

View File

@ -0,0 +1,6 @@
config BR2_PACKAGE_PREPARE_SYSTEM_SERVICE
bool "prepare_system-service"
help
A systemd service that prepares the system.
Used to change/move files before everything
gets loaded.

View File

@ -0,0 +1,14 @@
#!/bin/bash
#
set -x
exec 1>/var/log/$(basename $0).log 2>&1
rm /etc/asound.conf
rm /etc/pulse/default.pa
rm /etc/pulse/system.pa
rm /etc/pulse/daemon.conf
ln -s /etc/default-asound.conf /etc/asound.conf
ln -s /etc/pulse/pulseaudio-default.pa /etc/pulse/default.pa
ln -s /etc/pulse/pulseaudio-system.pa /etc/pulse/system.pa
ln -s /etc/pulse/pulseaudio-daemon.conf /etc/pulse/daemon.conf

View File

@ -0,0 +1,22 @@
################################################################################
#
# prepare_system-service
#
################################################################################
PREPARE_SYSTEM_SERVICE_VERSION = 0.1.0
PREPARE_SYSTEM_SERVICE_SITE = $(BR2_EXTERNAL_MYCROFTOS_PATH)/package/prepare_system-service
PREPARE_SYSTEM_SERVICE_SITE_METHOD = local
PREPARE_SYSTEM_SERVICE_LICENSE = Apache License 2.0
PREPARE_SYSTEM_SERVICE_LICENSE_FILES = LICENSE
define PREPARE_SYSTEM_SERVICE_INSTALL_TARGET_CMDS
$(INSTALL) -m 0755 $(@D)/prepare_system $(TARGET_DIR)/usr/sbin/
$(INSTALL) -D -m 644 $(@D)/prepare_system.service \
$(TARGET_DIR)/usr/lib/systemd/system/prepare_system.service
mkdir -p $(TARGET_DIR)/etc/systemd/system/sysinit.target.wants
ln -fs ../../../../usr/lib/systemd/system/prepare_system.service \
$(TARGET_DIR)/etc/systemd/system/sysinit.target.wants/prepare_system.service
endef
$(eval $(generic-package))

View File

@ -0,0 +1,14 @@
[Unit]
Description=System prepare run script
DefaultDependencies=no
Conflicts=shutdown.target
After=systemd-remount-fs.service
Before=sysinit.target shutdown.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/sbin/prepare_system
[Install]
WantedBy=sysinit.target

View File

@ -122,6 +122,7 @@ if [ "$overlay" ]; then
rm /etc/asound.conf
rm /var/lib/alsa/asound.state
rm /etc/pulse/default.pa
rm /etc/pulse/system.pa
rm /etc/pulse/daemon.conf
kernel_ver=$(get_kernel_version)
@ -148,6 +149,8 @@ if [ "$overlay" ]; then
ln -s $asound_state /var/lib/alsa/asound.state
echo "create $overlay pulse default file"
ln -s $pulse_default /etc/pulse/default.pa
echo "create $overlay pulse system file"
ln -s $pulse_default /etc/pulse/system.pa
echo "create $overlay pulse daemon file"
ln -s $pulse_daemon /etc/pulse/daemon.conf
fi

View File

@ -1,4 +0,0 @@
config BR2_PACKAGE_WIFISETUP_SERVICE
bool "wifisetup-service"
help
A systemd service to start the MycroftOS-WiFiSetup.

View File

@ -1,12 +0,0 @@
[Unit]
Description=MycroftOS Wifi Setup
After=network.target
[Service]
Type=simple
User=root
WorkingDirectory=/usr/lib/node_modules/MycroftOS-WiFiSetup/
ExecStart=/usr/lib/node_modules/MycroftOS-WiFiSetup/run.sh
[Install]
WantedBy=multi-user.target

View File

@ -1,21 +0,0 @@
################################################################################
#
# wifisetup-service
#
################################################################################
WIFISETUP_SERVICE_VERSION = 0.1.0
WIFISETUP_SERVICE_SITE = $(BR2_EXTERNAL_MYCROFTOS_PATH)/package/wifisetup-service
WIFISETUP_SERVICE_SITE_METHOD = local
WIFISETUP_SERVICE_LICENSE = Apache License 2.0
WIFISETUP_SERVICE_LICENSE_FILES = LICENSE
define WIFISETUP_SERVICE_INSTALL_TARGET_CMDS
$(INSTALL) -D -m 644 $(@D)/mycroftos-wifisetup.service \
$(TARGET_DIR)/usr/lib/systemd/system/mycroftos-wifisetup.service
mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
ln -fs ../../../../usr/lib/systemd/system/mycroftos-wifisetup.service \
$(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/mycroftos-wifisetup.service
endef
$(eval $(generic-package))

View File

@ -0,0 +1,19 @@
defaults.ctl.card 0
defaults.pcm.card 0
defaults.pcm.device 0
pcm.!default {
type plug
slave.pcm "master"
}
ctl.!default {
type hw card 0
}
pcm.master {
type softvol
slave.pcm "plughw:0"
control.name "Master"
control.card 0
}

View File

@ -0,0 +1,89 @@
# This file is part of PulseAudio.
#
# PulseAudio is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# PulseAudio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
## Configuration file for the PulseAudio daemon. See pulse-daemon.conf(5) for
## more information. Default values are commented out. Use either ; or # for
## commenting.
; daemonize = no
; fail = yes
; allow-module-loading = yes
; allow-exit = yes
; use-pid-file = yes
; system-instance = no
; local-server-type = user
; enable-shm = yes
; enable-memfd = yes
; shm-size-bytes = 0 # setting this 0 will use the system-default, usually 64 MiB
; lock-memory = no
; cpu-limit = no
; high-priority = yes
; nice-level = -11
; realtime-scheduling = yes
; realtime-priority = 5
; exit-idle-time = 20
; scache-idle-time = 20
; dl-search-path = (depends on architecture)
; load-default-script-file = yes
; default-script-file = /etc/pulse/default.pa
; log-target = auto
; log-level = notice
; log-meta = no
; log-time = no
; log-backtrace = 0
; resample-method = speex-float-1
; avoid-resampling = false
; enable-remixing = yes
; remixing-use-all-sink-channels = yes
; enable-lfe-remixing = no
; lfe-crossover-freq = 0
; flat-volumes = yes
; rlimit-fsize = -1
; rlimit-data = -1
; rlimit-stack = -1
; rlimit-core = -1
; rlimit-as = -1
; rlimit-rss = -1
; rlimit-nproc = -1
; rlimit-nofile = 256
; rlimit-memlock = -1
; rlimit-locks = -1
; rlimit-sigpending = -1
; rlimit-msgqueue = -1
; rlimit-nice = 31
; rlimit-rtprio = 9
; rlimit-rttime = 200000
; default-sample-format = s16le
; default-sample-rate = 44100
; alternate-sample-rate = 48000
; default-sample-channels = 2
; default-channel-map = front-left,front-right
; default-fragments = 4
; default-fragment-size-msec = 25
; enable-deferred-volume = yes
; deferred-volume-safety-margin-usec = 8000
; deferred-volume-extra-delay-usec = 0