Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 1/9] pam.d: added system-auth configuration file
@ 2014-07-15  8:00 Valentin Popa
  2014-07-15  8:00 ` [PATCH 2/9] user-session-units: added to oe-core Valentin Popa
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Valentin Popa @ 2014-07-15  8:00 UTC (permalink / raw)
  To: openembedded-core

Needed by systemd when it starts user sessions.

Signed-off-by: Valentin Popa <valentin.popa@intel.com>
---
 meta/recipes-extended/pam/libpam/pam.d/system-auth | 7 +++++++
 meta/recipes-extended/pam/libpam_1.1.6.bb          | 1 +
 2 files changed, 8 insertions(+)
 create mode 100644 meta/recipes-extended/pam/libpam/pam.d/system-auth

diff --git a/meta/recipes-extended/pam/libpam/pam.d/system-auth b/meta/recipes-extended/pam/libpam/pam.d/system-auth
new file mode 100644
index 0000000..3275288
--- /dev/null
+++ b/meta/recipes-extended/pam/libpam/pam.d/system-auth
@@ -0,0 +1,7 @@
+auth        required      pam_env.so
+auth        sufficient    pam_unix.so try_first_pass nullok
+auth        required      pam_deny.so
+
+account     required      pam_unix.so
+
+session required pam_systemd.so
\ No newline at end of file
diff --git a/meta/recipes-extended/pam/libpam_1.1.6.bb b/meta/recipes-extended/pam/libpam_1.1.6.bb
index 3190aaf..231a76f 100644
--- a/meta/recipes-extended/pam/libpam_1.1.6.bb
+++ b/meta/recipes-extended/pam/libpam_1.1.6.bb
@@ -16,6 +16,7 @@ SRC_URI = "http://linux-pam.org/library/Linux-PAM-${PV}.tar.bz2 \
            file://pam.d/common-password \
            file://pam.d/common-session \
            file://pam.d/common-session-noninteractive \
+           file://pam.d/system-auth \
            file://pam.d/other \
            file://libpam-xtests.patch \
            file://destdirfix.patch \
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/9] user-session-units: added to oe-core
  2014-07-15  8:00 [PATCH 1/9] pam.d: added system-auth configuration file Valentin Popa
@ 2014-07-15  8:00 ` Valentin Popa
  2014-07-15 14:24   ` Saul Wold
  2014-07-18 14:06   ` [PATCH V2] " Valentin Popa
  2014-07-15  8:00 ` [PATCH 3/9] image.bbclass: set the proper default target Valentin Popa
                   ` (4 subsequent siblings)
  5 siblings, 2 replies; 10+ messages in thread
From: Valentin Popa @ 2014-07-15  8:00 UTC (permalink / raw)
  To: openembedded-core

systemd needs this to launch user sessions.

Signed-off-by: Valentin Popa <valentin.popa@intel.com>
---
 ...temd-login-lib-was-merged-into-libsystemd.patch | 26 ++++++++++++++++++++++
 .../user-session-units/user-session-units_9.bb     | 25 +++++++++++++++++++++
 2 files changed, 51 insertions(+)
 create mode 100644 meta/recipes-support/user-session-units/user-session-units/0001-systemd-login-lib-was-merged-into-libsystemd.patch
 create mode 100644 meta/recipes-support/user-session-units/user-session-units_9.bb

diff --git a/meta/recipes-support/user-session-units/user-session-units/0001-systemd-login-lib-was-merged-into-libsystemd.patch b/meta/recipes-support/user-session-units/user-session-units/0001-systemd-login-lib-was-merged-into-libsystemd.patch
new file mode 100644
index 0000000..9284eb2
--- /dev/null
+++ b/meta/recipes-support/user-session-units/user-session-units/0001-systemd-login-lib-was-merged-into-libsystemd.patch
@@ -0,0 +1,26 @@
+From f80245dbdc5b29fe8dbe9b39482d41fbca044fe6 Mon Sep 17 00:00:00 2001
+From: Valentin Popa <valentin.popa@intel.com>
+Date: Mon, 26 May 2014 10:04:13 +0300
+Subject: [PATCH] systemd-login lib was merged into libsystemd
+
+Signed-off-by: Valentin Popa <valentin.popa@intel.com>
+---
+ Makefile.am | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index a2f960c..7186b10 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -21,7 +21,7 @@ user_session_launch_SOURCES = \
+ 
+ # FIXME: add pkgconfig checks for these instead
+ user_session_launch_LDADD = \
+-	-lsystemd-login \
++	-lsystemd \
+ 	-lpam \
+ 	-lpam_misc
+ 
+-- 
+1.9.1
+
diff --git a/meta/recipes-support/user-session-units/user-session-units_9.bb b/meta/recipes-support/user-session-units/user-session-units_9.bb
new file mode 100644
index 0000000..ad2f683
--- /dev/null
+++ b/meta/recipes-support/user-session-units/user-session-units_9.bb
@@ -0,0 +1,25 @@
+SUMMARY = "systemd units to start a user session"
+
+LICENSE = "LGPLv2.1"
+LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c"
+
+SRC_URI = "http://foo-projects.org/~sofar/${BPN}/${BPN}-${PV}.tar.gz \
+           file://0001-systemd-login-lib-was-merged-into-libsystemd.patch "
+
+SRC_URI[md5sum] = "30d26fec6e3e221072c59554c93ecde0"
+SRC_URI[sha256sum] = "edfc0df890981708e1a09e8488bb91384b6739d76867d3fe2417b03265361717"
+
+DEPENDS = "systemd dbus libpam"
+
+inherit autotools pkgconfig
+
+# Seed configure so it doesn't look on the host host for gnome/xfce/etc.
+EXTRA_OECONF = "ac_cv_prog_E_PROG= \
+ ac_cv_prog_XFCE_PROG= \
+ ac_cv_prog_XFWM_PROG= \
+ ac_cv_prog_XBMC_PROG= \
+ ac_cv_prog_GNOME_PROG= \
+ ac_cv_prog_KDE_PROG= \
+ ac_cv_prog_MYTH_PROG="
+
+FILES_${PN} = "${systemd_unitdir}/ ${libdir}/systemd/user/ ${bindir}/"
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/9] image.bbclass: set the proper default target
  2014-07-15  8:00 [PATCH 1/9] pam.d: added system-auth configuration file Valentin Popa
  2014-07-15  8:00 ` [PATCH 2/9] user-session-units: added to oe-core Valentin Popa
@ 2014-07-15  8:00 ` Valentin Popa
  2014-07-15  8:00 ` [PATCH 4/9] weston-init: added systemd build logic Valentin Popa
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Valentin Popa @ 2014-07-15  8:00 UTC (permalink / raw)
  To: openembedded-core

Check also for "wayland" presence in DISTRO_FEATURES
before creating default.target.

Signed-off-by: Valentin Popa <valentin.popa@intel.com>
---
 meta/classes/image.bbclass | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index a03b880..04aa14b 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -153,7 +153,6 @@ ROOTFS_POSTPROCESS_COMMAND =+ "write_image_manifest ; "
 # Set default postinst log file
 POSTINST_LOGFILE ?= "${localstatedir}/log/postinstall.log"
 # Set default target for systemd images
-SYSTEMD_DEFAULT_TARGET ?= '${@bb.utils.contains("IMAGE_FEATURES", "x11-base", "graphical.target", "multi-user.target", d)}'
 ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("DISTRO_FEATURES", "systemd", "set_systemd_default_target; ", "", d)}'
 
 # some default locales
@@ -171,6 +170,17 @@ do_rootfs[cleandirs] += "${S}"
 # task, so that we have a single fakeroot context for the whole process.
 do_rootfs[umask] = "022"
 
+def determine_default_target(d):
+      graphical_target =  bb.utils.contains("IMAGE_FEATURES", "x11-base", True, False, d) or \
+                       bb.utils.contains("DISTRO_FEATURES", "wayland", True, False, d)
+      if graphical_target:
+         return "graphical.target"
+      else:
+        return "multi-user.target"
+
+
+SYSTEMD_DEFAULT_TARGET ?= '${@determine_default_target(d)}'
+
 # A hook function to support read-only-rootfs IMAGE_FEATURES
 # Currently, it only supports sysvinit system.
 read_only_rootfs_hook () {
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 4/9] weston-init: added systemd build logic
  2014-07-15  8:00 [PATCH 1/9] pam.d: added system-auth configuration file Valentin Popa
  2014-07-15  8:00 ` [PATCH 2/9] user-session-units: added to oe-core Valentin Popa
  2014-07-15  8:00 ` [PATCH 3/9] image.bbclass: set the proper default target Valentin Popa
@ 2014-07-15  8:00 ` Valentin Popa
  2014-07-15  8:00 ` [PATCH 5/9] weston-init: add xuser and enable user-sesssion-launch Valentin Popa
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Valentin Popa @ 2014-07-15  8:00 UTC (permalink / raw)
  To: openembedded-core

Handle the case when systemd is in DISTRO_FEATURES.

Signed-off-by: Valentin Popa <valentin.popa@intel.com>
---
 meta/recipes-graphics/wayland/weston-init.bb | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/meta/recipes-graphics/wayland/weston-init.bb b/meta/recipes-graphics/wayland/weston-init.bb
index 38b78bc..60cdb8d 100644
--- a/meta/recipes-graphics/wayland/weston-init.bb
+++ b/meta/recipes-graphics/wayland/weston-init.bb
@@ -7,13 +7,24 @@ SRC_URI = "file://init"
 S = "${WORKDIR}"
 
 do_install() {
-	install -d ${D}/${sysconfdir}/init.d
-	install -m755 ${WORKDIR}/init ${D}/${sysconfdir}/init.d/weston
+       if ${@base_contains("DISTRO_FEATURES", "sysvinit", "true", "false", d)}; then
+               install -d ${D}/${sysconfdir}/init.d
+               install -m755 ${WORKDIR}/init ${D}/${sysconfdir}/init.d/weston
+       fi
+
+       if ${@base_contains("DISTRO_FEATURES", "systemd", "true", "false", d)}; then
+       fi
 }
 
 inherit allarch update-rc.d
 
-RDEPENDS_${PN} = "weston kbd"
+RDEPENDS_${PN} = "weston \
+                  ${@base_contains('DISTRO_FEATURES', 'sysvinit', 'kbd', '', d)} \
+                  ${@base_contains('DISTRO_FEATURES', 'systemd', 'user-session-units', '', d)} \
+                  "
+
+DEPENDS += "weston \
+            ${@base_contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}"
 
-INITSCRIPT_NAME = "weston"
-INITSCRIPT_PARAMS = "start 9 5 2 . stop 20 0 1 6 ."
+INITSCRIPT_NAME = "${@base_contains('DISTRO_FEATURES', 'sysvinit', 'weston', '', d)}"
+INITSCRIPT_PARAMS = "${@base_contains('DISTRO_FEATURES', 'sysvinit', 'start 9 5 2 . stop 20 0 1 6 .', '', d)}"
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 5/9] weston-init: add xuser and enable user-sesssion-launch
  2014-07-15  8:00 [PATCH 1/9] pam.d: added system-auth configuration file Valentin Popa
                   ` (2 preceding siblings ...)
  2014-07-15  8:00 ` [PATCH 4/9] weston-init: added systemd build logic Valentin Popa
@ 2014-07-15  8:00 ` Valentin Popa
  2014-07-15  8:00 ` [PATCH 6/9] weston: consider --disable-compat-libs in systemd Valentin Popa
  2014-07-15  8:00 ` [PATCH 7/9] user-session-units: use user-session-launch to spawn weston Valentin Popa
  5 siblings, 0 replies; 10+ messages in thread
From: Valentin Popa @ 2014-07-15  8:00 UTC (permalink / raw)
  To: openembedded-core

(*) add xuser
(*) enable user-session-launch@.service for xuser (seat0-1000)

Signed-off-by: Valentin Popa <valentin.popa@intel.com>
---
 meta/recipes-graphics/wayland/weston-init.bb | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-graphics/wayland/weston-init.bb b/meta/recipes-graphics/wayland/weston-init.bb
index 60cdb8d..6eeeab0 100644
--- a/meta/recipes-graphics/wayland/weston-init.bb
+++ b/meta/recipes-graphics/wayland/weston-init.bb
@@ -13,10 +13,12 @@ do_install() {
        fi
 
        if ${@base_contains("DISTRO_FEATURES", "systemd", "true", "false", d)}; then
+               install -d ${D}/${sysconfdir}/systemd/system/graphical.target.wants
+               ln -sf ${systemd_unitdir}/system/user-session-launch@.service ${D}/${sysconfdir}/systemd/system/graphical.target.wants/user-session-launch@seat0-1000.service
        fi
 }
 
-inherit allarch update-rc.d
+inherit allarch update-rc.d useradd
 
 RDEPENDS_${PN} = "weston \
                   ${@base_contains('DISTRO_FEATURES', 'sysvinit', 'kbd', '', d)} \
@@ -28,3 +30,8 @@ DEPENDS += "weston \
 
 INITSCRIPT_NAME = "${@base_contains('DISTRO_FEATURES', 'sysvinit', 'weston', '', d)}"
 INITSCRIPT_PARAMS = "${@base_contains('DISTRO_FEATURES', 'sysvinit', 'start 9 5 2 . stop 20 0 1 6 .', '', d)}"
+
+USERADD_PACKAGES = "${PN}"
+USERADD_PARAM_${PN} = "--create-home \
+ --groups video,tty,audio,input,weston-launch \
+ --user-group xuser"
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 6/9] weston: consider --disable-compat-libs in systemd
  2014-07-15  8:00 [PATCH 1/9] pam.d: added system-auth configuration file Valentin Popa
                   ` (3 preceding siblings ...)
  2014-07-15  8:00 ` [PATCH 5/9] weston-init: add xuser and enable user-sesssion-launch Valentin Popa
@ 2014-07-15  8:00 ` Valentin Popa
  2014-07-15  8:00 ` [PATCH 7/9] user-session-units: use user-session-launch to spawn weston Valentin Popa
  5 siblings, 0 replies; 10+ messages in thread
From: Valentin Popa @ 2014-07-15  8:00 UTC (permalink / raw)
  To: openembedded-core

Since version 209 of systemd, libsystemd-login has been merged
into libsystemd.so.
This patch handles the case when systemd is built
without --enable-compat-libs (e.g. no libsystemd-login).

Signed-off-by: Valentin Popa <valentin.popa@intel.com>
---
 ...c-consider-disable-compat-libs-in-systemd.patch | 47 ++++++++++++++++++++++
 meta/recipes-graphics/wayland/weston_1.5.0.bb      |  3 +-
 2 files changed, 49 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-graphics/wayland/weston/0001-configure.ac-consider-disable-compat-libs-in-systemd.patch

diff --git a/meta/recipes-graphics/wayland/weston/0001-configure.ac-consider-disable-compat-libs-in-systemd.patch b/meta/recipes-graphics/wayland/weston/0001-configure.ac-consider-disable-compat-libs-in-systemd.patch
new file mode 100644
index 0000000..f195520
--- /dev/null
+++ b/meta/recipes-graphics/wayland/weston/0001-configure.ac-consider-disable-compat-libs-in-systemd.patch
@@ -0,0 +1,47 @@
+From 2273fb9cfb978c0e0cbb877475462d72d85138da Mon Sep 17 00:00:00 2001
+From: Valentin Popa <valentin.popa@intel.com>
+Date: Fri, 4 Jul 2014 16:11:19 +0300
+Subject: [PATCH] configure.ac: consider --disable-compat-libs in systemd
+
+Since version 209 of systemd, libsystemd-login has been merged
+into libsystemd.so.
+
+http://lists.freedesktop.org/archives/systemd-devel/2014-February/017146.html
+
+This patch handles the case when systemd is built
+without --enable-compat-libs (e.g. no libsystemd-login).
+
+Upstream-Status: Submitted [wayland-devel]
+
+Signed-off-by: Valentin Popa <valentin.popa@intel.com>
+---
+ configure.ac | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index f55cea8..2638d8a 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -346,13 +346,15 @@ AS_IF([test "x$enable_resize_optimization" = "xyes"],
+       [AC_DEFINE([USE_RESIZE_POOL], [1], [Use resize memory pool as a performance optimization])])
+ 
+ PKG_CHECK_MODULES(SYSTEMD_LOGIN, [libsystemd-login >= 198],
+-                  [have_systemd_login=yes], [have_systemd_login=no])
++                  [have_systemd_login_198=yes have_systemd_login_209=no], [
++  PKG_CHECK_MODULES(SYSTEMD_LOGIN, [libsystemd >= 209],
++                  [have_systemd_login_209=yes have_systemd_login_198=no], [have_systemd_login_209=no have_systemd_login_198=no])
++])
++AS_IF([test "x$have_systemd_login_198" = "xyes" -o "x$have_systemd_login_209" = "xyes"],
++      [have_systemd_login=yes], [have_systemd_login=no])
+ AS_IF([test "x$have_systemd_login" = "xyes"],
+       [AC_DEFINE([HAVE_SYSTEMD_LOGIN], [1], [Have systemd-login])])
+ AM_CONDITIONAL(HAVE_SYSTEMD_LOGIN, test "x$have_systemd_login" = "xyes")
+-
+-PKG_CHECK_MODULES(SYSTEMD_LOGIN_209, [libsystemd-login >= 209],
+-                  [have_systemd_login_209=yes], [have_systemd_login_209=no])
+ AS_IF([test "x$have_systemd_login_209" = "xyes"],
+       [AC_DEFINE([HAVE_SYSTEMD_LOGIN_209], [1], [Have systemd-login >= 209])])
+ 
+-- 
+1.9.1
+
diff --git a/meta/recipes-graphics/wayland/weston_1.5.0.bb b/meta/recipes-graphics/wayland/weston_1.5.0.bb
index 4a8584f..0c7cb0a 100644
--- a/meta/recipes-graphics/wayland/weston_1.5.0.bb
+++ b/meta/recipes-graphics/wayland/weston_1.5.0.bb
@@ -11,7 +11,8 @@ SRC_URI = "http://wayland.freedesktop.org/releases/${BPN}-${PV}.tar.xz \
            file://disable-wayland-scanner-pkg-check.patch \
            file://make-lcms-explicitly-configurable.patch \
            file://make-libwebp-explicitly-configurable.patch \
-"
+           file://0001-configure.ac-consider-disable-compat-libs-in-systemd.patch"
+
 SRC_URI[md5sum] = "8eb40d230efc2411f083c20656534780"
 SRC_URI[sha256sum] = "06388ba04ac79aa72d685cc1a8e646ddb2b8cfe11fcc742294f9addac48b7684"
 
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 7/9] user-session-units: use user-session-launch to spawn weston
  2014-07-15  8:00 [PATCH 1/9] pam.d: added system-auth configuration file Valentin Popa
                   ` (4 preceding siblings ...)
  2014-07-15  8:00 ` [PATCH 6/9] weston: consider --disable-compat-libs in systemd Valentin Popa
@ 2014-07-15  8:00 ` Valentin Popa
  5 siblings, 0 replies; 10+ messages in thread
From: Valentin Popa @ 2014-07-15  8:00 UTC (permalink / raw)
  To: openembedded-core

Make use of the pam setup made by user-session-launch
and spawn weston in the same pam environment.

Signed-off-by: Valentin Popa <valentin.popa@intel.com>
---
 .../0001-Add-TTY_NUM-as-parameter.patch            |  39 ++++++
 .../0001-launcher.c-fork-weston.patch              |  56 +++++++++
 .../0001-set-tty-from-user-params.patch            | 132 +++++++++++++++++++++
 .../user-session-units/user-session-units_9.bb     |  10 +-
 4 files changed, 236 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-support/user-session-units/user-session-units/0001-Add-TTY_NUM-as-parameter.patch
 create mode 100644 meta/recipes-support/user-session-units/user-session-units/0001-launcher.c-fork-weston.patch
 create mode 100644 meta/recipes-support/user-session-units/user-session-units/0001-set-tty-from-user-params.patch

diff --git a/meta/recipes-support/user-session-units/user-session-units/0001-Add-TTY_NUM-as-parameter.patch b/meta/recipes-support/user-session-units/user-session-units/0001-Add-TTY_NUM-as-parameter.patch
new file mode 100644
index 0000000..412b326
--- /dev/null
+++ b/meta/recipes-support/user-session-units/user-session-units/0001-Add-TTY_NUM-as-parameter.patch
@@ -0,0 +1,39 @@
+From 2bf6da4b283f3a04f1e1660028e54e88eca8f289 Mon Sep 17 00:00:00 2001
+From: Valentin Popa <valentin.popa@intel.com>
+Date: Fri, 4 Jul 2014 20:15:11 +0300
+Subject: [PATCH] Add @TTY_NUM@ as parameter
+
+Add @TTY_NUM@ as parameter so we can
+replace it from Makefile.am/configure.ac,
+or directly from our recipe.
+
+Upstream-Status: Pending
+
+Signed-off-by: Valentin Popa <valentin.popa@intel.com>
+---
+ units/system/user-session-launch@.service.in | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/units/system/user-session-launch@.service.in b/units/system/user-session-launch@.service.in
+index 77ec07c..bea084d 100644
+--- a/units/system/user-session-launch@.service.in
++++ b/units/system/user-session-launch@.service.in
+@@ -2,9 +2,14 @@
+ Description=User Session Launcher
+ After=systemd-user-sessions.service systemd-logind.service
+ Requires=systemd-logind.service
++Conflicts=getty@tty1.service
+ 
+ [Service]
+-ExecStart=/usr/bin/user-session-launch %i
++ExecStart=/usr/bin/user-session-launch %i @TTY_NUM@
++Environment=XDG_RUNTIME_DIR=/run/user/1000
++StandardInput=tty
++StandardError=journal
++TTYPath=/dev/tty@TTY_NUM@
+ 
+ [Install]
+ WantedBy=graphical.target
+-- 
+1.9.1
+
diff --git a/meta/recipes-support/user-session-units/user-session-units/0001-launcher.c-fork-weston.patch b/meta/recipes-support/user-session-units/user-session-units/0001-launcher.c-fork-weston.patch
new file mode 100644
index 0000000..e46fcd2
--- /dev/null
+++ b/meta/recipes-support/user-session-units/user-session-units/0001-launcher.c-fork-weston.patch
@@ -0,0 +1,56 @@
+From e2cf9efc092978cb7e9369c7aa949e769ad3f360 Mon Sep 17 00:00:00 2001
+From: Valentin Popa <valentin.popa@intel.com>
+Date: Fri, 4 Jul 2014 18:19:06 +0300
+Subject: [PATCH] launcher.c: fork weston
+
+Fork weston; this way we can inherit pam setup.
+
+Upstream-Status: Pending
+
+Signed-off-by: Valentin Popa <valentin.popa@intel.com>
+---
+ src/launcher.c | 21 +++++++++++++++++++++
+ 1 file changed, 21 insertions(+)
+
+diff --git a/src/launcher.c b/src/launcher.c
+index 635958f..31d40fd 100644
+--- a/src/launcher.c
++++ b/src/launcher.c
+@@ -43,6 +43,18 @@ static void handle_sig(int signal)
+ 	exit(EXIT_SUCCESS);
+ }
+ 
++static void launch_weston() {
++        char * child_argv[6];
++        child_argv[0] = "/bin/sh";
++        child_argv[1] = "-l";
++        child_argv[2] = "-c";
++        child_argv[3] = "/usr/bin/weston \"$@\"";
++        child_argv[4] = "weston";
++        child_argv[5] = NULL;
++        execv(child_argv[0], child_argv);
++        fprintf(stderr, "failed to execv!\n");
++}
++
+ int main(int argc, char **argv)
+ {
+ 	int fd;
+@@ -188,6 +200,15 @@ int main(int argc, char **argv)
+ 	if (setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid) != 0)
+ 		perror("setresuid");
+ 
++        pid_t child;
++        child = fork();
++
++        if (child == -1)
++                fprintf(stderr, "could not spawn child for weston!\n");
++
++        if (child == 0)
++                launch_weston();
++
+ 	pause();
+ 
+ 	/* unreachable */
+-- 
+1.9.1
+
diff --git a/meta/recipes-support/user-session-units/user-session-units/0001-set-tty-from-user-params.patch b/meta/recipes-support/user-session-units/user-session-units/0001-set-tty-from-user-params.patch
new file mode 100644
index 0000000..f10a972
--- /dev/null
+++ b/meta/recipes-support/user-session-units/user-session-units/0001-set-tty-from-user-params.patch
@@ -0,0 +1,132 @@
+From a2f37c23f9d5227fc7f5dc1572446d9c47d94c58 Mon Sep 17 00:00:00 2001
+From: Valentin Popa <valentin.popa@intel.com>
+Date: Fri, 4 Jul 2014 19:15:00 +0300
+Subject: [PATCH] set tty from user params
+
+Avoid tty number hardcoding; let the user
+choose it.
+
+
+Upstream-Status: Pending
+
+Signed-off-by: Valentin Popa <valentin.popa@intel.com>
+---
+ src/launcher.c | 24 +++++++++++++++++++++---
+ src/pam.c      | 14 +++++++-------
+ src/pam.h      |  2 +-
+ 3 files changed, 29 insertions(+), 11 deletions(-)
+
+diff --git a/src/launcher.c b/src/launcher.c
+index 31d40fd..70fd06b 100644
+--- a/src/launcher.c
++++ b/src/launcher.c
+@@ -55,6 +55,19 @@ static void launch_weston() {
+         fprintf(stderr, "failed to execv!\n");
+ }
+ 
++static int is_valid_tty_number(char *tty) {
++        if (tty != NULL && tty[0] != '\0' && \
++            (tty[0] >= '1' && tty[0] <= '9'))
++                if (tty[1] != '\0' || \
++                    (tty[1] >= '1' && tty[1] <= '9'))
++                        return 1;
++                else
++                        return 0;
++        else
++                return 0;
++        return 1;
++}
++
+ int main(int argc, char **argv)
+ {
+ 	int fd;
+@@ -68,6 +81,7 @@ int main(int argc, char **argv)
+ 	long long int struid;
+ 	char *endptr;
+ 	struct passwd *pw;
++        char *tty_num = NULL;
+ 
+ 	sigemptyset(&sa.sa_mask);
+ 	sa.sa_flags = SA_RESTART;
+@@ -82,11 +96,15 @@ int main(int argc, char **argv)
+ 		goto fail;
+ 	}
+ 
+-	if (argc != 2) {
+-		fprintf(stderr, "One argument of form SEAT-UID required.\n");
++	if (argc != 3) {
++		fprintf(stderr, "One argument of form SEAT-UID required and one for tty number.\n");
+ 		goto fail;
+ 	}
+ 
++        tty_num = argv[2];
++        if (!is_valid_tty_number(tty_num))
++                fprintf(stderr, "the tty number is not a valid number; e.g. [1..64].\n");
++
+ 	seat = strtok(argv[1], sep);
+ 	if (!seat || !strstr(seat, "seat")) {
+ 		fprintf(stderr, "SEAT name is invalid.\n");
+@@ -183,7 +201,7 @@ int main(int argc, char **argv)
+ 	for (; *s; s++) {
+ 		if (strcmp(seat, *s) == 0) {
+ 			/* The requested seat is available */
+-			setup_pam_session(seat, user);
++			setup_pam_session(seat, user, tty_num);
+ 		}
+ 		free(*s);
+ 	}
+diff --git a/src/pam.c b/src/pam.c
+index a9c699b..10c3dc7 100644
+--- a/src/pam.c
++++ b/src/pam.c
+@@ -83,18 +83,19 @@ pam_conversation_fn(int msg_count,
+  * pam_systemd.so may guess the variables correctly, but set them beforehand
+  * just to be sure.
+  */
+-void setup_pam_session(char *seat, char *user)
++void setup_pam_session(char *seat, char *user, char *tty_num)
+ {
+ 	int err;
++        char tty[10];
+ 
+ 	pc.conv = pam_conversation_fn;
+ 	pc.appdata_ptr = NULL;
+ 
+-	err = pam_start("login", user, &pc, &ph);
++        snprintf(tty, sizeof tty, "tty%s", tty_num);
++        fprintf(stderr, "setup pam session on tty%s\n", tty);
+ 
+-	/* FIXME: do not hardcode the tty here; should check
+-	 * first to see if it's already taken. */
+-	err = pam_set_item(ph, PAM_TTY, "tty1");
++	err = pam_start("login", user, &pc, &ph);
++	err = pam_set_item(ph, PAM_TTY, tty);
+ 	if (err != PAM_SUCCESS) {
+ 		printf("pam_set_item PAM_TTY returned %d: %s\n", err, pam_strerror(ph, err));
+ 		exit(EXIT_FAILURE);
+@@ -106,8 +107,7 @@ void setup_pam_session(char *seat, char *user)
+ 		exit(EXIT_FAILURE);
+ 	}
+ 
+-	/* FIXME: this variable should correspond to PAM_TTY */
+-	err = pam_misc_setenv(ph, "XDG_VTNR", "1", 0);
++	err = pam_misc_setenv(ph, "XDG_VTNR", tty_num, 0);
+ 	if (err != PAM_SUCCESS) {
+ 		printf("pam_misc_setenv XDG_VTNR returned %d: %s\n", err, pam_strerror(ph, err));
+ 		exit(EXIT_FAILURE);
+diff --git a/src/pam.h b/src/pam.h
+index d6f53b0..e192c3a 100644
+--- a/src/pam.h
++++ b/src/pam.h
+@@ -12,7 +12,7 @@
+ #ifndef __PAM_H__
+ #define __PAM_H__
+ 
+-void setup_pam_session(char *seat, char *user);
++void setup_pam_session(char *seat, char *user, char *tty_num);
+ void close_pam_session(void);
+ 
+ #endif /* __PAM_H_ */
+-- 
+1.9.1
+
diff --git a/meta/recipes-support/user-session-units/user-session-units_9.bb b/meta/recipes-support/user-session-units/user-session-units_9.bb
index ad2f683..4c9fdc4 100644
--- a/meta/recipes-support/user-session-units/user-session-units_9.bb
+++ b/meta/recipes-support/user-session-units/user-session-units_9.bb
@@ -4,7 +4,10 @@ LICENSE = "LGPLv2.1"
 LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c"
 
 SRC_URI = "http://foo-projects.org/~sofar/${BPN}/${BPN}-${PV}.tar.gz \
-           file://0001-systemd-login-lib-was-merged-into-libsystemd.patch "
+           file://0001-systemd-login-lib-was-merged-into-libsystemd.patch \
+           file://0001-launcher.c-fork-weston.patch \
+           file://0001-set-tty-from-user-params.patch \
+           file://0001-Add-TTY_NUM-as-parameter.patch "
 
 SRC_URI[md5sum] = "30d26fec6e3e221072c59554c93ecde0"
 SRC_URI[sha256sum] = "edfc0df890981708e1a09e8488bb91384b6739d76867d3fe2417b03265361717"
@@ -23,3 +26,8 @@ EXTRA_OECONF = "ac_cv_prog_E_PROG= \
  ac_cv_prog_MYTH_PROG="
 
 FILES_${PN} = "${systemd_unitdir}/ ${libdir}/systemd/user/ ${bindir}/"
+
+
+do_configure_prepend() {
+    sed -i -e 's/@TTY_NUM@/1/' ${S}/units/system/user-session-launch@.service.in
+}
\ No newline at end of file
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/9] user-session-units: added to oe-core
  2014-07-15  8:00 ` [PATCH 2/9] user-session-units: added to oe-core Valentin Popa
@ 2014-07-15 14:24   ` Saul Wold
  2014-07-18 14:06   ` [PATCH V2] " Valentin Popa
  1 sibling, 0 replies; 10+ messages in thread
From: Saul Wold @ 2014-07-15 14:24 UTC (permalink / raw)
  To: Valentin Popa, openembedded-core

On 07/15/2014 01:00 AM, Valentin Popa wrote:
> systemd needs this to launch user sessions.
>
> Signed-off-by: Valentin Popa <valentin.popa@intel.com>
> ---
>   ...temd-login-lib-was-merged-into-libsystemd.patch | 26 ++++++++++++++++++++++
>   .../user-session-units/user-session-units_9.bb     | 25 +++++++++++++++++++++
>   2 files changed, 51 insertions(+)
>   create mode 100644 meta/recipes-support/user-session-units/user-session-units/0001-systemd-login-lib-was-merged-into-libsystemd.patch
>   create mode 100644 meta/recipes-support/user-session-units/user-session-units_9.bb
>
> diff --git a/meta/recipes-support/user-session-units/user-session-units/0001-systemd-login-lib-was-merged-into-libsystemd.patch b/meta/recipes-support/user-session-units/user-session-units/0001-systemd-login-lib-was-merged-into-libsystemd.patch
> new file mode 100644
> index 0000000..9284eb2
> --- /dev/null
> +++ b/meta/recipes-support/user-session-units/user-session-units/0001-systemd-login-lib-was-merged-into-libsystemd.patch
> @@ -0,0 +1,26 @@
> +From f80245dbdc5b29fe8dbe9b39482d41fbca044fe6 Mon Sep 17 00:00:00 2001
> +From: Valentin Popa <valentin.popa@intel.com>
> +Date: Mon, 26 May 2014 10:04:13 +0300
> +Subject: [PATCH] systemd-login lib was merged into libsystemd
> +

This patch file is missing an Upstream-Status tag

Sau!

> +Signed-off-by: Valentin Popa <valentin.popa@intel.com>
> +---
> + Makefile.am | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/Makefile.am b/Makefile.am
> +index a2f960c..7186b10 100644
> +--- a/Makefile.am
> ++++ b/Makefile.am
> +@@ -21,7 +21,7 @@ user_session_launch_SOURCES = \
> +
> + # FIXME: add pkgconfig checks for these instead
> + user_session_launch_LDADD = \
> +-	-lsystemd-login \
> ++	-lsystemd \
> + 	-lpam \
> + 	-lpam_misc
> +
> +--
> +1.9.1
> +
> diff --git a/meta/recipes-support/user-session-units/user-session-units_9.bb b/meta/recipes-support/user-session-units/user-session-units_9.bb
> new file mode 100644
> index 0000000..ad2f683
> --- /dev/null
> +++ b/meta/recipes-support/user-session-units/user-session-units_9.bb
> @@ -0,0 +1,25 @@
> +SUMMARY = "systemd units to start a user session"
> +
> +LICENSE = "LGPLv2.1"
> +LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c"
> +
> +SRC_URI = "http://foo-projects.org/~sofar/${BPN}/${BPN}-${PV}.tar.gz \
> +           file://0001-systemd-login-lib-was-merged-into-libsystemd.patch "
> +
> +SRC_URI[md5sum] = "30d26fec6e3e221072c59554c93ecde0"
> +SRC_URI[sha256sum] = "edfc0df890981708e1a09e8488bb91384b6739d76867d3fe2417b03265361717"
> +
> +DEPENDS = "systemd dbus libpam"
> +
> +inherit autotools pkgconfig
> +
> +# Seed configure so it doesn't look on the host host for gnome/xfce/etc.
> +EXTRA_OECONF = "ac_cv_prog_E_PROG= \
> + ac_cv_prog_XFCE_PROG= \
> + ac_cv_prog_XFWM_PROG= \
> + ac_cv_prog_XBMC_PROG= \
> + ac_cv_prog_GNOME_PROG= \
> + ac_cv_prog_KDE_PROG= \
> + ac_cv_prog_MYTH_PROG="
> +
> +FILES_${PN} = "${systemd_unitdir}/ ${libdir}/systemd/user/ ${bindir}/"
>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH V2] user-session-units: added to oe-core
  2014-07-15  8:00 ` [PATCH 2/9] user-session-units: added to oe-core Valentin Popa
  2014-07-15 14:24   ` Saul Wold
@ 2014-07-18 14:06   ` Valentin Popa
  2014-07-18 18:36     ` Saul Wold
  1 sibling, 1 reply; 10+ messages in thread
From: Valentin Popa @ 2014-07-18 14:06 UTC (permalink / raw)
  To: openembedded-core

systemd needs this to launch user sessions.

Signed-off-by: Valentin Popa <valentin.popa@intel.com>
---
 ...temd-login-lib-was-merged-into-libsystemd.patch | 28 ++++++++++++++++++++++
 .../user-session-units/user-session-units_9.bb     | 25 +++++++++++++++++++
 2 files changed, 53 insertions(+)
 create mode 100644 meta/recipes-support/user-session-units/user-session-units/0001-systemd-login-lib-was-merged-into-libsystemd.patch
 create mode 100644 meta/recipes-support/user-session-units/user-session-units_9.bb

diff --git a/meta/recipes-support/user-session-units/user-session-units/0001-systemd-login-lib-was-merged-into-libsystemd.patch b/meta/recipes-support/user-session-units/user-session-units/0001-systemd-login-lib-was-merged-into-libsystemd.patch
new file mode 100644
index 0000000..6fd194c
--- /dev/null
+++ b/meta/recipes-support/user-session-units/user-session-units/0001-systemd-login-lib-was-merged-into-libsystemd.patch
@@ -0,0 +1,28 @@
+From f80245dbdc5b29fe8dbe9b39482d41fbca044fe6 Mon Sep 17 00:00:00 2001
+From: Valentin Popa <valentin.popa@intel.com>
+Date: Mon, 26 May 2014 10:04:13 +0300
+Subject: [PATCH] systemd-login lib was merged into libsystemd
+
+Upstream-Status: Pending
+
+Signed-off-by: Valentin Popa <valentin.popa@intel.com>
+---
+ Makefile.am | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index a2f960c..7186b10 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -21,7 +21,7 @@ user_session_launch_SOURCES = \
+ 
+ # FIXME: add pkgconfig checks for these instead
+ user_session_launch_LDADD = \
+-	-lsystemd-login \
++	-lsystemd \
+ 	-lpam \
+ 	-lpam_misc
+ 
+-- 
+1.9.1
+
diff --git a/meta/recipes-support/user-session-units/user-session-units_9.bb b/meta/recipes-support/user-session-units/user-session-units_9.bb
new file mode 100644
index 0000000..ad2f683
--- /dev/null
+++ b/meta/recipes-support/user-session-units/user-session-units_9.bb
@@ -0,0 +1,25 @@
+SUMMARY = "systemd units to start a user session"
+
+LICENSE = "LGPLv2.1"
+LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c"
+
+SRC_URI = "http://foo-projects.org/~sofar/${BPN}/${BPN}-${PV}.tar.gz \
+           file://0001-systemd-login-lib-was-merged-into-libsystemd.patch "
+
+SRC_URI[md5sum] = "30d26fec6e3e221072c59554c93ecde0"
+SRC_URI[sha256sum] = "edfc0df890981708e1a09e8488bb91384b6739d76867d3fe2417b03265361717"
+
+DEPENDS = "systemd dbus libpam"
+
+inherit autotools pkgconfig
+
+# Seed configure so it doesn't look on the host host for gnome/xfce/etc.
+EXTRA_OECONF = "ac_cv_prog_E_PROG= \
+ ac_cv_prog_XFCE_PROG= \
+ ac_cv_prog_XFWM_PROG= \
+ ac_cv_prog_XBMC_PROG= \
+ ac_cv_prog_GNOME_PROG= \
+ ac_cv_prog_KDE_PROG= \
+ ac_cv_prog_MYTH_PROG="
+
+FILES_${PN} = "${systemd_unitdir}/ ${libdir}/systemd/user/ ${bindir}/"
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH V2] user-session-units: added to oe-core
  2014-07-18 14:06   ` [PATCH V2] " Valentin Popa
@ 2014-07-18 18:36     ` Saul Wold
  0 siblings, 0 replies; 10+ messages in thread
From: Saul Wold @ 2014-07-18 18:36 UTC (permalink / raw)
  To: Valentin Popa, openembedded-core

On 07/18/2014 07:06 AM, Valentin Popa wrote:
> systemd needs this to launch user sessions.
>
> Signed-off-by: Valentin Popa <valentin.popa@intel.com>
> ---
>   ...temd-login-lib-was-merged-into-libsystemd.patch | 28 ++++++++++++++++++++++
>   .../user-session-units/user-session-units_9.bb     | 25 +++++++++++++++++++
>   2 files changed, 53 insertions(+)
>   create mode 100644 meta/recipes-support/user-session-units/user-session-units/0001-systemd-login-lib-was-merged-into-libsystemd.patch
>   create mode 100644 meta/recipes-support/user-session-units/user-session-units_9.bb
>
> diff --git a/meta/recipes-support/user-session-units/user-session-units/0001-systemd-login-lib-was-merged-into-libsystemd.patch b/meta/recipes-support/user-session-units/user-session-units/0001-systemd-login-lib-was-merged-into-libsystemd.patch
> new file mode 100644
> index 0000000..6fd194c
> --- /dev/null
> +++ b/meta/recipes-support/user-session-units/user-session-units/0001-systemd-login-lib-was-merged-into-libsystemd.patch
> @@ -0,0 +1,28 @@
> +From f80245dbdc5b29fe8dbe9b39482d41fbca044fe6 Mon Sep 17 00:00:00 2001
> +From: Valentin Popa <valentin.popa@intel.com>
> +Date: Mon, 26 May 2014 10:04:13 +0300
> +Subject: [PATCH] systemd-login lib was merged into libsystemd
> +
> +Upstream-Status: Pending
> +
> +Signed-off-by: Valentin Popa <valentin.popa@intel.com>
> +---
> + Makefile.am | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/Makefile.am b/Makefile.am
> +index a2f960c..7186b10 100644
> +--- a/Makefile.am
> ++++ b/Makefile.am
> +@@ -21,7 +21,7 @@ user_session_launch_SOURCES = \
> +
> + # FIXME: add pkgconfig checks for these instead
> + user_session_launch_LDADD = \
> +-	-lsystemd-login \
> ++	-lsystemd \
> + 	-lpam \
> + 	-lpam_misc
> +
> +--
> +1.9.1
> +
> diff --git a/meta/recipes-support/user-session-units/user-session-units_9.bb b/meta/recipes-support/user-session-units/user-session-units_9.bb
> new file mode 100644
> index 0000000..ad2f683
> --- /dev/null
> +++ b/meta/recipes-support/user-session-units/user-session-units_9.bb
> @@ -0,0 +1,25 @@
> +SUMMARY = "systemd units to start a user session"
> +
> +LICENSE = "LGPLv2.1"
> +LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c"
> +
> +SRC_URI = "http://foo-projects.org/~sofar/${BPN}/${BPN}-${PV}.tar.gz \
> +           file://0001-systemd-login-lib-was-merged-into-libsystemd.patch "
> +
> +SRC_URI[md5sum] = "30d26fec6e3e221072c59554c93ecde0"
> +SRC_URI[sha256sum] = "edfc0df890981708e1a09e8488bb91384b6739d76867d3fe2417b03265361717"
> +
> +DEPENDS = "systemd dbus libpam"
> +

Will this project build without systemd?  When attempting to build world 
without systemd enabled in DISTRO_FEATURES I get the following errors:
> ERROR: Nothing PROVIDES 'systemd' (but /home/sgw/yocto/poky/meta/recipes-support/user-session-units/user-session-units_9.bb DEPENDS on or otherwise requires it)
> ERROR: systemd was skipped: 'systemd' not in DISTRO_FEATURES
> ERROR: Nothing RPROVIDES 'user-session-units-dev' (but /home/sgw/yocto/poky/meta/recipes-support/user-session-units/user-session-units_9.bb RDEPENDS on or otherwise requires it)
> ERROR: No eligible RPROVIDERs exist for 'user-session-units-dev'
> NOTE: Runtime target 'user-session-units-dev' is unbuildable, removing...
> Missing or unbuildable dependency chain was: ['user-session-units-dev']
> ERROR: Nothing RPROVIDES 'user-session-units' (but /home/sgw/yocto/poky/meta/recipes-support/user-session-units/user-session-units_9.bb RDEPENDS on or otherwise requires it)
> ERROR: No eligible RPROVIDERs exist for 'user-session-units'
> NOTE: Runtime target 'user-session-units' is unbuildable, removing...
> Missing or unbuildable dependency chain was: ['user-session-units']

Can you please look into this.

Sau!

> +inherit autotools pkgconfig
> +
> +# Seed configure so it doesn't look on the host host for gnome/xfce/etc.
> +EXTRA_OECONF = "ac_cv_prog_E_PROG= \
> + ac_cv_prog_XFCE_PROG= \
> + ac_cv_prog_XFWM_PROG= \
> + ac_cv_prog_XBMC_PROG= \
> + ac_cv_prog_GNOME_PROG= \
> + ac_cv_prog_KDE_PROG= \
> + ac_cv_prog_MYTH_PROG="
> +
> +FILES_${PN} = "${systemd_unitdir}/ ${libdir}/systemd/user/ ${bindir}/"
>


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-07-18 18:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-15  8:00 [PATCH 1/9] pam.d: added system-auth configuration file Valentin Popa
2014-07-15  8:00 ` [PATCH 2/9] user-session-units: added to oe-core Valentin Popa
2014-07-15 14:24   ` Saul Wold
2014-07-18 14:06   ` [PATCH V2] " Valentin Popa
2014-07-18 18:36     ` Saul Wold
2014-07-15  8:00 ` [PATCH 3/9] image.bbclass: set the proper default target Valentin Popa
2014-07-15  8:00 ` [PATCH 4/9] weston-init: added systemd build logic Valentin Popa
2014-07-15  8:00 ` [PATCH 5/9] weston-init: add xuser and enable user-sesssion-launch Valentin Popa
2014-07-15  8:00 ` [PATCH 6/9] weston: consider --disable-compat-libs in systemd Valentin Popa
2014-07-15  8:00 ` [PATCH 7/9] user-session-units: use user-session-launch to spawn weston Valentin Popa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox