[Toybox] Toybox Installer/setup routine?

scsijon scsijon at lamiaworks.com.au
Sat Sep 7 23:34:34 PDT 2019



On 08/09/19 11:12, Rob Landley wrote:
> 
> 
> On 9/2/19 6:33 PM, scsijon wrote:
>> 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.
> 
> I don't see how that relates to this conversation? I said vi is on the todo
> list, but I'm not working on it yet because it's a big job to do it right and
> I've currently got my hands full with the shell and need route and make to make
> mkroot work so those come first?
> 
Maybe it was that you had a link from vi to vim that made me worry.

> It's nice that you've used vi for a long time...?
> 
>>>> 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,
> 
> Have fun with it, again... don't see the relevance?>
>>>> 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.
> 
> *blink* *blink. Nope, still not following. Maybe it's me today...
> 
>>>
>>>> # 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,
> 
> You had /bin/sed pointing to busybox. You replace that with /bin/sed pointing to
> toybox. But it was "busybox's link".
> 
> How does the symlink belong to either? It points _to_ one of them. But since it
> used to point to busybox it's busybox's by divine right?
> 
> (Have fun with busybox if that's what you like. I used to maintain it. Heck, I
> wrote the majority of busybox sed.)

Not my choice!

> 
>> trying a sed-BB --version gives a busybox answer (and doing
>> it the wrong way gives an applet missing error),
> 
> Um, no?
> 
> $ busybox sed --version
> This is not GNU sed version 4.0
> $ toybox sed --version
> This is not GNU sed version 9.0
> 
> Guess why it does that?
> 
> http://lists.busybox.net/pipermail/busybox/2004-January/044644.html
> 
> (I can start singing "You're welcome" if it would help?)
> 
>> while with toybox installed the
>> command sed --version should give a toybox answer and sed-FULL --version gives a
>> sed command answer.
> 
> In that particular case 2 of the 3 will lie to placate autoconf's regex.
> 
>>> 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?
> 
> Um, neither does busybox?
> 
> $ ln -s $(which busybox) sed-blah
> $ ./sed-blah
> sed-blah: applet not found
> 
> I'm the guy who added the partial name lookup for _busybox_ back in the day
> because I started looking at a bug that needed fixing:
> 
> http://lists.busybox.net/pipermail/busybox/2005-August/049781.html
> 
> And wound up doing https://git.busybox.net/busybox/commit/?id=b766c394569c to
> preserve the subset of the behavior that was useful without the "busybox no
> longer has devfsd so I can go devfsd rm -rf /" bug.
> 
>> If so, sorry, but
>> it's a little user unfriendly.
> 
> Again, I have NO clue what you mean by this.
> 
> What I taught toybox to do is:
> 
>    $ ln -s toybox echo
>    $ ln -s echo potato
>    $ ./potato one two three
>    one two three
> 
> And that means you CAN have an "echo-toybox" symlink, pointing to ~/toybox/echo,
> which is itself a symlink to /bin/toybox. And it should all work fine.

AH, thank you, and I didn't even think of that way of doing it, much 
better than my idea. So I could put toybox's direct links in 
/usr/local/toybox (which is not in the HOME path so not available 
directly) and create symlinks as something like /usr/local/bin/echo-toy 
(which would be in the path) to /usr/local/toybox/echo (which is a 
symlink to /usr/bin/toybox). That sorts out most of what I want to do as 
a first stage. And no I don't want you to do it if I can, that's not 
your job. It's my problem really to sort out. I just needed to pick your 
brains how to do that in case you hadn't. I will need in the end, to 
create a toybox.pet package for it to be added for our users to use.

All I will then need to do, is to trap what's already in the system as 
links from busybox and rename them and what is a full command and rename 
that, then i'm up and running, ?easy?.

> 
> I.E. I implemented a way to do what you want already, you just don't seem to
> want to do it that way and want me to implement another way to do the same thing?
> 
> But then, I'm having trouble understanding this thread.

I think I am too, i've got to stop reading and replying to people when 
it's almost time to get up and haven't been to bed yet, i'm getting too 
old for this.

> 
> Rob
> 



More information about the Toybox mailing list