aboutsummaryrefslogtreecommitdiff
path: root/scripts/gen_build_files.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/gen_build_files.sh')
-rwxr-xr-xscripts/gen_build_files.sh21
1 files changed, 20 insertions, 1 deletions
diff --git a/scripts/gen_build_files.sh b/scripts/gen_build_files.sh
index f79fa2f83..64e4bffa9 100755
--- a/scripts/gen_build_files.sh
+++ b/scripts/gen_build_files.sh
@@ -17,12 +17,26 @@ status() { printf ' %-8s%s\n' "$1" "$2"; }
gen() { status "GEN" "$@"; }
chk() { status "CHK" "$@"; }
+# scripts in the 'embed' directory are treated as fake applets
+custom_scripts()
+{
+ custom_loc="$1"
+ if [ -d "$custom_loc" ]
+ then
+ for i in $(cd "$custom_loc"; ls *)
+ do
+ printf "APPLET_SCRIPTED(%s, scripted, BB_DIR_USR_BIN, BB_SUID_DROP, dummy)\n" $i;
+ done
+ fi
+}
+
generate()
{
# NB: data to be inserted at INSERT line is coming on stdin
src="$1"
dst="$2"
header="$3"
+ loc="$4"
#chk "${dst}"
{
# Need to use printf: different shells have inconsistent
@@ -32,6 +46,10 @@ generate()
sed -n '/^INSERT$/ q; p' "${src}"
# copy stdin to stdout
cat
+ if [ -n "$loc" ]
+ then
+ custom_scripts "$loc"
+ fi
# print everything after INSERT line
sed -n '/^INSERT$/ {
:l
@@ -53,7 +71,8 @@ sed -n 's@^//applet:@@p' "$srctree"/*/*.c "$srctree"/*/*/*.c \
| generate \
"$srctree/include/applets.src.h" \
"include/applets.h" \
- "/* DO NOT EDIT. This file is generated from applets.src.h */"
+ "/* DO NOT EDIT. This file is generated from applets.src.h */" \
+ "$srctree/embed"
# (Re)generate include/usage.h
# We add line continuation backslash after each line,