* [PATCH] initscripts: Create the volatiles cache atomically.
@ 2012-02-29 1:13 James Limbouris
2012-03-02 15:22 ` Richard Purdie
0 siblings, 1 reply; 2+ messages in thread
From: James Limbouris @ 2012-02-29 1:13 UTC (permalink / raw)
To: openembedded-core
If a machine loses power while building the volatiles cache, it will
continue to operate with an incomplete set of volatiles. Fix this by
updating atomically.
Signed-off-by: James Limbouris <james@digitalmatter.com.au>
---
.../initscripts-1.0/populate-volatile.sh | 10 ++++++----
meta/recipes-core/initscripts/initscripts_1.0.bb | 2 +-
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh b/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
index 1813fd1..4a99aff 100755
--- a/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
@@ -22,7 +22,7 @@ create_file() {
chown ${TUSER}.${TGROUP} $1 || echo \"Failed to set owner -${TUSER}- for -$1-.\" >/dev/tty0 2>&1;
chmod ${TMODE} $1 || echo \"Failed to set mode -${TMODE}- for -$1-.\" >/dev/tty0 2>&1 "
- test "$VOLATILE_ENABLE_CACHE" = yes && echo "$EXEC" >> /etc/volatile.cache
+ test "$VOLATILE_ENABLE_CACHE" = yes && echo "$EXEC" >> /etc/volatile.cache.build
[ -e "$1" ] && {
[ "${VERBOSE}" != "no" ] && echo "Target already exists. Skipping."
@@ -37,7 +37,7 @@ mk_dir() {
chown ${TUSER}.${TGROUP} $1 || echo \"Failed to set owner -${TUSER}- for -$1-.\" >/dev/tty0 2>&1;
chmod ${TMODE} $1 || echo \"Failed to set mode -${TMODE}- for -$1-.\" >/dev/tty0 2>&1 "
- test "$VOLATILE_ENABLE_CACHE" = yes && echo "$EXEC" >> /etc/volatile.cache
+ test "$VOLATILE_ENABLE_CACHE" = yes && echo "$EXEC" >> /etc/volatile.cache.build
[ -e "$1" ] && {
[ "${VERBOSE}" != "no" ] && echo "Target already exists. Skipping."
@@ -49,7 +49,7 @@ mk_dir() {
link_file() {
EXEC="test -e \"$2\" -o -L $2 || ln -s \"$1\" \"$2\" >/dev/tty0 2>&1"
- test "$VOLATILE_ENABLE_CACHE" = yes && echo " $EXEC" >> /etc/volatile.cache
+ test "$VOLATILE_ENABLE_CACHE" = yes && echo " $EXEC" >> /etc/volatile.cache.build
[ -e "$2" ] && {
echo "Cannot create link over existing -${TNAME}-." >&2
@@ -185,10 +185,12 @@ if test -e /etc/volatile.cache -a "$VOLATILE_ENABLE_CACHE" = "yes" -a "x$1" != "
then
sh /etc/volatile.cache
else
- rm -f /etc/volatile.cache
+ rm -f /etc/volatile.cache /etc/volatile.cache.build
for file in `ls -1 "${CFGDIR}" | sort`; do
apply_cfgfile "${CFGDIR}/${file}"
done
+
+ [ -e /etc/volatile.cache.build ] && sync && mv /etc/volatile.cache.build /etc/volatile.cache
fi
if test -f /etc/ld.so.cache -a ! -f /var/run/ld.so.cache
diff --git a/meta/recipes-core/initscripts/initscripts_1.0.bb b/meta/recipes-core/initscripts/initscripts_1.0.bb
index e16f19f..68701ce 100644
--- a/meta/recipes-core/initscripts/initscripts_1.0.bb
+++ b/meta/recipes-core/initscripts/initscripts_1.0.bb
@@ -3,7 +3,7 @@ DESCRIPTION = "Initscripts provide the basic system startup initialization scrip
SECTION = "base"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
-PR = "r131"
+PR = "r132"
INHIBIT_DEFAULT_DEPS = "1"
--
1.7.3.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] initscripts: Create the volatiles cache atomically.
2012-02-29 1:13 [PATCH] initscripts: Create the volatiles cache atomically James Limbouris
@ 2012-03-02 15:22 ` Richard Purdie
0 siblings, 0 replies; 2+ messages in thread
From: Richard Purdie @ 2012-03-02 15:22 UTC (permalink / raw)
To: Patches and discussions about the oe-core layer
On Wed, 2012-02-29 at 09:13 +0800, James Limbouris wrote:
> If a machine loses power while building the volatiles cache, it will
> continue to operate with an incomplete set of volatiles. Fix this by
> updating atomically.
>
> Signed-off-by: James Limbouris <james@digitalmatter.com.au>
> ---
> .../initscripts-1.0/populate-volatile.sh | 10 ++++++----
> meta/recipes-core/initscripts/initscripts_1.0.bb | 2 +-
> 2 files changed, 7 insertions(+), 5 deletions(-)
Merged to master, thanks.
Richard
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-03-02 15:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-29 1:13 [PATCH] initscripts: Create the volatiles cache atomically James Limbouris
2012-03-02 15:22 ` Richard Purdie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox