Patchwork [V4,3/3] screen: dynamically add or remove a entry to/from /etc/shells

login
register
mail settings
Submitter Ming Liu
Date Oct. 20, 2013, 8:02 a.m.
Message ID <1382256149-14223-3-git-send-email-ming.liu@windriver.com>
Download mbox | patch
Permalink /patch/60259/
State Accepted
Commit e75ea493003d95ea39509eb83fc0ac610d4a2c82
Headers show

Comments

Ming Liu - Oct. 20, 2013, 8:02 a.m.
1 Add base-files to RDEPENDS.
2 Add pkg_postinst and pkg_postrm to add and remove a entry in
/etc/shells.

Signed-off-by: Ming Liu <ming.liu@windriver.com>
---
 meta/recipes-extended/screen/screen_4.0.3.bb | 10 ++++++++++
 1 file changed, 10 insertions(+)
Khem Raj - Oct. 21, 2013, 10:32 p.m.
On Sunday, October 20, 2013, Ming Liu <ming.liu@windriver.com> wrote:
> 1 Add base-files to RDEPENDS.
> 2 Add pkg_postinst and pkg_postrm to add and remove a entry in
> /etc/shells.
>

will it affect upgradability of the package which is providing /etc/shells ?

> Signed-off-by: Ming Liu <ming.liu@windriver.com>
> ---
>  meta/recipes-extended/screen/screen_4.0.3.bb | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/meta/recipes-extended/screen/screen_4.0.3.bbb/meta/recipes-extended/screen/
screen_4.0.3.bb
> index 1a7eb20..be42fb9 100644
> --- a/meta/recipes-extended/screen/screen_4.0.3.bb
> +++ b/meta/recipes-extended/screen/screen_4.0.3.bb
> @@ -12,6 +12,8 @@ LIC_FILES_CHKSUM =
"file://COPYING;md5=0774d66808b0f602e94448108f59448b \
>  SECTION = "console/utils"
>  DEPENDS = "ncurses \
>            ${@base_contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
> +RDEPENDS_${PN} = "base-files"
> +
>  PR = "r3"
>
>  SRC_URI = "${GNU_MIRROR}/screen/screen-${PV}.tar.gz;name=tarball \
> @@ -41,3 +43,11 @@ do_install_append () {
>                 fi
>         done
>  }
> +
> +pkg_postinst_${PN} () {
> +       grep -q "^${bindir}/screen$" $D${sysconfdir}/shells || echo
${bindir}/screen >> $D${sysconfdir}/shells
> +}
> +
> +pkg_postrm_${PN} () {
> +       printf "$(grep -v "^${bindir}/screen$" $D${sysconfdir}/shells)\n"
> $D${sysconfdir}/shells
> +}
> --
> 1.8.4.1
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
Ming Liu - Oct. 22, 2013, 2:12 a.m.
On 10/22/2013 06:32 AM, Khem Raj wrote:
>
>
> On Sunday, October 20, 2013, Ming Liu <ming.liu@windriver.com 
> <mailto:ming.liu@windriver.com>> wrote:
> > 1 Add base-files to RDEPENDS.
> > 2 Add pkg_postinst and pkg_postrm to add and remove a entry in
> > /etc/shells.
> >
>
> will it affect upgradability of the package which is providing 
> /etc/shells ?
Yes, you are right, it will. So we need put /etc/shells to CONFFILES in 
base-files package.

//Ming Liu

>
> > Signed-off-by: Ming Liu <ming.liu@windriver.com 
> <mailto:ming.liu@windriver.com>>
> > ---
> >  meta/recipes-extended/screen/screen_4.0.3.bb 
> <http://screen_4.0.3.bb> | 10 ++++++++++
> >  1 file changed, 10 insertions(+)
> >
> > diff --git a/meta/recipes-extended/screen/screen_4.0.3.bb 
> <http://screen_4.0.3.bb> 
> b/meta/recipes-extended/screen/screen_4.0.3.bb <http://screen_4.0.3.bb>
> > index 1a7eb20..be42fb9 100644
> > --- a/meta/recipes-extended/screen/screen_4.0.3.bb 
> <http://screen_4.0.3.bb>
> > +++ b/meta/recipes-extended/screen/screen_4.0.3.bb 
> <http://screen_4.0.3.bb>
> > @@ -12,6 +12,8 @@ LIC_FILES_CHKSUM = 
> "file://COPYING;md5=0774d66808b0f602e94448108f59448b \
> >  SECTION = "console/utils"
> >  DEPENDS = "ncurses \
> >            ${@base_contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
> > +RDEPENDS_${PN} = "base-files"
> > +
> >  PR = "r3"
> >
> >  SRC_URI = "${GNU_MIRROR}/screen/screen-${PV}.tar.gz;name=tarball \
> > @@ -41,3 +43,11 @@ do_install_append () {
> >                 fi
> >         done
> >  }
> > +
> > +pkg_postinst_${PN} () {
> > +       grep -q "^${bindir}/screen$" $D${sysconfdir}/shells || echo 
> ${bindir}/screen >> $D${sysconfdir}/shells
> > +}
> > +
> > +pkg_postrm_${PN} () {
> > +       printf "$(grep -v "^${bindir}/screen$" 
> $D${sysconfdir}/shells)\n" > $D${sysconfdir}/shells
> > +}
> > --
> > 1.8.4.1
> >
> > _______________________________________________
> > Openembedded-core mailing list
> > Openembedded-core@lists.openembedded.org 
> <mailto:Openembedded-core@lists.openembedded.org>
> > http://lists.openembedded.org/mailman/listinfo/openembedded-core
> >

Patch

diff --git a/meta/recipes-extended/screen/screen_4.0.3.bb b/meta/recipes-extended/screen/screen_4.0.3.bb
index 1a7eb20..be42fb9 100644
--- a/meta/recipes-extended/screen/screen_4.0.3.bb
+++ b/meta/recipes-extended/screen/screen_4.0.3.bb
@@ -12,6 +12,8 @@  LIC_FILES_CHKSUM = "file://COPYING;md5=0774d66808b0f602e94448108f59448b \
 SECTION = "console/utils"
 DEPENDS = "ncurses \
           ${@base_contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
+RDEPENDS_${PN} = "base-files"
+
 PR = "r3"
 
 SRC_URI = "${GNU_MIRROR}/screen/screen-${PV}.tar.gz;name=tarball \
@@ -41,3 +43,11 @@  do_install_append () {
 		fi
 	done
 }
+
+pkg_postinst_${PN} () {
+	grep -q "^${bindir}/screen$" $D${sysconfdir}/shells || echo ${bindir}/screen >> $D${sysconfdir}/shells
+}
+
+pkg_postrm_${PN} () {
+	printf "$(grep -v "^${bindir}/screen$" $D${sysconfdir}/shells)\n" > $D${sysconfdir}/shells
+}