All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rpm: Move postinsts to /var
@ 2012-01-03 18:48 Colin Walters
  2012-01-04  0:54   ` Saul Wold
  0 siblings, 1 reply; 5+ messages in thread
From: Colin Walters @ 2012-01-03 18:48 UTC (permalink / raw)
  To: poky

[-- 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-01-04 15:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-03 18:48 [PATCH] rpm: Move postinsts to /var Colin Walters
2012-01-04  0:54 ` [poky] " Saul Wold
2012-01-04  0:54   ` Saul Wold
2012-01-04  2:17   ` Colin Walters
2012-01-04 15:55     ` Mark Hatle

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.