diff options
author | David Vincent <freesilicon@gmail.com> | 2017-06-02 17:16:03 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-06-06 19:02:44 +0100 |
commit | 82fd7bbfaed9694fd699e2803fbf9a4932b9cfc9 (patch) | |
tree | e7f1814f67208b465b3357eb392551a2d5eb26e7 /meta/recipes-core | |
parent | c2a5d0bb800cb7df29167c137fee251d2347111a (diff) | |
download | poky-82fd7bbfaed9694fd699e2803fbf9a4932b9cfc9.tar.gz |
initscripts: Populate volatile from existing file
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.
(From OE-Core rev: d44816bedadeef420226dc5efb67065cfcda6634)
Signed-off-by: David Vincent <freesilicon@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core')
-rwxr-xr-x | meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh | 16 |
1 files 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" | |||
25 | [ "${VERBOSE}" != "no" ] && echo "Populating volatile Filesystems." | 25 | [ "${VERBOSE}" != "no" ] && echo "Populating volatile Filesystems." |
26 | 26 | ||
27 | create_file() { | 27 | create_file() { |
28 | EXEC="" | ||
29 | [ -z "$2" ] && { | ||
30 | EXEC=" | ||
31 | touch \"$1\"; | ||
32 | " | ||
33 | } || { | ||
34 | EXEC=" | ||
35 | cp \"$2\" \"$1\"; | ||
36 | " | ||
37 | } | ||
28 | EXEC=" | 38 | EXEC=" |
29 | touch \"$1\"; | 39 | ${EXEC} |
30 | chown ${TUSER}.${TGROUP} $1 || echo \"Failed to set owner -${TUSER}- for -$1-.\" >/dev/tty0 2>&1; | 40 | chown ${TUSER}.${TGROUP} $1 || echo \"Failed to set owner -${TUSER}- for -$1-.\" >/dev/tty0 2>&1; |
31 | chmod ${TMODE} $1 || echo \"Failed to set mode -${TMODE}- for -$1-.\" >/dev/tty0 2>&1 " | 41 | chmod ${TMODE} $1 || echo \"Failed to set mode -${TMODE}- for -$1-.\" >/dev/tty0 2>&1 " |
32 | 42 | ||
@@ -187,7 +197,9 @@ apply_cfgfile() { | |||
187 | 197 | ||
188 | case "${TTYPE}" in | 198 | case "${TTYPE}" in |
189 | "f") [ "${VERBOSE}" != "no" ] && echo "Creating file -${TNAME}-." | 199 | "f") [ "${VERBOSE}" != "no" ] && echo "Creating file -${TNAME}-." |
190 | create_file "${TNAME}" | 200 | TSOURCE="$TLTARGET" |
201 | [ "${TSOURCE}" = "none" ] && TSOURCE="" | ||
202 | create_file "${TNAME}" "${TSOURCE}" & | ||
191 | ;; | 203 | ;; |
192 | "d") [ "${VERBOSE}" != "no" ] && echo "Creating directory -${TNAME}-." | 204 | "d") [ "${VERBOSE}" != "no" ] && echo "Creating directory -${TNAME}-." |
193 | mk_dir "${TNAME}" | 205 | mk_dir "${TNAME}" |