diff options
author | Chen Qi <Qi.Chen@windriver.com> | 2013-08-26 14:43:54 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-08-26 13:19:42 +0100 |
commit | e6e44cf9c10116b9bd2260eb344031d9b897f669 (patch) | |
tree | 427d02be3115d47c237a45f73cc8b15da23bf845 /meta | |
parent | 6f2517658141e16b963b88b75c26032f47eaa306 (diff) | |
download | poky-e6e44cf9c10116b9bd2260eb344031d9b897f669.tar.gz |
checkroot.sh: check for conflicting configurations
In our current boot scripts, two ways are used to determine whether
the rootfs is read-only or not. One by checking the READ_ONLY_ROOTFS
value in /etc/default/rcS, the other by checking the /etc/fstab entry.
>From a normal Linux user's point of view, the way of checking the
/etc/fstab entry is preferred. However, as there are several boot scripts
that need to know whether rootfs is read-only or not, checking /etc/fstab
in each script brings too much overhead. Thus, these boot scripts
use the READ_ONLY_ROOTFS value in /etc/default/rcS.
In normal use cases, there would be no problem, as both /etc/default/rcS and
the /etc/fstab are modified at rootfs time. However, if the user changes
the mount option for rootfs in /etc/fstab to read-write, and he/she forgets
to change the value in /etc/default/rcS, there would be unexpected results.
For example, the udev-cache would still be disabled.
So at a minimal, a check for conflicting configurations between /etc/fstab
and /etc/default/rcS should be added in checkroot.sh so that there would be
reasonable warnings if users have configured the system in a non-consistent
way.
[YOCTO #4880]
(From OE-Core rev: 1565a0c5a3f245703e280ca90cf11d3f9374788a)
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rwxr-xr-x | meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh b/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh index cf84cfac5c..dfee2afaad 100755 --- a/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh +++ b/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh | |||
@@ -54,6 +54,16 @@ do | |||
54 | done | 54 | done |
55 | exec 0>&9 9>&- | 55 | exec 0>&9 9>&- |
56 | 56 | ||
57 | # Check for conflicting configurations | ||
58 | if [ "$rootmode" = "ro" -a "$ROOTFS_READ_ONLY" = "no" ] || \ | ||
59 | [ "$rootmode" = "rw" -a "$ROOTFS_READ_ONLY" = "yes" ]; then | ||
60 | echo "" | ||
61 | echo "WARN: conflicting configurations in /etc/fstab and /etc/default/rcS" | ||
62 | echo " regarding the writability of rootfs. Please fix one of them." | ||
63 | echo "" | ||
64 | fi | ||
65 | |||
66 | |||
57 | # | 67 | # |
58 | # Activate the swap device(s) in /etc/fstab. This needs to be done | 68 | # Activate the swap device(s) in /etc/fstab. This needs to be done |
59 | # before fsck, since fsck can be quite memory-hungry. | 69 | # before fsck, since fsck can be quite memory-hungry. |