diff options
author | Chen Qi <Qi.Chen@windriver.com> | 2014-07-23 05:40:12 -0400 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-08-02 09:26:14 +0100 |
commit | db15e2d01c48786326ee13dd09b7f2dd45f53116 (patch) | |
tree | 85aaa9c06c70204977ffd5c8624e9a93f6c98849 /meta/recipes-core/volatile-binds/files/mount-copybind | |
parent | 3b19f90bdfca520a6e00057cacb103f8a55feac6 (diff) | |
download | poky-db15e2d01c48786326ee13dd09b7f2dd45f53116.tar.gz |
volatile-binds: add recipe
This recipe is designed to play a key role in a read-only rootfs
of systemd based systems. It generates service files from a template,
volatile-binds.service.in and the VOLATILE_BINDS variable.
By default, VOLATILE_BINDS takes the value of "/var/volatile/lib /var/lib\n",
which leads to the generation of volatile-var-lib.service file.
This file doesn't have any effect in a read-write system, as it
has "ConditionPathIsReadWrite = !/var/lib" in the [Unit] section.
In other words, this file only has effect in a read-only rootfs.
(From OE-Core rev: ed7d30dc0cdb6d6c56c50ac7a3440c4ed0ee70d3)
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/volatile-binds/files/mount-copybind')
-rwxr-xr-x | meta/recipes-core/volatile-binds/files/mount-copybind | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/meta/recipes-core/volatile-binds/files/mount-copybind b/meta/recipes-core/volatile-binds/files/mount-copybind new file mode 100755 index 0000000000..2aeaf84ddb --- /dev/null +++ b/meta/recipes-core/volatile-binds/files/mount-copybind | |||
@@ -0,0 +1,34 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # Perform a bind mount, copying existing files as we do so to ensure the | ||
4 | # overlaid path has the necessary content. | ||
5 | |||
6 | if [ $# -lt 2 ]; then | ||
7 | echo >&2 "Usage: $0 spec mountpoint [OPTIONS]" | ||
8 | exit 1 | ||
9 | fi | ||
10 | |||
11 | spec=$1 | ||
12 | mountpoint=$2 | ||
13 | |||
14 | if [ $# -gt 2 ]; then | ||
15 | options=$3 | ||
16 | else | ||
17 | options= | ||
18 | fi | ||
19 | |||
20 | [ -n "$options" ] && options=",$options" | ||
21 | |||
22 | mkdir -p "${spec%/*}" | ||
23 | if [ -d "$mountpoint" ]; then | ||
24 | if [ ! -d "$spec" ]; then | ||
25 | mkdir "$spec" | ||
26 | cp -pPR "$mountpoint"/. "$spec/" | ||
27 | fi | ||
28 | elif [ -f "$mountpoint" ]; then | ||
29 | if [ ! -f "$spec" ]; then | ||
30 | cp -pP "$mountpoint" "$spec" | ||
31 | fi | ||
32 | fi | ||
33 | |||
34 | mount -o "bind$options" "$spec" "$mountpoint" | ||