1
0
Fork 0
mirror of https://github.com/pygos/build.git synced 2024-11-10 21:57:10 +01:00
build/util/override.sh
David Oberhollenzer b4824a9f29 Fix missing LAYERCONF in check_update script
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-09-27 23:51:15 +02:00

58 lines
875 B
Bash

file_path_override() {
local layer
if [ -z "$LAYERCONF" ]; then
return
fi
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
if [ -z "$LAYERCONF" ]; then
return
fi
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
if [ -z "$LAYERCONF" ]; then
return
fi
while read layer; do
if [ -e "$SCRIPTDIR/layer/$layer/$1" ]; then
source "$SCRIPTDIR/layer/$layer/$1"
fi
done < "$LAYERCONF"
}