* [PATCH] initscripts: Populate volatile from existing file
@ 2017-06-02 15:16 David Vincent
0 siblings, 0 replies; 3+ messages in thread
From: David Vincent @ 2017-06-02 15:16 UTC (permalink / raw)
To: openembedded-core
In some cases, it may be useful to populate a volatile file from an
existing one, e.g. a file in a read-only rootfs that may be edited in a
read-write destination.
To provide this behavior, creation of volatile files has been updated to
copy a file which has been given in the <linksource> field. If set to
none, the current behavior is preserved.
Signed-off-by: David Vincent <freesilicon@gmail.com>
---
.../initscripts/initscripts-1.0/populate-volatile.sh | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 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 22a71ecaae..35316ec2ba 100755
--- a/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
@@ -25,8 +25,18 @@ COREDEF="00_core"
[ "${VERBOSE}" != "no" ] && echo "Populating volatile Filesystems."
create_file() {
+ EXEC=""
+ [ -z "$2" ] && {
+ EXEC="
+ touch \"$1\";
+ "
+ } || {
+ EXEC="
+ cp \"$2\" \"$1\";
+ "
+ }
EXEC="
- touch \"$1\";
+ ${EXEC}
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 "
@@ -187,7 +197,9 @@ apply_cfgfile() {
case "${TTYPE}" in
"f") [ "${VERBOSE}" != "no" ] && echo "Creating file -${TNAME}-."
- create_file "${TNAME}"
+ TSOURCE="$TLTARGET"
+ [ "${TSOURCE}" = "none" ] && TSOURCE=""
+ create_file "${TNAME}" "${TSOURCE}" &
;;
"d") [ "${VERBOSE}" != "no" ] && echo "Creating directory -${TNAME}-."
mk_dir "${TNAME}"
--
2.13.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] initscripts: Populate volatile from existing file
@ 2017-03-06 8:51 David Vincent
0 siblings, 0 replies; 3+ messages in thread
From: David Vincent @ 2017-03-06 8:51 UTC (permalink / raw)
To: openembedded-core
Ping
---------- Forwarded Message ----------
Subject: [PATCH] initscripts: Populate volatile from existing file
Date: mercredi 25 janvier 2017, 12:35:52 CET
From: David Vincent <freesilicon@gmail.com>
To: openembedded-core@lists.openembedded.org
CC: David Vincent <freesilicon@gmail.com>
In some cases, it may be useful to populate a volatile file from an
existing one, e.g. a file in a read-only rootfs that may be edited in a
read-write destination.
To provide this behavior, creation of volatile files has been updated to
copy a file which has been given in the <linksource> field. If set to
none, the current behavior is preserved.
Signed-off-by: David Vincent <freesilicon@gmail.com>
---
.../initscripts/initscripts-1.0/populate-volatile.sh | 16 +++++++++++++
+--
1 file changed, 14 insertions(+), 2 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 22a71ecaae..35316ec2ba 100755
--- a/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
@@ -25,8 +25,18 @@ COREDEF="00_core"
[ "${VERBOSE}" != "no" ] && echo "Populating volatile Filesystems."
create_file() {
+ EXEC=""
+ [ -z "$2" ] && {
+ EXEC="
+ touch \"$1\";
+ "
+ } || {
+ EXEC="
+ cp \"$2\" \"$1\";
+ "
+ }
EXEC="
- touch \"$1\";
+ ${EXEC}
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 "
@@ -187,7 +197,9 @@ apply_cfgfile() {
case "${TTYPE}" in
"f") [ "${VERBOSE}" != "no" ] && echo "Creating file -${TNAME}-."
- create_file "${TNAME}"
+ TSOURCE="$TLTARGET"
+ [ "${TSOURCE}" = "none" ] && TSOURCE=""
+ create_file "${TNAME}" "${TSOURCE}" &
;;
"d") [ "${VERBOSE}" != "no" ] && echo "Creating directory -$
{TNAME}-."
mk_dir "${TNAME}"
--
2.11.0
-----------------------------------------
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] initscripts: Populate volatile from existing file
@ 2017-01-25 11:35 David Vincent
0 siblings, 0 replies; 3+ messages in thread
From: David Vincent @ 2017-01-25 11:35 UTC (permalink / raw)
To: openembedded-core
In some cases, it may be useful to populate a volatile file from an
existing one, e.g. a file in a read-only rootfs that may be edited in a
read-write destination.
To provide this behavior, creation of volatile files has been updated to
copy a file which has been given in the <linksource> field. If set to
none, the current behavior is preserved.
Signed-off-by: David Vincent <freesilicon@gmail.com>
---
.../initscripts/initscripts-1.0/populate-volatile.sh | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 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 22a71ecaae..35316ec2ba 100755
--- a/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
@@ -25,8 +25,18 @@ COREDEF="00_core"
[ "${VERBOSE}" != "no" ] && echo "Populating volatile Filesystems."
create_file() {
+ EXEC=""
+ [ -z "$2" ] && {
+ EXEC="
+ touch \"$1\";
+ "
+ } || {
+ EXEC="
+ cp \"$2\" \"$1\";
+ "
+ }
EXEC="
- touch \"$1\";
+ ${EXEC}
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 "
@@ -187,7 +197,9 @@ apply_cfgfile() {
case "${TTYPE}" in
"f") [ "${VERBOSE}" != "no" ] && echo "Creating file -${TNAME}-."
- create_file "${TNAME}"
+ TSOURCE="$TLTARGET"
+ [ "${TSOURCE}" = "none" ] && TSOURCE=""
+ create_file "${TNAME}" "${TSOURCE}" &
;;
"d") [ "${VERBOSE}" != "no" ] && echo "Creating directory -${TNAME}-."
mk_dir "${TNAME}"
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-06-02 15:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-02 15:16 [PATCH] initscripts: Populate volatile from existing file David Vincent
-- strict thread matches above, loose matches on Subject: below --
2017-03-06 8:51 David Vincent
2017-01-25 11:35 David Vincent
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.