All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Eggleton <paul.eggleton@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH] xserver-nodm-init: improvements from meta-oe
Date: Sun, 25 Aug 2013 20:37:44 +0100	[thread overview]
Message-ID: <1377459464-6312-1-git-send-email-paul.eggleton@linux.intel.com> (raw)

Bring in some changes from the meta-oe version of this script in order
to bring them closer together. (Unfortunately it does not completely
supersede the recipes in meta-oe - there is still some unification to be
done between x11-common and xserver-common.)

* Add systemd support (with extensions for ROOTLESS_X)
* Remove sudo from RDEPENDS_${PN} since this hasn't been used by this
  for a long time
* Rearrange recipe slightly to make the order logical

A couple of additional improvements at the same time:
* Use ROOT_HOME for root's home directory
* Set short description in SUMMARY instead of DESCRIPTION

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 .../x11-common/xserver-nodm-init.bb                | 38 +++++++++++++++++-----
 .../x11-common/xserver-nodm-init/xserver-nodm.conf |  1 +
 .../xserver-nodm-init/xserver-nodm.service         | 10 ++++++
 3 files changed, 41 insertions(+), 8 deletions(-)
 create mode 100644 meta/recipes-graphics/x11-common/xserver-nodm-init/xserver-nodm.conf
 create mode 100644 meta/recipes-graphics/x11-common/xserver-nodm-init/xserver-nodm.service

diff --git a/meta/recipes-graphics/x11-common/xserver-nodm-init.bb b/meta/recipes-graphics/x11-common/xserver-nodm-init.bb
index 8490c81..e4508a9 100644
--- a/meta/recipes-graphics/x11-common/xserver-nodm-init.bb
+++ b/meta/recipes-graphics/x11-common/xserver-nodm-init.bb
@@ -1,30 +1,52 @@
-DESCRIPTION = "Simple Xserver Init Script (no dm)"
+SUMMARY = "Simple Xserver Init Script (no dm)"
 LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
 SECTION = "x11"
 PR = "r31"
-RDEPENDS_${PN} = "sudo xuser-account"
 
 SRC_URI = "file://xserver-nodm \
            file://Xusername \
-           file://gplv2-license.patch"
+           file://gplv2-license.patch \
+           file://xserver-nodm.service \
+           file://xserver-nodm.conf \
+"
 
 S = "${WORKDIR}"
 
+# Since we refer to ROOTLESS_X which is normally enabled per-machine
 PACKAGE_ARCH = "${MACHINE_ARCH}"
 
+inherit update-rc.d systemd
+
 do_install() {
-    install -d ${D}${sysconfdir}
     install -d ${D}${sysconfdir}/init.d
     install xserver-nodm ${D}${sysconfdir}/init.d
-    if [ "${ROOTLESS_X}" = "1" ] ; then
-        install -d ${D}${sysconfdir}/X11
-        install Xusername ${D}${sysconfdir}/X11
+
+    if ${@base_contains('DISTRO_FEATURES','systemd','true','false',d)}; then
+        install -d ${D}${sysconfdir}/default
+        install xserver-nodm.conf ${D}${sysconfdir}/default/xserver-nodm
+        install -d ${D}${systemd_unitdir}/system
+        install -m 0644 ${WORKDIR}/xserver-nodm.service ${D}${systemd_unitdir}/system
+        if [ "${ROOTLESS_X}" = "1" ] ; then
+            sed -i 's!^HOME=.*!HOME=/home/xuser!' ${D}${sysconfdir}/default/xserver-nodm
+            sed -i 's!^User=.*!User=xuser!' ${D}${systemd_unitdir}/system/xserver-nodm.service
+        else
+            sed -i 's!^HOME=.*!HOME=${ROOT_HOME}!' ${D}${sysconfdir}/default/xserver-nodm
+            sed -i '/^User=/d' ${D}${systemd_unitdir}/system/xserver-nodm.service
+        fi
+    fi
+
+    if ${@base_contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
+        if [ "${ROOTLESS_X}" = "1" ] ; then
+            install -d ${D}${sysconfdir}/X11
+            install Xusername ${D}${sysconfdir}/X11
+        fi
     fi
 }
 
-inherit update-rc.d
+RDEPENDS_${PN} = "${@base_conditional('ROOTLESS_X', '1', 'xuser-account', '', d)}"
 
 INITSCRIPT_NAME = "xserver-nodm"
 INITSCRIPT_PARAMS = "start 9 5 2 . stop 20 0 1 6 ."
+SYSTEMD_SERVICE_${PN} = "xserver-nodm.service"
 
diff --git a/meta/recipes-graphics/x11-common/xserver-nodm-init/xserver-nodm.conf b/meta/recipes-graphics/x11-common/xserver-nodm-init/xserver-nodm.conf
new file mode 100644
index 0000000..3c0582a
--- /dev/null
+++ b/meta/recipes-graphics/x11-common/xserver-nodm-init/xserver-nodm.conf
@@ -0,0 +1 @@
+HOME=/home/root
diff --git a/meta/recipes-graphics/x11-common/xserver-nodm-init/xserver-nodm.service b/meta/recipes-graphics/x11-common/xserver-nodm-init/xserver-nodm.service
new file mode 100644
index 0000000..62d979f
--- /dev/null
+++ b/meta/recipes-graphics/x11-common/xserver-nodm-init/xserver-nodm.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Xserver startup without a display manager
+
+[Service]
+User=root
+EnvironmentFile=/etc/default/xserver-nodm
+ExecStart=/etc/X11/Xserver
+
+[Install]
+Alias=display-manager.service
-- 
1.8.1.2



                 reply	other threads:[~2013-08-25 19:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1377459464-6312-1-git-send-email-paul.eggleton@linux.intel.com \
    --to=paul.eggleton@linux.intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.