[OpenWrt-Devel] [EXPERIMENTAL] [PATCH] package/utils/busybox: Make busybox /bin /sbin so full first in /usr/bin /usr/sbin
openwrt at daniel.thecshore.com
openwrt at daniel.thecshore.com
Sun Feb 21 22:38:05 EST 2016
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.
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).
---
package/base-files/files/lib/upgrade/common.sh | 10 +++++-----
.../0017-tools-add-some-helper-tools-for-Lantiq-SoCs.patch | 4 ++--
package/utils/busybox/Makefile | 2 +-
...n-for-busybox-so-full-are-first-in-usr-bin-usr-sbin.patch | 12 ++++++++++++
4 files changed, 20 insertions(+), 8 deletions(-)
create mode 100644 package/utils/busybox/patches/400-use-only-bin-sbin-for-busybox-so-full-are-first-in-usr-bin-usr-sbin.patch
diff --git a/package/base-files/files/lib/upgrade/common.sh b/package/base-files/files/lib/upgrade/common.sh
index 0383d25..bed8fae 100644
--- a/package/base-files/files/lib/upgrade/common.sh
+++ b/package/base-files/files/lib/upgrade/common.sh
@@ -49,11 +49,11 @@ supivot() { # <new_root> <old_root>
run_ramfs() { # <command> [...]
install_bin /bin/busybox /bin/ash /bin/sh /bin/mount /bin/umount \
/sbin/pivot_root /sbin/reboot /bin/sync /bin/dd /bin/grep \
- /bin/cp /bin/mv /bin/tar /usr/bin/md5sum "/usr/bin/[" /bin/dd \
- /bin/vi /bin/ls /bin/cat /usr/bin/awk /usr/bin/hexdump \
- /bin/sleep /bin/zcat /usr/bin/bzcat /usr/bin/printf /usr/bin/wc \
- /bin/cut /usr/bin/printf /bin/sync /bin/mkdir /bin/rmdir \
- /bin/rm /usr/bin/basename /bin/kill /bin/chmod
+ /bin/cp /bin/mv /bin/tar /bin/md5sum "/bin/[" /bin/dd \
+ /bin/vi /bin/ls /bin/cat /bin/awk /bin/hexdump \
+ /bin/sleep /bin/zcat /bin/bzcat /bin/printf /bin/wc \
+ /bin/cut /bin/printf /bin/sync /bin/mkdir /bin/rmdir \
+ /bin/rm /bin/basename /bin/kill /bin/chmod
install_bin /bin/uclient-fetch /bin/wget
install_bin /sbin/mtd
diff --git a/package/boot/uboot-lantiq/patches/0017-tools-add-some-helper-tools-for-Lantiq-SoCs.patch b/package/boot/uboot-lantiq/patches/0017-tools-add-some-helper-tools-for-Lantiq-SoCs.patch
index ef6666a..cd6f4ea 100644
--- a/package/boot/uboot-lantiq/patches/0017-tools-add-some-helper-tools-for-Lantiq-SoCs.patch
+++ b/package/boot/uboot-lantiq/patches/0017-tools-add-some-helper-tools-for-Lantiq-SoCs.patch
@@ -167,7 +167,7 @@ Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck at gmail.com>
--- /dev/null
+++ b/tools/lantiq_bdi_conf.awk
@@ -0,0 +1,116 @@
-+#!/usr/bin/awk -f
++#!/bin/awk -f
+#
+# Copyright (C) 2013 Luka Perkov <luka at openwrt.org>
+# Copyright (C) 2013 Daniel Schwierzeck <daniel.schwierzeck at gmail.com>
@@ -358,7 +358,7 @@ Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck at gmail.com>
--- /dev/null
+++ b/tools/lantiq_ram_init_uart.awk
@@ -0,0 +1,117 @@
-+#!/usr/bin/awk -f
++#!/bin/awk -f
+#
+# Copyright (C) 2011-2012 Luka Perkov <luka at openwrt.org>
+# Copyright (C) 2012 Daniel Schwierzeck <daniel.schwierzeck at gmail.com>
diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile
index 6a55d56..1812336 100644
--- a/package/utils/busybox/Makefile
+++ b/package/utils/busybox/Makefile
@@ -110,7 +110,7 @@ define Build/Compile
endef
define Package/busybox/install
- $(INSTALL_DIR) $(1)/etc/init.d
+ $(INSTALL_DIR) $(1)/etc/init.d $(1)/usr/sbin
$(CP) $(PKG_INSTALL_DIR)/* $(1)/
$(INSTALL_BIN) ./files/cron $(1)/etc/init.d/cron
$(INSTALL_BIN) ./files/sysntpd $(1)/etc/init.d/sysntpd
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
--
2.4.3
_______________________________________________
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