* [PATCH] image-prelink: remove assumption of sysconfdir presence
@ 2020-03-10 21:55 christopher.w.clark
0 siblings, 0 replies; only message in thread
From: christopher.w.clark @ 2020-03-10 21:55 UTC (permalink / raw)
To: openembedded-core
From: Christopher Clark <christopher.w.clark@gmail.com>
If sysconfdir is not present in the image filesystem then the temporary
creation of a prelink.conf will fail. Fix this by creating sysconfdir
temporarily if needed beforehand and then remove any directories that
were created afterwards.
fixes: OpenXT OXT-1751
Signed-off-by: Christopher Clark <christopher.w.clark@gmail.com>
---
meta/classes/image-prelink.bbclass | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/meta/classes/image-prelink.bbclass b/meta/classes/image-prelink.bbclass
index 04dd57c940..ebf6e6d7ee 100644
--- a/meta/classes/image-prelink.bbclass
+++ b/meta/classes/image-prelink.bbclass
@@ -17,6 +17,16 @@ prelink_image () {
pre_prelink_size=`du -ks ${IMAGE_ROOTFS} | awk '{size = $1 ; print size }'`
echo "Size before prelinking $pre_prelink_size."
+ # The filesystem may not contain sysconfdir so establish what is present
+ # to enable cleanup after temporary creation of sysconfdir if needed
+ presentdir="${IMAGE_ROOTFS}${sysconfdir}"
+ while [ "${IMAGE_ROOTFS}" != "${presentdir}" ] ; do
+ [ ! -d "${presentdir}" ] || break
+ presentdir=`dirname "${presentdir}"`
+ done
+
+ mkdir -p "${IMAGE_ROOTFS}${sysconfdir}"
+
# We need a prelink conf on the filesystem, add one if it's missing
if [ ! -e ${IMAGE_ROOTFS}${sysconfdir}/prelink.conf ]; then
cp ${STAGING_ETCDIR_NATIVE}/prelink.conf \
@@ -59,6 +69,13 @@ prelink_image () {
rm $ldsoconf
fi
+ # Remove any directories temporarily created for sysconfdir
+ cleanupdir="${IMAGE_ROOTFS}${sysconfdir}"
+ while [ "${presentdir}" != "${cleanupdir}" ] ; do
+ rmdir "${cleanupdir}"
+ cleanupdir=`dirname ${cleanupdir}`
+ done
+
pre_prelink_size=`du -ks ${IMAGE_ROOTFS} | awk '{size = $1 ; print size }'`
echo "Size after prelinking $pre_prelink_size."
}
--
2.17.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2020-03-10 21:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-10 21:55 [PATCH] image-prelink: remove assumption of sysconfdir presence christopher.w.clark
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.