From: Colin Walters <walters@verbum.org>
To: poky <poky@yoctoproject.org>
Subject: [PATCH] rpm: Move postinsts to /var
Date: Tue, 03 Jan 2012 13:48:53 -0500 [thread overview]
Message-ID: <1325616533.23339.10.camel@lenny> (raw)
[-- Attachment #1: Type: text/plain, Size: 257 bytes --]
My OS has read-only bind mounts over most directories (including
/etc), with the exception of /var. Since these scripts need to
be run once and then deleted, it's better for me if these are in
/var, and won't hurt anyone else for them to be there.
[-- Attachment #2: 0001-rpm-Move-postinsts-to-var.patch --]
[-- Type: text/x-patch, Size: 2905 bytes --]
From 529d2e5e193c82ddb1e4bee57c650b07cf844ce5 Mon Sep 17 00:00:00 2001
From: Colin Walters <walters@verbum.org>
Date: Tue, 3 Jan 2012 13:45:38 -0500
Subject: [PATCH] rpm: Move postinsts to /var
My OS has read-only bind mounts over most directories (including
/etc), with the exception of /var. Since these scripts need to be run
once and then deleted, it's better for me if these are in /var, and
won't hurt anyone else for them to be there.
Signed-off-by: Colin Walters <walters@verbum.org>
---
meta/classes/package_rpm.bbclass | 12 ++++++------
meta/classes/rootfs_rpm.bbclass | 19 +++++++++++--------
2 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index 2ace053..094571b 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -394,13 +394,13 @@ export OPKG_OFFLINE_ROOT="\$D"
\$2 \$1/\$3 \$4
if [ \$? -ne 0 ]; then
- mkdir -p \$1/etc/rpm-postinsts
+ mkdir -p \$1/var/rpm-postinsts
num=100
- while [ -e \$1/etc/rpm-postinsts/\${num} ]; do num=\$((num + 1)); done
- echo "#!\$2" > \$1/etc/rpm-postinsts/\${num}
- echo "# Arg: \$4" >> \$1/etc/rpm-postinsts/\${num}
- cat \$1/\$3 >> \$1/etc/rpm-postinsts/\${num}
- chmod +x \$1/etc/rpm-postinsts/\${num}
+ while [ -e \$1/var/rpm-postinsts/\${num} ]; do num=\$((num + 1)); done
+ echo "#!\$2" > \$1/var/rpm-postinsts/\${num}
+ echo "# Arg: \$4" >> \$1/var/rpm-postinsts/\${num}
+ cat \$1/\$3 >> \$1/var/rpm-postinsts/\${num}
+ chmod +x \$1/var/rpm-postinsts/\${num}
fi
EOF
diff --git a/meta/classes/rootfs_rpm.bbclass b/meta/classes/rootfs_rpm.bbclass
index 6973008..3a583df 100644
--- a/meta/classes/rootfs_rpm.bbclass
+++ b/meta/classes/rootfs_rpm.bbclass
@@ -107,7 +107,7 @@ EOF
${ROOTFS_POSTINSTALL_COMMAND}
# Report delayed package scriptlets
- for i in ${IMAGE_ROOTFS}/etc/rpm-postinsts/*; do
+ for i in ${IMAGE_ROOTFS}/var/rpm-postinsts/*; do
echo "Delayed package scriptlet: `head -n 3 $i | tail -n 1`"
done
@@ -116,15 +116,18 @@ EOF
i=\$i
cat > ${IMAGE_ROOTFS}${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}configure << EOF
#!/bin/sh
-for i in /etc/rpm-postinsts/*; do
- echo "Running postinst $i..."
- if [ -f $i ] && $i; then
- rm $i
- else
- echo "ERROR: postinst $i failed."
+for i in /var/rpm-postinsts/*; do
+ if [ -f $i ]; then
+ echo "Running postinst $i..."
+ if $i; then
+ rm -f $i
+ else
+ echo "ERROR: postinst $i failed."
+ fi
fi
done
-rm -f ${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}configure
+# Don't show any errors if this fails, e.g. due to /etc being a readonly bind mount
+rm -f ${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}configure 2>/dev/null
EOF
chmod 0755 ${IMAGE_ROOTFS}${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}configure
--
1.7.6.4
next reply other threads:[~2012-01-03 18:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-03 18:48 Colin Walters [this message]
2012-01-04 0:54 ` [poky] [PATCH] rpm: Move postinsts to /var Saul Wold
2012-01-04 0:54 ` Saul Wold
2012-01-04 2:17 ` Colin Walters
2012-01-04 15:55 ` Mark Hatle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1325616533.23339.10.camel@lenny \
--to=walters@verbum.org \
--cc=poky@yoctoproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.