[OpenWrt-Devel] [EXPERIMENTAL] [PATCH] package/utils/busybox: Make busybox /bin /sbin so full first in /usr/bin /usr/sbin

Felix Fietkau nbd at openwrt.org
Mon Feb 22 04:47:07 EST 2016


On 2016-02-22 04:38, openwrt at daniel.thecshore.com wrote:
> From: Daniel Dickinson <openwrt at daniel.thecshore.com>
> 
> Put all busybox applets in /bin and /sbin so that full versions
> can be placed in /usr/bin and /usr/sbin without conflicts, which
> will make the full versions found first since /usr/bin and /usr/sbin
> is first in the default PATH.
> 
> Signed-off-by: Daniel Dickinson <openwrt at daniel.thecshore.com>
> ---
> 
> This patch is only compile tested as I'd like to get help to find
> the places I've missed where there are hard-coded paths to the usual
> locations of the busybox applets.  AFAICT the only place in the
> _openwrt_ source code where the paths are hard-coded is where it
> is required by sysupgrade.
The correct subject prefix for such a patch is [RFC] instead of [PATCH].

> Upstream source code may have hard-coded paths as well, but that is a
> much more difficult thing to find as things like configure also use
> hard-coded paths and that makes it difficult to find the uses that
> actually end up on the router (that is a simple grep -r on build_dir
> won't suffice).
> 
> This patch is designed to eliminate the packages feed workaround for
> the problems of installing full versions of tools for which there is a
> busybox applet (either results in a conflict or the busybox applet
> being used because it's first in PATH)) which involves mangling the
> busybox symlink to point to the full version as well as the fact
> that in most cases there is currently no solution in place for full
> vs busybox issues and as a result uninstalling full versions can result
> in a broken system due to missing busybox symlinks (e.g. of you
> choose to override a conflict) or the full version doesn't actually
> get used (because later in PATH).
There will be a lot of breakage and some applets at least need a
compatibility link to /usr, e.g. /usr/bin/env to allow for portable
shell scripts.

> diff --git a/package/utils/busybox/patches/400-use-only-bin-sbin-for-busybox-so-full-are-first-in-usr-bin-usr-sbin.patch b/package/utils/busybox/patches/400-use-only-bin-sbin-for-busybox-so-full-are-first-in-usr-bin-usr-sbin.patch
> new file mode 100644
> index 0000000..5d6efcf
> --- /dev/null
> +++ b/package/utils/busybox/patches/400-use-only-bin-sbin-for-busybox-so-full-are-first-in-usr-bin-usr-sbin.patch
> @@ -0,0 +1,12 @@
> +Index: busybox-1.24.1/applets/busybox.mkll
> +===================================================================
> +--- busybox-1.24.1.orig/applets/busybox.mkll
> ++++ busybox-1.24.1/applets/busybox.mkll
> +@@ -17,6 +17,7 @@ $HOSTCC -E -DMAKE_LINKS -include $CONFIG
> + 	dir=substr($2,7)
> + 	gsub("_","/",dir)
> + 	if(dir=="/ROOT") dir=""
> ++	if(substr(dir,1,4)=="/USR") dir=substr(dir,5)
> + 	file=$3
> + 	gsub("\"","",file)
> + 	if (file=="busybox") next
Busybox actually has a config option for this. I think there is probably
no need to patch it.

- Felix
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list