Changing binary name at compile time

Brendan M. gekko at bbqsrc.net
Mon Nov 26 07:48:26 UTC 2007


Thank you very much!

Do you mind if I use it in my busybox package, with all credit going to
you and licenced to you with the GPL?

--
Brendan.


On Mon, November 26, 2007 4:39 pm, Denys Vlasenko wrote:
> On Sunday 25 November 2007 20:12, Brendan M. wrote:
>> Hello there guys,
>> I was wondering how I could change the name of the busybox binary at
>> compile time.
>>
>> I need this because I have to make a busybox package, so i can't just
>> "busybox --install" afterwards, because all the symlinks must be
>> recorded.
>>
>> I just need to know how I can change the binary from busybox to
>> coreutils-busybox and use 'make install' to make the links.
>
> Run this script from a directory where your busybox binary is:
>
> #!/bin/sh
>
> applets=`./busybox 2>&1 \
> | {
> while read -r line; do
>     if echo "$line" \
>     | grep -F "Currently defined functions:" >/dev/null 2>&1; then
>         break
>     fi
> done
> if ! test "$line"; then exit; fi
> while read -r line; do echo -n "$line "; done \
> | sed "s/   */ /g" | sed "s/, / /g"
> }
> `
> pwd=`pwd`
>
> echo 'dir=... #directory where your busybox is'
> for a in $applets; do
>     echo ln -sf $pwd/busybox '$dir/'$a
> done
>
>
>
> Result on standard output:
>
> dir=... #directory where your busybox is
> ln -sf /tmp/busybox $dir/[
> ln -sf /tmp/busybox $dir/[[
> ln -sf /tmp/busybox $dir/addgroup
> ln -sf /tmp/busybox $dir/adduser
> ln -sf /tmp/busybox $dir/adjtimex
> ln -sf /tmp/busybox $dir/ar
> ln -sf /tmp/busybox $dir/arp
> ln -sf /tmp/busybox $dir/arping
> ln -sf /tmp/busybox $dir/ash
> ln -sf /tmp/busybox $dir/awk
> ln -sf /tmp/busybox $dir/basename
> ln -sf /tmp/busybox $dir/bunzip2
> ln -sf /tmp/busybox $dir/bzcat
> ln -sf /tmp/busybox $dir/cal
> ln -sf /tmp/busybox $dir/cat
>
>
>
> By saving it in a file and running it as a shell script, you can create
> links.
>
> Change
> 	echo ln -sf $pwd/busybox '$dir/'$a
> to
> 	echo ln -sf $pwd/coreutils-busybox '$dir/'$a
> and you'll get what you want.
>
> IOW: I have no idea why busybox has --install at all,
> it is trivially doable with shell scripts.
> --
> vda
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://busybox.net/cgi-bin/mailman/listinfo/busybox
>


----------------------------
Brendan
Anarchy Linux Lead Developer
----------------------------




More information about the busybox mailing list