This commit is contained in:
iceBear67
2026-07-05 13:49:09 +08:00
parent a37aece686
commit bf67b8b95f
21 changed files with 230 additions and 61 deletions

32
image/substitution.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/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