[OE-core] [PATCH V4 02/10] use a uniform way to determine whether rootfs is read-only

Otavio Salvador otavio at ossystems.com.br
Wed Aug 7 20:29:07 UTC 2013


On Wed, Aug 7, 2013 at 5:08 AM,  <Qi.Chen at windriver.com> wrote:
...
> --- a/meta/recipes-core/initscripts/initscripts-1.0/functions
> +++ b/meta/recipes-core/initscripts/initscripts-1.0/functions
> @@ -58,3 +58,17 @@ status() {
>      fi
>      return 3
>  }
> +
> +# Determine whether rootfs is read-only or not according to /proc/mounts or /etc/fstab.
> +is_rootfs_readonly () {
> +    local DIRNAME=`dirname $0`
> +    local ROOT_DIR=`echo $DIRNAME | sed -ne 's:/etc/.*::p'`
> +    local criteria_file
> +    [ -n "$ROOT_DIR" ] && criteria_file="$ROOT_DIR/etc/fstab" || criteria_file="/proc/mounts"
> +    local flag
> +    for flag in `awk '{ if ($2 == "/") { split($4,FLAGS,",") } }; END { for (f in FLAGS) print FLAGS[f] }' < $criteria_file`; do
> +       [ "$flag" = "ro" ] && { echo "yes"; return 0; }
> +    done
> +    echo "no"
> +    return 0
> +}
> \ No newline at end of file

Please fix this.

-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://projetos.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750



More information about the Openembedded-core mailing list