mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 20:13:32 +01:00
jw-build-functions.sh: Fix basename for bash scripts
- Add _ytools_check_config_files_readable - Fix basename for bash
This commit is contained in:
parent
5a6127eff6
commit
870066e1b2
1 changed files with 18 additions and 7 deletions
|
|
@ -12,10 +12,20 @@ _ytools_check_config_present()
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
_ytools_check_config_files_readable()
|
||||
{
|
||||
local new=""
|
||||
for f in $ytools_config_files; do
|
||||
[ -f "$f" -a -r "$f" ] && new="$new $f"
|
||||
done
|
||||
ytools_config_files="$new"
|
||||
}
|
||||
|
||||
_ytools_probe_config_paths()
|
||||
{
|
||||
local f new exp dir
|
||||
[ ! "$ytools_config_files" ] && ytools_config_files = "
|
||||
[ ! "$ytools_config_files" ] && ytools_config_files="
|
||||
/etc/opt/$ytools_project/$ytools_basename.conf
|
||||
$HOME/.$ytools_project/$ytools_basename.conf
|
||||
$HOME/.$ytools_project/$rc
|
||||
|
|
@ -23,19 +33,17 @@ _ytools_probe_config_paths()
|
|||
$HOME/.$ytools_basename/$rc
|
||||
$HOME/.$rc
|
||||
"
|
||||
for f in $ytools_config_files; do
|
||||
[ -r "$f" ] && new="$new $f"
|
||||
done
|
||||
|
||||
ytools_config_files="$new"
|
||||
_ytools_check_config_files_readable
|
||||
|
||||
# add includes
|
||||
new=""
|
||||
for f in $ytools_config_files; do
|
||||
|
||||
exp=`sed '
|
||||
/^[ ]*include[ ]/ !d
|
||||
s/^[ ]*include[ ]*//g
|
||||
' $f`
|
||||
|
||||
if [ "$exp" ]; then
|
||||
if [ "${exp:0:1}" != '/' ]; then
|
||||
dir=`dirname $f`
|
||||
|
|
@ -45,7 +53,10 @@ _ytools_probe_config_paths()
|
|||
new="$new $f $exp"
|
||||
fi
|
||||
done
|
||||
|
||||
[ "$new" ] && ytools_config_files="$new"
|
||||
|
||||
_ytools_check_config_files_readable
|
||||
}
|
||||
|
||||
_ytools_cat_section()
|
||||
|
|
@ -370,7 +381,7 @@ if [ "$ytools_functions_sourced" != "yes" ]; then
|
|||
|
||||
ytools_functions_sourced="yes"
|
||||
|
||||
[ -z "$ytools_basename" ] && ytools_basename=`basename $0 | sed 's/\.sh$//'`
|
||||
[ -z "$ytools_basename" ] && ytools_basename=`echo "$0" | sed 's/^-*//' | xargs basename | sed 's/\.sh$//'`
|
||||
[ -z "$ytools_project" ] && ytools_project="ytools"
|
||||
[ -z "$ytools_rc" ] && ytools_rc="$ytools_basename"rc
|
||||
_ytools_probe_config_paths
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue