diff options
author | Dave Cobbley <david.j.cobbley@linux.intel.com> | 2018-08-14 20:05:37 +0300 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2018-08-23 04:26:31 +0300 |
commit | eb8dc40360f0cfef56fb6947cc817a547d6d9bc6 (patch) | |
tree | de291a73dc37168da6370e2cf16c347d1eba9df8 /poky/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh | |
parent | 9c3cf826d853102535ead04cebc2d6023eff3032 (diff) | |
download | openbmc-eb8dc40360f0cfef56fb6947cc817a547d6d9bc6.tar.xz |
[Subtree] Removing import-layers directory
As part of the move to subtrees, need to bring all the import layers
content to the top level.
Change-Id: I4a163d10898cbc6e11c27f776f60e1a470049d8f
Signed-off-by: Dave Cobbley <david.j.cobbley@linux.intel.com>
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'poky/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh')
-rw-r--r-- | poky/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/poky/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh b/poky/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh new file mode 100644 index 000000000..1a0328d63 --- /dev/null +++ b/poky/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +. /etc/default/rcS + +[ "$ROOTFS_READ_ONLY" = "no" ] && exit 0 + +is_on_read_only_partition () { + DIRECTORY=$1 + dir=`readlink -f $DIRECTORY` + while true; do + if [ ! -d "$dir" ]; then + echo "ERROR: $dir is not a directory" + exit 1 + else + for flag in `awk -v dir=$dir '{ if ($2 == dir) { print "FOUND"; split($4,FLAGS,",") } }; \ + END { for (f in FLAGS) print FLAGS[f] }' < /proc/mounts`; do + [ "$flag" = "FOUND" ] && partition="read-write" + [ "$flag" = "ro" ] && { partition="read-only"; break; } + done + if [ "$dir" = "/" -o -n "$partition" ]; then + break + else + dir=`dirname $dir` + fi + fi + done + [ "$partition" = "read-only" ] && echo "yes" || echo "no" +} + +if [ "$1" = "start" ] ; then + if [ `is_on_read_only_partition /var/lib` = "yes" ]; then + grep -q "tmpfs /var/volatile" /proc/mounts || mount /var/volatile + mkdir -p /var/volatile/lib + cp -a /var/lib/* /var/volatile/lib + mount --bind /var/volatile/lib /var/lib + fi +fi + |