[OpenWrt-Devel] [PATCH] base-files: use the correct path in case of modified preinit options
Hannu Nyman
hannu.nyman at iki.fi
Wed Nov 18 10:13:29 EST 2015
If the user sets any preinit options in .config, the wrong path may get
applied due to wrong default value in image-config.in and due to Makefile
writing also the unchanged options into 00_preinit.conf
Modify the default path in image-config.in to match the current default
path set by r47080. Also modify the fall-back default in Makefile.
Signed-off-by: Hannu Nyman <hannu.nyman at iki.fi>
---
r47080 modified the default PATH almost everywhere, including the preinit
path, but it overlooked the case where user modifies other preinit options.
https://dev.openwrt.org/changeset/47080/
The problem lies in the behaviour of base-files Makefile. In case the user
has set any PREINITOPT (e.g. the failsafe wait timeout), the Makefile
sources all preinit/init options using the defaults from image-config.in
and Makefile.
https://dev.openwrt.org/browser/trunk/package/base-files/Makefile#L68
Those options are placed in a new /lib/preinit/00_preinit.conf
When preinit runs, it first defines its own default path (line 23) as
defined in r47080, but overrides it with 00_preinit.conf on line 36-37.
https://dev.openwrt.org/browser/trunk/package/base-files/files/etc/preinit
The Makefile contains an additional fallback value that gets used in case
the .config does not include a value for preinit path.
This patch modifies both the default value in image-config.in and
the fallback value in Makefile to match the current default path
as set by r47080.
Afaik, the value only affects the preinit/failsafe stage, but let's
set the defaults correctly to avoid unexpected behaviour later.
package/base-files/Makefile | 4 ++--
package/base-files/image-config.in | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/package/base-files/Makefile b/package/base-files/Makefile
index 12f9489..b076dd9 100644
--- a/package/base-files/Makefile
+++ b/package/base-files/Makefile
@@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/version.mk
PKG_NAME:=base-files
-PKG_RELEASE:=161
+PKG_RELEASE:=162
PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
PKG_BUILD_DEPENDS:=opkg/host usign/host
@@ -70,7 +70,7 @@ define ImageConfigOptions
mkdir -p $(1)/lib/preinit
echo 'pi_suppress_stderr="$(CONFIG_TARGET_PREINIT_SUPPRESS_STDERR)"' >$(1)/lib/preinit/00_preinit.conf
echo 'fs_failsafe_wait_timeout=$(if $(CONFIG_TARGET_PREINIT_TIMEOUT),$(CONFIG_TARGET_PREINIT_TIMEOUT),2)' >>$(1)/lib/preinit/00_preinit.conf
- echo 'pi_init_path=$(if $(CONFIG_TARGET_INIT_PATH),$(CONFIG_TARGET_INIT_PATH),"/bin:/sbin:/usr/bin:/usr/sbin")' >>$(1)/lib/preinit/00_preinit.conf
+ echo 'pi_init_path=$(if $(CONFIG_TARGET_INIT_PATH),$(CONFIG_TARGET_INIT_PATH),"/usr/sbin:/usr/bin:/sbin:/bin")' >>$(1)/lib/preinit/00_preinit.conf
echo 'pi_init_env=$(if $(CONFIG_TARGET_INIT_ENV),$(CONFIG_TARGET_INIT_ENV),"")' >>$(1)/lib/preinit/00_preinit.conf
echo 'pi_init_cmd=$(if $(CONFIG_TARGET_INIT_CMD),$(CONFIG_TARGET_INIT_CMD),"/sbin/init")' >>$(1)/lib/preinit/00_preinit.conf
echo 'pi_init_suppress_stderr="$(CONFIG_TARGET_INIT_SUPPRESS_STDERR)"' >>$(1)/lib/preinit/00_preinit.conf
diff --git a/package/base-files/image-config.in b/package/base-files/image-config.in
index c1c0924..3dfbedc 100644
--- a/package/base-files/image-config.in
+++ b/package/base-files/image-config.in
@@ -99,7 +99,7 @@ menuconfig INITOPT
config TARGET_INIT_PATH
string
prompt "PATH for regular boot" if INITOPT
- default "/bin:/sbin:/usr/bin:/usr/sbin"
+ default "/usr/sbin:/usr/bin:/sbin:/bin"
help
Default PATH used during normal operation
--
2.5.0
_______________________________________________
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