Patchwork [meta-gnome/meta-xfce,1/4] gdm: fix postinst-code to unbreak first boot issues

login
register
mail settings
Submitter Andreas Müller
Date April 27, 2013, 6:33 p.m.
Message ID <1367087640-4264-2-git-send-email-schnitzeltony@googlemail.com>
Download mbox | patch
Permalink /patch/48993/
State Accepted, archived
Commit ded05523d2530b44568980face1a057c1bb78249
Headers show

Comments

Andreas Müller - April 27, 2013, 6:33 p.m.
Exiting postinst code leaves systemd.bbclass offline postinst code unexecuted,
causes postinst not to finish at first boot (gdm.service is not aliased to
display-manager.service -> started much too early) and is not neccesary:
language preparation can be done offline.

Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
---
 meta-gnome/recipes-gnome/gdm/gdm_2.32.2.bb |   31 ++++++++++-----------------
 1 files changed, 12 insertions(+), 19 deletions(-)
Martin Jansa - April 27, 2013, 7:31 p.m.
On Sat, Apr 27, 2013 at 08:33:57PM +0200, Andreas Müller wrote:
> Exiting postinst code leaves systemd.bbclass offline postinst code unexecuted,
> causes postinst not to finish at first boot (gdm.service is not aliased to
> display-manager.service -> started much too early) and is not neccesary:
> language preparation can be done offline.
> 
> Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
> ---
>  meta-gnome/recipes-gnome/gdm/gdm_2.32.2.bb |   31 ++++++++++-----------------
>  1 files changed, 12 insertions(+), 19 deletions(-)
> 
> diff --git a/meta-gnome/recipes-gnome/gdm/gdm_2.32.2.bb b/meta-gnome/recipes-gnome/gdm/gdm_2.32.2.bb
> index 1e55dd9..87efc28 100644
> --- a/meta-gnome/recipes-gnome/gdm/gdm_2.32.2.bb
> +++ b/meta-gnome/recipes-gnome/gdm/gdm_2.32.2.bb
> @@ -4,9 +4,9 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
>  
>  DEPENDS = "xinput gnome-panel tcp-wrappers libcanberra libxklavier grep consolekit libpam gnome-doc-utils gtk+ xrdb"
>  
> -PR = "r15"
> +PR = "r16"
>  
> -inherit gnome update-rc.d systemd
> +inherit gnome update-rc.d systemd useradd
>  
>  SRC_URI += " \
>              file://cross-xdetection.diff \
> @@ -33,8 +33,8 @@ do_configure_prepend() {
>  }
>  
>  do_install_prepend() {
> -    mkdir -p ${D}/var/lib/gdm/.gconf.mandatory
> -    cp ${WORKDIR}/%gconf-tree.xml ${D}/var/lib/gdm/.gconf.mandatory/
> +    install -d ${D}/${localstatedir}/lib/gdm/.gconf.mandatory
> +    install ${WORKDIR}/%gconf-tree.xml ${D}/${localstatedir}/lib/gdm/.gconf.mandatory/
>  }
>  
>  do_install_append() {
> @@ -54,6 +54,9 @@ do_install_append() {
>      sed -e 's,%sbindir%,${sbindir},g' \
>          < ${WORKDIR}/gdm.service.in \
>          > ${D}${systemd_unitdir}/system/gdm.service
> +
> +    chown -R gdm:gdm ${D}${localstatedir}/lib/gdm
> +    chmod 0750 ${D}${localstatedir}/lib/gdm
>  }
>  
>  FILES_${PN} += "${datadir}/icon* \
> @@ -72,23 +75,13 @@ SYSTEMD_SERVICE_${PN} = "gdm.service"
>  INITSCRIPT_NAME = "gdm"
>  INITSCRIPT_PARAMS = "start 99 5 2 . stop 20 0 1 6 ."
>  
> -pkg_postinst_${PN} () {
> -    # can't do this offline
> -    if [ "x$D" != "x" ]; then
> -        exit 1
> -    fi
> -    grep "^gdm:" /etc/group > /dev/null || addgroup gdm
> -    grep "^gdm:" /etc/passwd > /dev/null || adduser --disabled-password --system --home /var/lib/gdm gdm --ingroup gdm -g gdm
> -
> -if [ -d /var/lib/gdm ]; then
> -    chown -R gdm:gdm /var/lib/gdm
> -    chmod 0750 /var/lib/gdm
> -fi
> +USERADD_PACKAGES = "${PN}"
> +USERADD_PARAM_${PN} = "--system --no-create-home --home ${localstatedir}/lib/gdm --user-group gdm"
>  
> +pkg_postinst_${PN} () {
>  # Register up as default dm
> -mkdir -p ${sysconfdir}/X11/
> -echo "${bindir}/gdm" > ${sysconfdir}/X11/default-display-manager
> -
> +mkdir -p $D${sysconfdir}/X11/
> +echo "${bindir}/gdm" > $D${sysconfdir}/X11/default-display-manager

Maybe we should use u-a for default-display-manager like we use x-window-manager for WMs.

but git grep display-manager shows only
meta-oe/recipes-graphics/nonworking/slim/slim_1.3.2.bb
doing the same as gdm

>  }
>  
>  pkg_postrm_${PN} () {
> -- 
> 1.7.4.4
> 
> 
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
Andreas Müller - April 29, 2013, 7:33 a.m.
On Sat, Apr 27, 2013 at 9:31 PM, Martin Jansa <martin.jansa@gmail.com> wrote:
> On Sat, Apr 27, 2013 at 08:33:57PM +0200, Andreas Müller wrote:
>> Exiting postinst code leaves systemd.bbclass offline postinst code unexecuted,
>> causes postinst not to finish at first boot (gdm.service is not aliased to
>> display-manager.service -> started much too early) and is not neccesary:
>> language preparation can be done offline.
>>
>> Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
>> ---
>>  meta-gnome/recipes-gnome/gdm/gdm_2.32.2.bb |   31 ++++++++++-----------------
>>  1 files changed, 12 insertions(+), 19 deletions(-)
>>
>>
>> +pkg_postinst_${PN} () {
>>  # Register up as default dm
>> -mkdir -p ${sysconfdir}/X11/
>> -echo "${bindir}/gdm" > ${sysconfdir}/X11/default-display-manager
>> -
>> +mkdir -p $D${sysconfdir}/X11/
>> +echo "${bindir}/gdm" > $D${sysconfdir}/X11/default-display-manager
>
> Maybe we should use u-a for default-display-manager like we use x-window-manager for WMs.
>
> but git grep display-manager shows only
> meta-oe/recipes-graphics/nonworking/slim/slim_1.3.2.bb
> doing the same as gdm
>
Intention of this patch is fixing postinst failure. I have no idea
what this file is for. Can somebody give me a hint (is it required in
systemd environments?) and can we fix this in another series?
By the way: I am not using gdm. From what I have seen during tests for
this series it needs a lot more love to work as expected:
* gdm decides to put my standard user into the list of excluded users
so it is not displayed in the list and has to be entered manually.
* it is terribly slow
* the log files are full of different warnings - one thing I saw was
that polkit-gnome does not find its way into the image although it is
recommended

Andreas
Andreas Müller - May 2, 2013, 2:48 p.m.
On Mon, Apr 29, 2013 at 9:33 AM, Andreas Müller
<schnitzeltony@googlemail.com> wrote:
> On Sat, Apr 27, 2013 at 9:31 PM, Martin Jansa <martin.jansa@gmail.com> wrote:
>> On Sat, Apr 27, 2013 at 08:33:57PM +0200, Andreas Müller wrote:
>>> Exiting postinst code leaves systemd.bbclass offline postinst code unexecuted,
>>> causes postinst not to finish at first boot (gdm.service is not aliased to
>>> display-manager.service -> started much too early) and is not neccesary:
>>> language preparation can be done offline.
Just learned that the chown code does not belong to do_install. Shall
I send a V2 or a follow up?

Andreas
Andreas Müller - May 2, 2013, 2:58 p.m.
On Thu, May 2, 2013 at 4:48 PM, Andreas Müller
<schnitzeltony@googlemail.com> wrote:
> On Mon, Apr 29, 2013 at 9:33 AM, Andreas Müller
> <schnitzeltony@googlemail.com> wrote:
>> On Sat, Apr 27, 2013 at 9:31 PM, Martin Jansa <martin.jansa@gmail.com> wrote:
>>> On Sat, Apr 27, 2013 at 08:33:57PM +0200, Andreas Müller wrote:
>>>> Exiting postinst code leaves systemd.bbclass offline postinst code unexecuted,
>>>> causes postinst not to finish at first boot (gdm.service is not aliased to
>>>> display-manager.service -> started much too early) and is not neccesary:
>>>> language preparation can be done offline.
> Just learned that the chown code does not belong to do_install. Shall
> I send a V2 or a follow up?
I was too fast - it still discussed [1]

Andreas

[1] http://lists.linuxtogo.org/pipermail/openembedded-core/2013-May/039111.html
Martin Jansa - May 3, 2013, 11:35 a.m.
On Thu, May 02, 2013 at 04:58:13PM +0200, Andreas Müller wrote:
> On Thu, May 2, 2013 at 4:48 PM, Andreas Müller
> <schnitzeltony@googlemail.com> wrote:
> > On Mon, Apr 29, 2013 at 9:33 AM, Andreas Müller
> > <schnitzeltony@googlemail.com> wrote:
> >> On Sat, Apr 27, 2013 at 9:31 PM, Martin Jansa <martin.jansa@gmail.com> wrote:
> >>> On Sat, Apr 27, 2013 at 08:33:57PM +0200, Andreas Müller wrote:
> >>>> Exiting postinst code leaves systemd.bbclass offline postinst code unexecuted,
> >>>> causes postinst not to finish at first boot (gdm.service is not aliased to
> >>>> display-manager.service -> started much too early) and is not neccesary:
> >>>> language preparation can be done offline.
> > Just learned that the chown code does not belong to do_install. Shall
> > I send a V2 or a follow up?
> I was too fast - it still discussed [1]

Do you want me to apply these 4 and then add better fix in follow-up if
needed? From that discussion it looks like you did all what you could in 
gdm :).

> [1] http://lists.linuxtogo.org/pipermail/openembedded-core/2013-May/039111.html
> 
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
Andreas Müller - May 3, 2013, 11:44 a.m.
On Fri, May 3, 2013 at 1:35 PM, Martin Jansa <martin.jansa@gmail.com> wrote:
> On Thu, May 02, 2013 at 04:58:13PM +0200, Andreas Müller wrote:
>> On Thu, May 2, 2013 at 4:48 PM, Andreas Müller
>> <schnitzeltony@googlemail.com> wrote:
>> > On Mon, Apr 29, 2013 at 9:33 AM, Andreas Müller
>> > <schnitzeltony@googlemail.com> wrote:
>> >> On Sat, Apr 27, 2013 at 9:31 PM, Martin Jansa <martin.jansa@gmail.com> wrote:
>> >>> On Sat, Apr 27, 2013 at 08:33:57PM +0200, Andreas Müller wrote:
>> >>>> Exiting postinst code leaves systemd.bbclass offline postinst code unexecuted,
>> >>>> causes postinst not to finish at first boot (gdm.service is not aliased to
>> >>>> display-manager.service -> started much too early) and is not neccesary:
>> >>>> language preparation can be done offline.
>> > Just learned that the chown code does not belong to do_install. Shall
>> > I send a V2 or a follow up?
>> I was too fast - it still discussed [1]
>
> Do you want me to apply these 4 and then add better fix in follow-up if
> needed? From that discussion it looks like you did all what you could in
> gdm :).
Yes please - otherwise I'll loose overview of patches around :)

Andreas

Patch

diff --git a/meta-gnome/recipes-gnome/gdm/gdm_2.32.2.bb b/meta-gnome/recipes-gnome/gdm/gdm_2.32.2.bb
index 1e55dd9..87efc28 100644
--- a/meta-gnome/recipes-gnome/gdm/gdm_2.32.2.bb
+++ b/meta-gnome/recipes-gnome/gdm/gdm_2.32.2.bb
@@ -4,9 +4,9 @@  LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
 
 DEPENDS = "xinput gnome-panel tcp-wrappers libcanberra libxklavier grep consolekit libpam gnome-doc-utils gtk+ xrdb"
 
-PR = "r15"
+PR = "r16"
 
-inherit gnome update-rc.d systemd
+inherit gnome update-rc.d systemd useradd
 
 SRC_URI += " \
             file://cross-xdetection.diff \
@@ -33,8 +33,8 @@  do_configure_prepend() {
 }
 
 do_install_prepend() {
-    mkdir -p ${D}/var/lib/gdm/.gconf.mandatory
-    cp ${WORKDIR}/%gconf-tree.xml ${D}/var/lib/gdm/.gconf.mandatory/
+    install -d ${D}/${localstatedir}/lib/gdm/.gconf.mandatory
+    install ${WORKDIR}/%gconf-tree.xml ${D}/${localstatedir}/lib/gdm/.gconf.mandatory/
 }
 
 do_install_append() {
@@ -54,6 +54,9 @@  do_install_append() {
     sed -e 's,%sbindir%,${sbindir},g' \
         < ${WORKDIR}/gdm.service.in \
         > ${D}${systemd_unitdir}/system/gdm.service
+
+    chown -R gdm:gdm ${D}${localstatedir}/lib/gdm
+    chmod 0750 ${D}${localstatedir}/lib/gdm
 }
 
 FILES_${PN} += "${datadir}/icon* \
@@ -72,23 +75,13 @@  SYSTEMD_SERVICE_${PN} = "gdm.service"
 INITSCRIPT_NAME = "gdm"
 INITSCRIPT_PARAMS = "start 99 5 2 . stop 20 0 1 6 ."
 
-pkg_postinst_${PN} () {
-    # can't do this offline
-    if [ "x$D" != "x" ]; then
-        exit 1
-    fi
-    grep "^gdm:" /etc/group > /dev/null || addgroup gdm
-    grep "^gdm:" /etc/passwd > /dev/null || adduser --disabled-password --system --home /var/lib/gdm gdm --ingroup gdm -g gdm
-
-if [ -d /var/lib/gdm ]; then
-    chown -R gdm:gdm /var/lib/gdm
-    chmod 0750 /var/lib/gdm
-fi
+USERADD_PACKAGES = "${PN}"
+USERADD_PARAM_${PN} = "--system --no-create-home --home ${localstatedir}/lib/gdm --user-group gdm"
 
+pkg_postinst_${PN} () {
 # Register up as default dm
-mkdir -p ${sysconfdir}/X11/
-echo "${bindir}/gdm" > ${sysconfdir}/X11/default-display-manager
-
+mkdir -p $D${sysconfdir}/X11/
+echo "${bindir}/gdm" > $D${sysconfdir}/X11/default-display-manager
 }
 
 pkg_postrm_${PN} () {