Patchwork [2/4] rpm-postinsts: avoid errors during boot with read-only-rootfs enabled

login
register
mail settings
Submitter Paul Eggleton
Date April 10, 2013, 3:42 p.m.
Message ID <57d1ea9b66763521113f063e3f3f0b10817dd695.1365608262.git.paul.eggleton@linux.intel.com>
Download mbox | patch
Permalink /patch/47833/
State Accepted
Commit cf569f5def877b792a873e6612d26affbd480436
Headers show

Comments

Paul Eggleton - April 10, 2013, 3:42 p.m.
* If /etc/rpm-postinsts doesn't exist, don't error
* If deleting the script errors, don't bother printing it (this will
  always happen if the root filesystem is read-only)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 meta/recipes-devtools/rpm/rpm-postinsts.bb |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Patch

diff --git a/meta/recipes-devtools/rpm/rpm-postinsts.bb b/meta/recipes-devtools/rpm/rpm-postinsts.bb
index 0a62da0..fb05ad6 100644
--- a/meta/recipes-devtools/rpm/rpm-postinsts.bb
+++ b/meta/recipes-devtools/rpm/rpm-postinsts.bb
@@ -32,7 +32,10 @@  do_install() {
 	i=\$i
 	cat > ${D}${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts << EOF
 #!/bin/sh
-for i in \`ls /etc/rpm-postinsts/\`; do
+
+. /etc/default/rcS
+
+[ -d /etc/rpm-postinsts ] && for i in \`ls /etc/rpm-postinsts/ \`; do
 	i=/etc/rpm-postinsts/$i
 	echo "Running postinst $i..."
 	if [ -f $i ] && $i ${REDIRECT_CMD}; then
@@ -41,7 +44,7 @@  for i in \`ls /etc/rpm-postinsts/\`; do
 		echo "ERROR: postinst $i failed."
 	fi
 done
-rm -f ${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts
+rm -f ${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts 2>/dev/null
 EOF
 	chmod 0755 ${D}${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts
 }