2018-05-10 14:42:43 +02:00
|
|
|
file_path_override() {
|
2018-09-23 12:35:57 +02:00
|
|
|
local layer
|
|
|
|
|
2018-09-27 23:51:15 +02:00
|
|
|
if [ -z "$LAYERCONF" ]; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2018-09-23 12:35:57 +02:00
|
|
|
tac "$LAYERCONF" | while read layer; do
|
|
|
|
if [ -e "$SCRIPTDIR/layer/$layer/$1" ]; then
|
|
|
|
echo "$SCRIPTDIR/layer/$layer/$1"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
done
|
2018-05-10 14:42:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
cat_file_override() {
|
|
|
|
local path=$(file_path_override "$1")
|
|
|
|
|
|
|
|
if [ ! -z "$path" ]; then
|
|
|
|
cat "$path"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
cat_file_merge() {
|
2018-09-23 12:35:57 +02:00
|
|
|
local layer
|
|
|
|
|
2018-09-27 23:51:15 +02:00
|
|
|
if [ -z "$LAYERCONF" ]; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2018-09-23 12:35:57 +02:00
|
|
|
while read layer; do
|
|
|
|
if [ -e "$SCRIPTDIR/layer/$layer/$1" ]; then
|
|
|
|
cat "$SCRIPTDIR/layer/$layer/$1"
|
|
|
|
fi
|
|
|
|
done < "$LAYERCONF"
|
2018-05-10 14:42:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
include_override() {
|
|
|
|
local path=$(file_path_override "$1")
|
|
|
|
|
|
|
|
if [ ! -z "$path" ]; then
|
|
|
|
source "$path"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
include_merge() {
|
2018-09-23 12:35:57 +02:00
|
|
|
local layer
|
|
|
|
|
2018-09-27 23:51:15 +02:00
|
|
|
if [ -z "$LAYERCONF" ]; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2018-09-23 12:35:57 +02:00
|
|
|
while read layer; do
|
|
|
|
if [ -e "$SCRIPTDIR/layer/$layer/$1" ]; then
|
|
|
|
source "$SCRIPTDIR/layer/$layer/$1"
|
|
|
|
fi
|
|
|
|
done < "$LAYERCONF"
|
2018-05-10 14:42:43 +02:00
|
|
|
}
|