* [PATCH V4 1/3] base-files: remove invalid entries from /etc/shells
@ 2013-10-20 8:02 Ming Liu
2013-10-20 8:02 ` [PATCH V4 2/3] bash: dynamically add or remove a entry to/from /etc/shells Ming Liu
2013-10-20 8:02 ` [PATCH V4 3/3] screen: " Ming Liu
0 siblings, 2 replies; 5+ messages in thread
From: Ming Liu @ 2013-10-20 8:02 UTC (permalink / raw)
To: openembedded-core
It's more reasonable and secure to keep /etc/shells a minimal file, and
then entries for valid shells be added dynamically to the system, only if
the packages that provide them are supported.
Signed-off-by: Ming Liu <ming.liu@windriver.com>
---
meta/recipes-core/base-files/base-files/shells | 6 ------
1 file changed, 6 deletions(-)
diff --git a/meta/recipes-core/base-files/base-files/shells b/meta/recipes-core/base-files/base-files/shells
index ce39b3d..3f63987 100644
--- a/meta/recipes-core/base-files/base-files/shells
+++ b/meta/recipes-core/base-files/base-files/shells
@@ -1,8 +1,2 @@
# /etc/shells: valid login shells
/bin/sh
-/bin/ash
-/bin/bash
-/bin/dash
-/bin/ksh
-/usr/bin/ksh
-/usr/bin/screen
--
1.8.4.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH V4 2/3] bash: dynamically add or remove a entry to/from /etc/shells
2013-10-20 8:02 [PATCH V4 1/3] base-files: remove invalid entries from /etc/shells Ming Liu
@ 2013-10-20 8:02 ` Ming Liu
2013-10-20 8:02 ` [PATCH V4 3/3] screen: " Ming Liu
1 sibling, 0 replies; 5+ messages in thread
From: Ming Liu @ 2013-10-20 8:02 UTC (permalink / raw)
To: openembedded-core
1 Add base-files to RDEPENDS.
2 Use ${base_bindir} in regex to match bash path.
3 Add pkg_postrm to remove the entry from /etc/shells that added by
pkg_postinst.
Signed-off-by: Ming Liu <ming.liu@windriver.com>
---
meta/recipes-extended/bash/bash.inc | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/meta/recipes-extended/bash/bash.inc b/meta/recipes-extended/bash/bash.inc
index 64b476f..99875bf 100644
--- a/meta/recipes-extended/bash/bash.inc
+++ b/meta/recipes-extended/bash/bash.inc
@@ -17,6 +17,8 @@ ALTERNATIVE_PRIORITY = "100"
export AUTOHEADER = "true"
+RDEPENDS_${PN} += "base-files"
+RDEPENDS_${PN}_class-nativesdk = ""
RDEPENDS_${PN}-ptest += "make"
do_configure_prepend () {
@@ -44,7 +46,9 @@ do_install_ptest () {
}
pkg_postinst_${PN} () {
- touch $D${sysconfdir}/shells
- grep -q "bin/bash" $D${sysconfdir}/shells || echo /bin/bash >> $D${sysconfdir}/shells
- grep -q "bin/sh" $D${sysconfdir}/shells || echo /bin/sh >> $D${sysconfdir}/shells
+ grep -q "^${base_bindir}/bash$" $D${sysconfdir}/shells || echo ${base_bindir}/bash >> $D${sysconfdir}/shells
+}
+
+pkg_postrm_${PN} () {
+ printf "$(grep -v "^${base_bindir}/bash$" $D${sysconfdir}/shells)\n" > $D${sysconfdir}/shells
}
--
1.8.4.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH V4 3/3] screen: dynamically add or remove a entry to/from /etc/shells
2013-10-20 8:02 [PATCH V4 1/3] base-files: remove invalid entries from /etc/shells Ming Liu
2013-10-20 8:02 ` [PATCH V4 2/3] bash: dynamically add or remove a entry to/from /etc/shells Ming Liu
@ 2013-10-20 8:02 ` Ming Liu
2013-10-21 22:32 ` Khem Raj
1 sibling, 1 reply; 5+ messages in thread
From: Ming Liu @ 2013-10-20 8:02 UTC (permalink / raw)
To: openembedded-core
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(+)
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
+}
--
1.8.4.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH V4 3/3] screen: dynamically add or remove a entry to/from /etc/shells
2013-10-20 8:02 ` [PATCH V4 3/3] screen: " Ming Liu
@ 2013-10-21 22:32 ` Khem Raj
2013-10-22 2:12 ` Ming Liu
0 siblings, 1 reply; 5+ messages in thread
From: Khem Raj @ 2013-10-21 22:32 UTC (permalink / raw)
To: Ming Liu; +Cc: openembedded-core@lists.openembedded.org
[-- Attachment #1: Type: text/plain, Size: 1642 bytes --]
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
>
[-- Attachment #2: Type: text/html, Size: 2458 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V4 3/3] screen: dynamically add or remove a entry to/from /etc/shells
2013-10-21 22:32 ` Khem Raj
@ 2013-10-22 2:12 ` Ming Liu
0 siblings, 0 replies; 5+ messages in thread
From: Ming Liu @ 2013-10-22 2:12 UTC (permalink / raw)
To: Khem Raj; +Cc: openembedded-core@lists.openembedded.org
[-- Attachment #1: Type: text/plain, Size: 2176 bytes --]
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
> >
[-- Attachment #2: Type: text/html, Size: 3912 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-10-22 2:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-20 8:02 [PATCH V4 1/3] base-files: remove invalid entries from /etc/shells Ming Liu
2013-10-20 8:02 ` [PATCH V4 2/3] bash: dynamically add or remove a entry to/from /etc/shells Ming Liu
2013-10-20 8:02 ` [PATCH V4 3/3] screen: " Ming Liu
2013-10-21 22:32 ` Khem Raj
2013-10-22 2:12 ` Ming Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox