BusyBox provides a --install option to symlink itself
alexbuzzbee opened this issue · 4 comments
The busybox
binary can be configured to accept a --install
option to create links to itself for all the various commands in /bin/
, /sbin
, /usr/bin
, and /usr/sbin
. To have busybox
install itself to these directories, using symlinks (assuming BusyBox is configued with --install
), chroot into the installation image, then:
/path/to/busybox --install -s
Will create symlinks (without -s
it will create hardlinks) for all configured applets.
In my opinion, this is better then iterating over --list
output with a script.
I should note that all the various bin
directories must be created before doing this, or busybox
will fail with a whole slew of no such file or directory
errors.
Also, you must use the absolute path, as it seems to use that to figure out where to symlink to.
Using the --install -s
options is absolutely a better option than to symlink everything manually using a for loop. I am very much aware of this. But using chroot
requires root, and when preparing the filesystem you might want to use something like fakeroot
instead. When doing it like this, like how filesystem/build.sh
is run, using a chroot
is simply not an option. Because as you said, busybox has to run with an absolute path because that what's being used for the symlink. You could use the busybox installed on your own system, but I don't think that's a good way of doing things.
You could boot the system with init=/path/to/busybox sh
, and then do the --install
from within the VM. Or you could symlink sh
manually and do init=/bin/sh
.
True, but for the sake of coherence of the text and not deviating to much from the automated process I'm not going to change it. Using a VM to build a filesystem seems a bit like overkill.