- Many fixes to sourcing, now will always resolve to base dir.

- All scripts are again `sh` compatible.
- Binbox overhaul, symlinks finally work just like `busybox`.
- Error checking to some files like `sw` and `own`.
TODO: Make it pretty and make `short` already.
This commit is contained in:
Sam Hardeman 2025-09-22 08:34:50 +02:00
parent b5c8a3f894
commit 0912f2d3d4
13 changed files with 1143 additions and 33 deletions

24
binbox
View file

@ -1,10 +1,10 @@
#!/bin/bash
#!/bin/sh
# binbox: Creates a multi-binary script that self-contains the input scripts.
# Symlinking to the resulting binary with the name of one of the original scripts will trigger
# said script. The idea is similar to `busybox`.
DAISY_INTERNAL=1
. daisy.source
. $(dirname $(realpath $0))/daisy.source
ARGS=$@
@ -135,15 +135,6 @@ for f in "${includes[@]}"; do
add "$(cat "$f")"
done
add ""
add "if [[ \$# -eq 0 ]]; then"
add " echo 'Available modules:'"
for f in "${inputs[@]}"; do
add "echo '$f'"
done
add " exit 0"
add "fi"
# >>> Section 2: Modules
for f in "${inputs[@]}"; do
@ -156,10 +147,17 @@ done
# >>> Section 3: Module selection
add "SYMED=1"
add "BINSELF=\$(basename \$0 | rev | cut -d "/" -f 1 | rev)"
add "BOXFILE=$(basename \"$output\")"
add "BINSELF=\$(basename \$0)"
add "BOXFILE=\"$output\""
add "if [[ \$BINSELF == \$BOXFILE ]]; then"
add " SYMED=0"
add " if [[ \$# -eq 0 ]]; then"
add " echo 'Available modules:'"
for f in "${inputs[@]}"; do
add " echo '$f'"
done
add " exit 0"
add " fi"
add "fi"
add "if [[ \$SYMED -eq 0 ]]; then"