From b3d1c011efabb6f7c99a772fdf0a144abe13f156 Mon Sep 17 00:00:00 2001
From: j1nx
Date: Sun, 17 May 2020 17:38:09 +0200
Subject: [PATCH] MycroftOS: GUI: Add mycroft-gui systemd service file
---
.../mycroft-service/mycroft-gui.service | 18 ++++++++++++++++++
.../package/mycroft-service/mycroft-service.mk | 2 ++
.../systemd/system-preset/10-mycroftos.preset | 1 +
3 files changed, 21 insertions(+)
create mode 100644 buildroot-external/package/mycroft-service/mycroft-gui.service
diff --git a/buildroot-external/package/mycroft-service/mycroft-gui.service b/buildroot-external/package/mycroft-service/mycroft-gui.service
new file mode 100644
index 00000000..d18c3ae2
--- /dev/null
+++ b/buildroot-external/package/mycroft-service/mycroft-gui.service
@@ -0,0 +1,18 @@
+[Unit]
+Description=Mycroft GUI
+PartOf=mycroft.service
+After=mycroft.service
+After=mycroft-messagebus.service
+
+[Service]
+User=mycroft
+WorkingDirectory=/home/mycroft
+Environment=LD_LIBRARY_PATH=/usr/lib
+Environment=QML2_IMPORT_PATH=/usr/lib/qml
+ExecStartPre=-/usr/bin/sudo /bin/psplash-write QUIT
+ExecStart=mycroft-gui-app
+StandardOutput=null
+Restart=on-failure
+
+[Install]
+WantedBy=mycroft.service
diff --git a/buildroot-external/package/mycroft-service/mycroft-service.mk b/buildroot-external/package/mycroft-service/mycroft-service.mk
index 309cb3e5..66f0b69a 100644
--- a/buildroot-external/package/mycroft-service/mycroft-service.mk
+++ b/buildroot-external/package/mycroft-service/mycroft-service.mk
@@ -23,6 +23,8 @@ define MYCROFT_SERVICE_INSTALL_TARGET_CMDS
$(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
+ $(INSTALL) -D -m 644 $(@D)/mycroft-gui.service \
+ $(TARGET_DIR)/usr/lib/systemd/system/mycroft-gui.service
endef
$(eval $(generic-package))
diff --git a/buildroot-external/rootfs-overlay/usr/lib/systemd/system-preset/10-mycroftos.preset b/buildroot-external/rootfs-overlay/usr/lib/systemd/system-preset/10-mycroftos.preset
index 51c07330..72017c9f 100644
--- a/buildroot-external/rootfs-overlay/usr/lib/systemd/system-preset/10-mycroftos.preset
+++ b/buildroot-external/rootfs-overlay/usr/lib/systemd/system-preset/10-mycroftos.preset
@@ -19,6 +19,7 @@ enable mycroft-voice.service
enable mycroft-audio.service
enable mycroft-skills.service
enable mycroft-enclosure.service
+enable mycroft-gui.service
disable mycroft-splash-quit.service
disable getty@.service