[Toybox] Toybox Installer/setup routine?

Denys Nykula nykula at ukr.net
Sun Sep 1 18:47:16 PDT 2019


> 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

Since I symlink `/sbin` to `bin` and `/usr` to `.`, 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
# 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 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.



More information about the Toybox mailing list