]> code.ossystems Code Review - openembedded-core.git/commitdiff
initscripts: populate-volatile: improve config file parsing
authorMans Rullgard <mans@mansr.com>
Thu, 1 Dec 2016 12:30:34 +0000 (12:30 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 13 Dec 2016 22:47:26 +0000 (22:47 +0000)
This improves the config file parsing to permit blank lines and
comments following an entry or preceeded by whitespace.

Signed-off-by: Mans Rullgard <mans@mansr.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
meta/recipes-core/initscripts/initscripts-1.0/volatiles

index ce4622a5e555006e046023cb984f5966dfeb0b47..91514bac86fa3d1606348be85efc8bc0ef11941a 100755 (executable)
@@ -150,9 +150,9 @@ apply_cfgfile() {
                return 1
        }
 
-       cat ${CFGFILE} | grep -v "^#" | \
-               while read LINE; do
-               eval `echo "$LINE" | sed -n "s/\(.*\)\ \(.*\) \(.*\)\ \(.*\)\ \(.*\)\ \(.*\)/TTYPE=\1 ; TUSER=\2; TGROUP=\3; TMODE=\4; TNAME=\5 TLTARGET=\6/p"`
+       cat ${CFGFILE} | sed 's/#.*//' | \
+       while read TTYPE TUSER TGROUP TMODE TNAME TLTARGET; do
+               test -z "${TLTARGET}" && continue
                TNAME=${ROOT_DIR}${TNAME}
                [ "${VERBOSE}" != "no" ] && echo "Checking for -${TNAME}-."
 
index 297245d0e40efb5a2f00d825098fb25c6a435c0c..bc17c4553da243ccfb87fd12e7f524b051cf4a0a 100644 (file)
@@ -1,11 +1,13 @@
 # This configuration file lists filesystem objects that should get verified
 # during startup and be created if missing.
 #
-# Every line must either be a comment starting with #
-# or a definition of format:
+# Entries have the following format:
 # <type> <owner> <group> <mode> <path> <linksource>
 # where the items are separated by whitespace !
 #
+# The # character introduces a comment lasting until end of line.
+# Blank lines are ignored.
+#
 # <type> : d|f|l : (d)irectory|(f)ile|(l)ink
 #
 # A linking example: