1
0
Fork 0
mirror of https://github.com/pygos/build.git synced 2024-05-20 04:26:13 +02:00
build/util/override.sh

47 lines
743 B
Bash
Raw Normal View History

file_path_override() {
local layer
tac "$LAYERCONF" | while read layer; do
if [ -e "$SCRIPTDIR/layer/$layer/$1" ]; then
echo "$SCRIPTDIR/layer/$layer/$1"
return
fi
done
}
cat_file_override() {
local path=$(file_path_override "$1")
if [ ! -z "$path" ]; then
cat "$path"
fi
}
cat_file_merge() {
local layer
while read layer; do
if [ -e "$SCRIPTDIR/layer/$layer/$1" ]; then
cat "$SCRIPTDIR/layer/$layer/$1"
fi
done < "$LAYERCONF"
}
include_override() {
local path=$(file_path_override "$1")
if [ ! -z "$path" ]; then
source "$path"
fi
}
include_merge() {
local layer
while read layer; do
if [ -e "$SCRIPTDIR/layer/$layer/$1" ]; then
source "$SCRIPTDIR/layer/$layer/$1"
fi
done < "$LAYERCONF"
}