diff options
Diffstat (limited to 'meta/recipes-core/volatile-binds')
-rwxr-xr-x | meta/recipes-core/volatile-binds/files/mount-copybind | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/meta/recipes-core/volatile-binds/files/mount-copybind b/meta/recipes-core/volatile-binds/files/mount-copybind index 57a5ce5f21..aad022c6e4 100755 --- a/meta/recipes-core/volatile-binds/files/mount-copybind +++ b/meta/recipes-core/volatile-binds/files/mount-copybind | |||
@@ -31,6 +31,13 @@ if [ -d "$mountpoint" ]; then | |||
31 | else | 31 | else |
32 | specdir_existed=no | 32 | specdir_existed=no |
33 | mkdir "$spec" | 33 | mkdir "$spec" |
34 | # If the $spec directory is created we need to take care that | ||
35 | # the selinux context is correct | ||
36 | if command -v selinuxenabled > /dev/null 2>&1; then | ||
37 | if selinuxenabled; then | ||
38 | restorecon "$spec" | ||
39 | fi | ||
40 | fi | ||
34 | fi | 41 | fi |
35 | 42 | ||
36 | # Fast version of calculating `dirname ${spec}`/.`basename ${spec}`-work | 43 | # Fast version of calculating `dirname ${spec}`/.`basename ${spec}`-work |
@@ -39,7 +46,12 @@ if [ -d "$mountpoint" ]; then | |||
39 | 46 | ||
40 | # Try to mount using overlay, which is must faster than copying files. | 47 | # Try to mount using overlay, which is must faster than copying files. |
41 | # If that fails, fall back to slower copy. | 48 | # If that fails, fall back to slower copy. |
42 | if ! mount -t overlay overlay -olowerdir="$mountpoint",upperdir="$spec",workdir="$overlay_workdir" "$mountpoint" > /dev/null 2>&1; then | 49 | if command -v selinuxenabled > /dev/null 2>&1; then |
50 | if selinuxenabled; then | ||
51 | mountcontext=",rootcontext=$(matchpathcon -n $mountpoint)" | ||
52 | fi | ||
53 | fi | ||
54 | if ! mount -t overlay overlay -olowerdir="$mountpoint",upperdir="$spec",workdir="$overlay_workdir""$mountcontext" "$mountpoint" > /dev/null 2>&1; then | ||
43 | 55 | ||
44 | if [ "$specdir_existed" != "yes" ]; then | 56 | if [ "$specdir_existed" != "yes" ]; then |
45 | cp -aPR "$mountpoint"/. "$spec/" | 57 | cp -aPR "$mountpoint"/. "$spec/" |