sed was an example I gave, not a direct command.

On 03/09/19 07:58, Rob Landley wrote:
On 9/1/19 8:47 PM, Denys Nykula wrote:
Which is where we come back to the question, what and how are others
dealing with this problem and is there a need for a simple and basic
installer inside toybox?

In gentoo I have this /etc/portage/bashrc hook symlink toybox to every
command missing or linked to nowhere, after package install or removal:

if test "$EBUILD_PHASE" = postinst || test "$EBUILD_PHASE" = postrm; then
   for i in `toybox`; do
     toybox which $i 2>&1 >/dev/null || toybox ln -fsv toybox /bin/$i
   done
   which awk 2>&1 >/dev/null || ln -fsv nawk /bin/awk
   which vi 2>&1 >/dev/null || ln -fsv vim /bin/vi
fi

Those last two are on the todo list. But after toysh and route, which mkroot
needs. (And vi might be after make, and promoting half the stuff currently in
pending.)

Sorry, but I like vi, it was the first 'editor' I learn't to use on a mainframe back in the early years, a lot better and easier than ed was, and you did have to be carefull what you did back then as you were working on a 'live' system. And it's pretty much the same format and commands to use across any operating system linux/unix/cpm/os2/etc..., even dos and windows origonally had it.


Since I symlink `/sbin` to `bin` and `/usr` to `.`,

I go the other way with /usr (symlink the top level bin/sbin/lib into usr)
because I don't want more debris (include, local, share...) at the top level.

I've seen and used these systems, but sorry I prefer to keep some separation, the only ones we usually use are related to /usr/X11n to /usr, /usr/lib64 to /usr/lib and the various icons directories, most others can be fixed with a configure switch.

I don't have to deal
with paths. When I need some replacements from busybox:

for i in head ifconfig route sed; do ln -fsv busybox /bin/$i; done

What do you need head, ifconfig or sed for? (What is the toybox version missing
and/or getting wrong?)

not necessary wrong, just not what's wanted in the instance, maybe it's the format or it's providing too much information to parse with and therefor taking unnecessary processor cycles to process or causing extra cleanup cycles, thus taking up visable time.


# Use... And restore toybox:
find /bin -lname busybox -print -delete
EBUILD_PHASE=postrm . /etc/portage/bashrc

You can't link sed-BB to busybox because busybox guesses it's sed by
name match.

I did say it was an example, the change is changing busybox's sed link to sed-BB and it works still, trying a sed-BB --version gives a busybox answer (and doing it the wrong way gives an applet missing error), while with toybox installed the command sed --version should give a toybox answer and sed-FULL --version gives a sed command answer.

When toybox can't find a command I made it dereference one level of symlink to
get a new name to try. (And then if that name is "toybox", barf.)

Not sure I like this, if I understand you correctly, so, with toybox installed, I couldn't create a sed-TOY with a link to toybox, and expect toybox's version of sed to work, it doesn't do a internal partial-name lookup? If so, sorry, but it's a little user unfriendly.

I don't manually touch standalone binaries, letting Portage
write them over symlinks when installing a build dependency, and after
their auto removal the above hook returns Toybox.

As long as it doesn't dereference the symlink and stomp the binary at its end.
(The bzip2 installer used to do that to busybox. THAT was a fun one to debug.
And this is why the "install" command has different defaults than the "cp"
command. :)

Rob

scsijon
_______________________________________________
Toybox mailing list
[email protected]
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to