summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Reggiani Manzo2016-12-27 10:38:25 -0200
committerRafael Reggiani Manzo2016-12-27 10:38:25 -0200
commit69be2dcc091d62243567be82f87757a9ca8736e9 (patch)
tree51a8c5e047a6b364e269c356077135635ca6fab7
parent056e8f15349789cf6665727a5d25996f9d787b1f (diff)
downloadaur-69be2dcc091d62243567be82f87757a9ca8736e9.tar.gz
Create user systemd units
Those are a better solution for the audio issues, since PulseAudio itself does not recoomend to get it running as a system instance and Gnome also is not able to manage the audio preferences with such configuration. The units provide a standard interface to starting mycroft services allowing even multiple user installations each one paired independently.
-rw-r--r--.SRCINFO12
-rw-r--r--PKGBUILD20
-rw-r--r--mycroft-core.install26
-rw-r--r--mycroft-service.service11
-rw-r--r--mycroft-skills.service11
-rw-r--r--mycroft-voice.service11
-rw-r--r--mycroft.target4
7 files changed, 84 insertions, 11 deletions
diff --git a/.SRCINFO b/.SRCINFO
index be57f9402890..556e3405b76f 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
# Generated by mksrcinfo v8
-# Mon Dec 26 23:28:24 UTC 2016
+# Tue Dec 27 12:37:54 UTC 2016
pkgbase = mycroft-core
- pkgdesc = Mycroft Core, the Mycroft Artificial Intelligence platform. Contribute to this package at: https://gitlab.com/rafamanzo/aur-mycroft-core
+ pkgdesc = Mycroft Core, the Mycroft Artificial Intelligence platform. If you are using pulseaudio, please be sure to be running it on system mode. Contribute to this package at: https://gitlab.com/rafamanzo/aur-mycroft-core
pkgver = 0.7.20.eb0a37c
pkgrel = 1
url = https://github.com/MycroftAI/mycroft-core
@@ -31,7 +31,15 @@ pkgbase = mycroft-core
depends = mimic-git
depends = alsa-utils
source = git://github.com/MycroftAI/mycroft-core.git#commit=eb0a37c
+ source = mycroft.target
+ source = mycroft-service.service
+ source = mycroft-skills.service
+ source = mycroft-voice.service
sha512sums = SKIP
+ sha512sums = a5989c9ff2b0f7338b4a6f9342c980413d71da375355abb416dce3a79e298fea7872e39b6a1505437aab860ed66755a6f344821f4f7cb31aed46792b2cef3f96
+ sha512sums = 74e9451dc38560e6efd4baf8c77cb81bdf9c0b821c1935eb2dac060614c0f14458101151583c3f444da59d9f065a744a7ad6f8daaeceec8f4e37f67d33199b6b
+ sha512sums = cb8a5c2245ecd52e66acedebf7ce6ce8db32a84b3495d34cc3749e03aa7d12c958b5f71fa01aa79b36906401e655dd6442e979d60d53d64160d9f956551a92df
+ sha512sums = 7266494bf416a6f969bcbe9e854753e2a7e498ff9b43d6ca0ba37d94736bca9bf35f5825f24e19138428728189814222f2592fdea4c7e1d0d0ad18e7d3606a0b
pkgname = mycroft-core
diff --git a/PKGBUILD b/PKGBUILD
index cadf41f1fd19..45fdfa3f145f 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -4,7 +4,7 @@ pkgname=mycroft-core
_pkgcommit=eb0a37c
pkgver=0.7.20.${_pkgcommit}
pkgrel=1
-pkgdesc="Mycroft Core, the Mycroft Artificial Intelligence platform. Contribute to this package at: https://gitlab.com/rafamanzo/aur-mycroft-core"
+pkgdesc="Mycroft Core, the Mycroft Artificial Intelligence platform. If you are using pulseaudio, please be sure to be running it on system mode. Contribute to this package at: https://gitlab.com/rafamanzo/aur-mycroft-core"
arch=('i686' 'x86_64')
url='https://github.com/MycroftAI/mycroft-core'
license=('GPLv3')
@@ -36,8 +36,16 @@ install=mycroft-core.install
# FIXME: The tarball is outdated and not able to pair with home.mycroft.ai
#source=("https://codeload.github.com/MycroftAI/mycroft-core/tar.gz/release/${pkgver}")
#sha512sums=('cd86a76b4131db1b5a172b617ee8ff46d60b8094b8dec9e3a88fe976f7d6c4d9b65b44fd62984d1ce5c8c761f15a341291677b9c1bccc50fead80727b474bca5')
-source=("git://github.com/MycroftAI/mycroft-core.git#commit=${_pkgcommit}")
-sha512sums=(SKIP) # Git already ensures data consistency
+source=("git://github.com/MycroftAI/mycroft-core.git#commit=${_pkgcommit}"
+ "mycroft.target"
+ "mycroft-service.service"
+ "mycroft-skills.service"
+ "mycroft-voice.service")
+sha512sums=(SKIP # Git already ensures data consistency
+ a5989c9ff2b0f7338b4a6f9342c980413d71da375355abb416dce3a79e298fea7872e39b6a1505437aab860ed66755a6f344821f4f7cb31aed46792b2cef3f96
+ 74e9451dc38560e6efd4baf8c77cb81bdf9c0b821c1935eb2dac060614c0f14458101151583c3f444da59d9f065a744a7ad6f8daaeceec8f4e37f67d33199b6b
+ cb8a5c2245ecd52e66acedebf7ce6ce8db32a84b3495d34cc3749e03aa7d12c958b5f71fa01aa79b36906401e655dd6442e979d60d53d64160d9f956551a92df
+ 7266494bf416a6f969bcbe9e854753e2a7e498ff9b43d6ca0ba37d94736bca9bf35f5825f24e19138428728189814222f2592fdea4c7e1d0d0ad18e7d3606a0b)
# Valid only when using a tarball
# prepare(){
@@ -53,4 +61,10 @@ package() {
# Place a link to mimic where mycroft is expecting it
mkdir -p ${pkgdir}/usr/share/mycroft-core/mimic/bin
ln -s /usr/bin/mimic ${pkgdir}/usr/share/mycroft-core/mimic/bin/mimic
+
+ # Symtemd units
+ install -D -m644 "${srcdir}/mycroft.target" "${pkgdir}/usr/lib/systemd/user/mycroft.target"
+ install -D -m644 "${srcdir}/mycroft-service.service" "${pkgdir}/usr/lib/systemd/user/mycroft-service.service"
+ install -D -m644 "${srcdir}/mycroft-skills.service" "${pkgdir}/usr/lib/systemd/user/mycroft-skills.service"
+ install -D -m644 "${srcdir}/mycroft-voice.service" "${pkgdir}/usr/lib/systemd/user/mycroft-voice.service"
}
diff --git a/mycroft-core.install b/mycroft-core.install
index 815e84815d06..3ccd7bea8630 100644
--- a/mycroft-core.install
+++ b/mycroft-core.install
@@ -1,11 +1,11 @@
pre_install() {
- useradd -r mycroft-core -b /usr/share -G audio
+ useradd -r mycroft-core -b /usr/share
}
post_install() {
chown -R mycroft-core:mycroft-core /usr/share/mycroft-core
+ chmod g+w /usr/share/mycroft-core
- # install packages
touch /usr/share/mycroft-core/.bashrc
echo "# Virtualenv initialization" >> /usr/share/mycroft-core/.bashrc
echo "export WORKON_HOME=\$HOME/.virtualenvs" >> /usr/share/mycroft-core/.bashrc
@@ -16,6 +16,24 @@ post_install() {
sudo -u mycroft-core bash -c 'source ~/.bashrc && mkvirtualenv mycroft --system-site-packages -p $(which python2)'
sudo -u mycroft-core bash -c 'source ~/.bashrc && workon mycroft && pip install -r /usr/share/mycroft-core/requirements.txt'
+
+ echo "*** ATTENTION ***"
+ echo ""
+ echo "* The users who will use Mycroft need to be part of the mycroft-core group"
+ echo ""
+ echo "* You can configure your Mycroft instance preferences systemwide at:"
+ echo " /usr/share/mycroft-core/mycroft/configuration/mycroft.conf"
+ echo ""
+ echo "* The systemd units are"
+ echo " - mycroft.target"
+ echo " - mycroft-service.service"
+ echo " - mycroft-skills.service"
+ echo " - mycroft-voice.service"
+ echo ""
+ echo "* Those are USER units which you can start issuing:"
+ echo " systemctl --user start mycroft.target"
+ echo " More information at: https://wiki.archlinux.org/index.php/Systemd/User"
+
}
post_upgrade() {
@@ -25,8 +43,4 @@ post_upgrade() {
post_remove() {
userdel mycroft-core
rm -rf /usr/share/mycroft-core
-
- echo "ATTENTION:"
- echo "If you are using PulseAudio, please be sure to be running it on system mode"
- echo "You should configure it at /etc/pulse/daemon.conf"
}
diff --git a/mycroft-service.service b/mycroft-service.service
new file mode 100644
index 000000000000..7fe1c3943cd9
--- /dev/null
+++ b/mycroft-service.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Mycroft main service
+After=network.target local-fs.target remote-fs.target
+
+[Service]
+Type=simple
+PermissionsStartOnly=true
+ExecStart=/bin/bash -c "source /usr/share/mycroft-core/.virtualenvs/mycroft/bin/activate && /usr/share/mycroft-core/start.sh service"
+
+[Install]
+WantedBy=multi-user.target
diff --git a/mycroft-skills.service b/mycroft-skills.service
new file mode 100644
index 000000000000..4897757922ae
--- /dev/null
+++ b/mycroft-skills.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Mycroft skills provider
+After=network.target local-fs.target remote-fs.target mycroft-service
+
+[Service]
+Type=simple
+PermissionsStartOnly=true
+ExecStart=/bin/bash -c "source /usr/share/mycroft-core/.virtualenvs/mycroft/bin/activate && /usr/share/mycroft-core/start.sh skills"
+
+[Install]
+WantedBy=multi-user.target
diff --git a/mycroft-voice.service b/mycroft-voice.service
new file mode 100644
index 000000000000..b9abc4e728a4
--- /dev/null
+++ b/mycroft-voice.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Mycroft voice processing
+After=network.target local-fs.target remote-fs.target mycroft-skills
+
+[Service]
+Type=simple
+PermissionsStartOnly=true
+ExecStart=/bin/bash -c "source /usr/share/mycroft-core/.virtualenvs/mycroft/bin/activate && /usr/share/mycroft-core/start.sh voice"
+
+[Install]
+WantedBy=multi-user.target
diff --git a/mycroft.target b/mycroft.target
new file mode 100644
index 000000000000..e6b5623fedbf
--- /dev/null
+++ b/mycroft.target
@@ -0,0 +1,4 @@
+[Unit]
+Description=Mycroft Core
+After=network.target local-fs.target remote-fs.target
+Requires=mycroft-service.service mycroft-skills.service mycroft-voice.service