1DOLLY 72PACKAGE toybox3REQUIRES HOST runtime@045# toybox's grep and sed, from upstream's release: grep -r, -o, --include and6# context lines, and sed -i, which the image's sbase grep and sed do not7# have. One program under both names, which take the place of the posix8# package's: /bin comes first on PATH. The headers that toybox's scripts9# generate for this configuration come with the source (prepare-toybox.sh);10# every file of C is compiled here, unchanged but for three lines (below).11# NOMMU in that configuration says there is no fork; neither command starts12# a program.13FROM /v0.1.4/Dollyfile-system-tools 7f6c86fcc73e544e7007646eba2718bbc4d43b7f0516d9558e2dc500b1a05a801415REQUIRES HEADER libc16REQUIRES TOOL   cc17REQUIRES TOOL   ln18REQUIRES TOOL   mkdir19REQUIRES TOOL   mv20REQUIRES TOOL   printf21REQUIRES TOOL   sed22REQUIRES TOOL   tar23REQUIRES TOOL   test2425SOURCE /v0.1.4/dist/static/tools/toybox.tar 819813e6f19a40be2a5be239ecd8286eeb58362c66288adb0f25e0b0a09a67f4 /tmp/toybox.tar26SLOP tar -xf /tmp/toybox.tar -C /27# toybox stops the compiler (#error) in the three functions that take a28# device's number apart on a system it does not know, each above a fallback29# of its own. grep and sed read no device number, so those lines go; it is30# the one change to the source. Its <sys/statfs.h> is named for Linux alone,31# and syscall(), which is not here, is what it would copy a file range with32# had it found that call's number. It calls what runs at exit with the signal33# as an argument, and the function that removes sed -i's temporary file is34# declared with none: WebAssembly traps on such a call, so it is given one.35SLOP CWD /tmp/toybox sed '/^#error$/d' lib/portability.c > portability.c && mv portability.c lib/portability.c36SLOP CWD /tmp/toybox cc -O2 -funsigned-char -fno-strict-aliasing -include sys/statfs.h '-Dsyscall(...)=-1' '-Dtempfile_handler(...)=tempfile_handler(int at_exit)' -I. '-DTOYBOX_VERSION="0.8.15"' main.c lib/*.c toys/posix/grep.c toys/posix/sed.c -o /usr/bin/toybox37SLOP ln -sf /usr/bin/toybox /bin/grep38SLOP ln -sf /usr/bin/toybox /bin/sed3940# toybox has no manual pages: a command's help is its page. grep ends with 241# whenever it did not search.42SLOP grep --help > /usr/share/man/cat1/grep.1 || test -s /usr/share/man/cat1/grep.143SLOP sed --help > /usr/share/man/cat1/sed.14445SLOP mkdir -p /tmp/toybox-check/deep && printf 'hay\nneedle\n' > /tmp/toybox-check/deep/stack46SLOP CWD /tmp/toybox-check test "$(grep -rn needle .)" = ./deep/stack:2:needle47SLOP CWD /tmp/toybox-check sed -i 's/needle/pin/' deep/stack && test "$(grep -rc pin .)" = ./deep/stack:14849EXPORTS TOOL toybox50EXPORTS TOOL grep51EXPORTS TOOL sed52FILE /usr/share/licenses/toybox/LICENSE53FILE /usr/share/man/cat1/grep.154FILE /usr/share/man/cat1/sed.155