From 1f8ba4c2231c32410f2a33480d2e259bcf1482d2 Mon Sep 17 00:00:00 2001 From: Max Krummenacher Date: Wed, 20 Apr 2016 17:49:45 +0200 Subject: qt5-x11-free-systemd: add systemd service recipe to start a qt5 app Signed-off-by: Max Krummenacher Acked-by: Marcel Ziswiler --- recipes-qt/qt5/qt5-x11-free-systemd.bb | 24 ++++++++++++ .../qt5/qt5-x11-free-systemd/qt5-x11-demo-init | 43 ++++++++++++++++++++++ .../qt5/qt5-x11-free-systemd/qt5-x11-demo.service | 10 +++++ 3 files changed, 77 insertions(+) create mode 100644 recipes-qt/qt5/qt5-x11-free-systemd.bb create mode 100644 recipes-qt/qt5/qt5-x11-free-systemd/qt5-x11-demo-init create mode 100644 recipes-qt/qt5/qt5-x11-free-systemd/qt5-x11-demo.service (limited to 'recipes-qt') diff --git a/recipes-qt/qt5/qt5-x11-free-systemd.bb b/recipes-qt/qt5/qt5-x11-free-systemd.bb new file mode 100644 index 0000000..304b711 --- /dev/null +++ b/recipes-qt/qt5/qt5-x11-free-systemd.bb @@ -0,0 +1,24 @@ +SECTION = "x11/libs" +SUMMARY = "systemd qtapplication autostart" +RDEPENDS_${PN} = "" +# The license is meant for this recipe and the files it installs. +# RNDIS is part of the kernel, udhcpd is part of busybox +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690" + +inherit allarch systemd + +SRC_URI = "file://qt5-x11-demo.service \ + file://qt5-x11-demo-init " + +do_install () { + install -d ${D}/${bindir} + install -m 0755 ${WORKDIR}/qt5-x11-demo-init ${D}/${bindir} + + install -d ${D}${systemd_unitdir}/system/ + install -m 0644 ${WORKDIR}/qt5-x11-demo.service ${D}${systemd_unitdir}/system +} + +NATIVE_SYSTEMD_SUPPORT = "1" +SYSTEMD_PACKAGES = "${PN}" +SYSTEMD_SERVICE_${PN} = "qt5-x11-demo.service" diff --git a/recipes-qt/qt5/qt5-x11-free-systemd/qt5-x11-demo-init b/recipes-qt/qt5/qt5-x11-free-systemd/qt5-x11-demo-init new file mode 100644 index 0000000..76922ec --- /dev/null +++ b/recipes-qt/qt5/qt5-x11-free-systemd/qt5-x11-demo-init @@ -0,0 +1,43 @@ +#!/bin/sh + +set -e + +cd /usr/share/qtsmarthome-1.0 +QTAPP="smarthome" +QTAPPSTART="./${QTAPP} > /var/log/Xsession.log 2>&1" + +case "$1" in + start) + echo "Starting ${QTAPP}" + if [ -f /etc/profile.d/tslib.sh ]; then + source /etc/profile.d/tslib.sh + fi + if [ -e "$TSLIB_TSDEVICE" ]; then + if [ ! -f /etc/pointercal ]; then + /usr/bin/ts_calibrate + fi + else + if [ -e "/usr/bin/xinput_calibrator_once.sh" ]; then + xinput_calibrator_once.sh + fi + fi + Xorg & + export DISPLAY=:0 + eval $QTAPPSTART & + ;; + stop) + echo "Stopping ${QTAPP}" + killall $QTAPP + killall Xorg + ;; + restart) + $0 stop + $0 start + ;; + *) + echo "usage: $0 { start | stop | restart }" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/recipes-qt/qt5/qt5-x11-free-systemd/qt5-x11-demo.service b/recipes-qt/qt5/qt5-x11-free-systemd/qt5-x11-demo.service new file mode 100644 index 0000000..053f273 --- /dev/null +++ b/recipes-qt/qt5/qt5-x11-free-systemd/qt5-x11-demo.service @@ -0,0 +1,10 @@ +[Unit] +Description=start X and a qt application + +[Service] +Type=forking +ExecStart=/usr/bin/qt5-x11-demo-init start +ExecStop=/usr/bin/qt5-x11-demo-init stop + +[Install] +WantedBy=graphical.target -- cgit v1.2.3