Skip to contentSkip to conversation

base-files: move shells generating process to pkg_postinst

PATCH Superseded Ming Liu 2 participants 4 messages Oct 17, 2013

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Ming Liu

author
#0 lore raw

PATCH 1/2 base-files: move shells generating process to pkg_postinst

The "shells" file lists several valid login shells, of which some might be not present in a particular rootfs, this is unreasonable.

Fix it by moving "shells" file generating process to pkg_postinst, for other shells must do the same thing to register themselves to this file.

---
 meta/recipes-core/base-files/base-files/shells    | 8 --------
 meta/recipes-core/base-files/base-files_3.0.14.bb | 8 ++++++--
 2 files changed, 6 insertions(+), 10 deletions(-)
 delete mode 100644 meta/recipes-core/base-files/base-files/shells
meta/recipes-core/base-files/base-files/shells deleted +0 -8
deleted file mode 100644
index ce39b3d..0000000
@@ -1,8 +0,0 @@
-# /etc/shells: valid login shells
-/bin/sh
-/bin/ash
-/bin/bash
-/bin/dash
-/bin/ksh
-/usr/bin/ksh
-/usr/bin/screen
meta/recipes-core/base-files/base-files_3.0.14.bb +6 -2
index 054fefa..47c7ebe 100644
@@ -16,7 +16,6 @@ SRC_URI = "file://rotation \
            file://inputrc \
            file://host.conf \
            file://profile \
-           file://shells \
            file://fstab \
            file://filesystems \
            file://issue.net \
@@ -92,7 +91,6 @@ do_install () {
 	install -m 0644 ${WORKDIR}/usbd ${D}${sysconfdir}/default/usbd
 	sed -i "s#ROOTHOME#${ROOT_HOME}#" ${WORKDIR}/profile
 	install -m 0644 ${WORKDIR}/profile ${D}${sysconfdir}/profile
-	install -m 0644 ${WORKDIR}/shells ${D}${sysconfdir}/shells
 	install -m 0755 ${WORKDIR}/share/dot.profile ${D}${sysconfdir}/skel/.profile
 	install -m 0755 ${WORKDIR}/share/dot.bashrc ${D}${sysconfdir}/skel/.bashrc
 	install -m 0644 ${WORKDIR}/inputrc ${D}${sysconfdir}/inputrc
@@ -137,6 +135,12 @@ do_install_append_linuxstdbase() {
         done
 }
 
+pkg_postinst_${PN} () {
+        touch $D${sysconfdir}/shells
+        grep -q "bin/sh" $D${sysconfdir}/shells || echo /bin/sh >> $D${sysconfdir}/shells
+}
+
+
 PACKAGES = "${PN}-doc ${PN} ${PN}-dev ${PN}-dbg"
 FILES_${PN} = "/"
 FILES_${PN}-doc = "${docdir} ${datadir}/common-licenses"
Signature · 1 line
1.8.3.3
author
#1 lore raw

PATCH 2/2 screen: add pkg_postinst to register entry to /etc/shells

---
 meta/recipes-extended/screen/screen_4.0.3.bb | 5 +++++
 1 file changed, 5 insertions(+)
meta/recipes-extended/screen/screen_4.0.3.bb +5 -0
index 1a7eb20..81e418b 100644
@@ -41,3 +41,8 @@ do_install_append () {
 		fi
 	done
 }
+
+pkg_postinst_${PN} () {
+	touch $D${sysconfdir}/shells
+	grep -q "${bindir}/screen" $D${sysconfdir}/shells || echo ${bindir}/screen >> $D${sysconfdir}/shells
+}
Signature · 1 line
1.8.3.3
#2 lore raw
In reply to Ming Liu
Quoted 48 lines · Ming Liu

The "shells" file lists several valid login shells, of which some might be not present in a particular rootfs, this is unreasonable.

Fix it by moving "shells" file generating process to pkg_postinst, for other shells must do the same thing to register themselves to this file.

---
 meta/recipes-core/base-files/base-files/shells    | 8 --------
 meta/recipes-core/base-files/base-files_3.0.14.bb | 8 ++++++--
 2 files changed, 6 insertions(+), 10 deletions(-)
 delete mode 100644 meta/recipes-core/base-files/base-files/shells
meta/recipes-core/base-files/base-files/shells deleted +0 -8
deleted file mode 100644
index ce39b3d..0000000
@@ -1,8 +0,0 @@
-# /etc/shells: valid login shells
-/bin/sh
-/bin/ash
-/bin/bash
-/bin/dash
-/bin/ksh
-/usr/bin/ksh
-/usr/bin/screen
meta/recipes-core/base-files/base-files_3.0.14.bb +0 -2
index 054fefa..47c7ebe 100644
@@ -16,7 +16,6 @@ SRC_URI = "file://rotation \
            file://inputrc \
            file://host.conf \
            file://profile \
-           file://shells \
            file://fstab \
            file://filesystems \
            file://issue.net \
@@ -92,7 +91,6 @@ do_install () {
 	install -m 0644 ${WORKDIR}/usbd ${D}${sysconfdir}/default/usbd
 	sed -i "s#ROOTHOME#${ROOT_HOME}#" ${WORKDIR}/profile
 	install -m 0644 ${WORKDIR}/profile ${D}${sysconfdir}/profile
-	install -m 0644 ${WORKDIR}/shells ${D}${sysconfdir}/shells
 	install -m 0755 ${WORKDIR}/share/dot.profile ${D}${sysconfdir}/skel/.profile
 	install -m 0755 ${WORKDIR}/share/dot.bashrc ${D}${sysconfdir}/skel/.bashrc
 	install -m 0644 ${WORKDIR}/inputrc ${D}${sysconfdir}/inputrc

meta/recipes-core/base-files/base-files_3.0.14.bb do_install_append_linuxstdbase() { · line 140

Quoted 6 lines
meta/recipes-core/base-files/base-files_3.0.14.bb +3 -0
@@ -137,6 +135,12 @@ do_install_append_linuxstdbase() {
         done
 }
 
+pkg_postinst_${PN} () {
+        touch $D${sysconfdir}/shells
+        grep -q "bin/sh" $D${sysconfdir}/shells || echo /bin/sh >> $D${sysconfdir}/shells

What it someone installs component providing /usr/bin/shell? Use at least ^/bin/sh$ in grep.

Quoted 13 lines
meta/recipes-core/base-files/base-files_3.0.14.bb +3 -0
+}
+
+
 PACKAGES = "${PN}-doc ${PN} ${PN}-dev ${PN}-dbg"
 FILES_${PN} = "/"
 FILES_${PN}-doc = "${docdir} ${datadir}/common-licenses"
Signature · 6 lines
1.8.3.3

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
author
#3 lore raw
Quoted 52 lines · Martin Jansa
Quoted 51 lines · Ming Liu

The "shells" file lists several valid login shells, of which some might be not present in a particular rootfs, this is unreasonable.

Fix it by moving "shells" file generating process to pkg_postinst, for other shells must do the same thing to register themselves to this file.

---
  meta/recipes-core/base-files/base-files/shells    | 8 --------
  meta/recipes-core/base-files/base-files_3.0.14.bb | 8 ++++++--
  2 files changed, 6 insertions(+), 10 deletions(-)

delete mode 100644 meta/recipes-core/base-files/base-files/shells

meta/recipes-core/base-files/base-files/shells deleted +0 -8
deleted file mode 100644
index ce39b3d..0000000
@@ -1,8 +0,0 @@
-# /etc/shells: valid login shells
-/bin/sh
-/bin/ash
-/bin/bash
-/bin/dash
-/bin/ksh
-/usr/bin/ksh
-/usr/bin/screen
meta/recipes-core/base-files/base-files_3.0.14.bb +0 -2
index 054fefa..47c7ebe 100644
@@ -16,7 +16,6 @@ SRC_URI = "file://rotation \
             file://inputrc \
             file://host.conf \
             file://profile \
-           file://shells \
             file://fstab \
             file://filesystems \
             file://issue.net \
@@ -92,7 +91,6 @@ do_install () {
  	install -m 0644 ${WORKDIR}/usbd ${D}${sysconfdir}/default/usbd
  	sed -i "s#ROOTHOME#${ROOT_HOME}#" ${WORKDIR}/profile
  	install -m 0644 ${WORKDIR}/profile ${D}${sysconfdir}/profile
-	install -m 0644 ${WORKDIR}/shells ${D}${sysconfdir}/shells
  	install -m 0755 ${WORKDIR}/share/dot.profile ${D}${sysconfdir}/skel/.profile
  	install -m 0755 ${WORKDIR}/share/dot.bashrc ${D}${sysconfdir}/skel/.bashrc
  	install -m 0644 ${WORKDIR}/inputrc ${D}${sysconfdir}/inputrc
@@ -137,6 +135,12 @@ do_install_append_linuxstdbase() {
          done
  }
 
Quoted 5 lines

meta/recipes-core/base-files/base-files_3.0.14.bb do_install_append_linuxstdbase() { · line 140

Quoted 3 lines
meta/recipes-core/base-files/base-files_3.0.14.bb +3 -0
+pkg_postinst_${PN} () {
+        touch $D${sysconfdir}/shells
+        grep -q "bin/sh" $D${sysconfdir}/shells || echo /bin/sh >> $D${sysconfdir}/shells

What it someone installs component providing /usr/bin/shell? Use at least ^/bin/sh$ in grep.

OK, better to be precise. I will send V2.

the best,
thank you

Quoted 14 lines
Quoted 14 lines
meta/recipes-core/base-files/base-files_3.0.14.bb +3 -0
+}
+
+
  PACKAGES = "${PN}-doc ${PN} ${PN}-dev ${PN}-dbg"
  FILES_${PN} = "/"
  FILES_${PN}-doc = "${docdir} ${datadir}/common-licenses"
Signature · 6 lines
1.8.3.3

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core