32 lines
795 B
Bash
Executable File
32 lines
795 B
Bash
Executable File
#!/bin/sh
|
|
|
|
current_file=""
|
|
root="/kitchen/overlay"
|
|
|
|
while IFS= read -r line; do
|
|
case "$line" in
|
|
\#\ /*)
|
|
current_file="${line#\# }"
|
|
;;
|
|
\#\:*)
|
|
continue
|
|
;;
|
|
*=*)
|
|
if [ -z "$current_file" ]; then
|
|
echo "warning: value without file: $line" >&2
|
|
continue
|
|
fi
|
|
key="${line%%=*}"
|
|
value="${line#*=}"
|
|
key_esc=$(printf '%s' "$key" | sed 's/[]\/$*.^[]/\\&/g')
|
|
value_esc=$(printf '%s' "$value" | sed 's/[\/&]/\\&/g')
|
|
sed -i "s/_${key_esc}_/${value_esc}/g" "$root$current_file"
|
|
;;
|
|
"")
|
|
continue
|
|
;;
|
|
*)
|
|
echo "unknown line: $line" >&2
|
|
;;
|
|
esac
|
|
done |