libcfg.lib, config-getvar: option '-C|--config': accept a list of configuration files containing wilcards

Signed-off-by: Davide Madrisan <davide.madrisan@gmail.com>
This commit is contained in:
Davide Madrisan 2012-11-15 22:55:31 +01:00
parent 343e644abe
commit 5008e884d4
3 changed files with 11 additions and 4 deletions

View File

@ -18,6 +18,11 @@ Changes in version 1.14.3
* pck-update - Davide Madrisan:
Fix a string translation by adding the missing '$' prefix.
+ improvement
* libcfg.lib, plugins/config-getvar - Davide Madrisan:
Option '-C|--config': accept a list of configuration files containing
wilcards.
-------------------------------------------------------------------------------
Changes in version 1.14.2

View File

@ -106,7 +106,7 @@ function cfg_load_files() {
if [ "$1" ]; then
# select a different list of user configuration files
cfgfile_list=(\
`ls /etc/@package@.conf /etc/@package@.d/*.conf` $1)
`ls /etc/@package@.conf /etc/@package@.d/*.conf $1 2>/dev/null`)
else
# default configuration files
cfgfile_list=(${default_cfg_list[@]})

View File

@ -145,9 +145,11 @@ function config.getvar() {
local cfg_file_lst
if [ "$cfg_file" ]; then
[ -r $cfg_file ] ||
notify.error $"configuration file not found"" -- \`$cfg_file'"
cfg_file_lst="$cfg_file"
for f in $(ls $cfg_file 2>/dev/null); do
[ -r "$f" ] ||
notify.error $"configuration file not found"" -- \`$f'"
done
cfg_file_lst="$(ls $cfg_file 2>/dev/null)"
else
cfg_file_lst="${default_cfg_list[*]}"
fi