In order to allow other places such as hooks to list the projects,
seperate out the sed script into its own function. This enables less
code duplication if another script wants to list all projects in a
cfgfile.
Artem: re-named the function for a bit better readability.
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
eval "$var=\"\$result\""
}
+# Get the list of projects from config file "$1".
+get_cfgfile_projects_list()
+{
+ local cfgfile="$1"
+
+ LC_ALL=C sed -n -e "s/^\[prj_\(.*\)\]$/\1/p" "$cfgfile"
+}
+
# Parse the "global" section of the config file. The result is a set of
# per-option variables and their values are exactly as in the configuration
# file:
{
local prj
- LC_ALL=C sed -n -e "s/^\[prj_\(.*\)\]$/\1/p" "$cfgfile" | \
- while read -r prj; do
+ get_cfgfile_projects_list "$cfgfile" | \
+ while read -r prj; do
# Get project description
local descr
ini_config_get_or_die descr "$cfgfile" "prj_$prj" "description"