Patchwork [1/2] Set an explicit path for the initrd scripts

login
register
mail settings
Submitter Darren Hart
Date Sept. 15, 2011, 10:41 p.m.
Message ID <646b5593ef8783e642feb6083a79e68ac434d1f2.1316126173.git.dvhart@linux.intel.com>
Download mbox | patch
Permalink /patch/11491/
State New, archived
Headers show

Comments

Darren Hart - Sept. 15, 2011, 10:41 p.m.
If we don't set PATH, then the shell will specify one for us.
Busybox adds the sbin dirs, but bash does not. I hit an
issue where bash (among other things) ended up in my initrd
and the boot scripts failed due to a bad default PATH. While
that is a separate issue, we should not be at the mercy of the
shell's default PATH. Update the initrdscripts to all specify:

PATH=/sbin:/bin:/usr/sbin:/usr/bin

Signed-off-by: Darren Hart <dvhart@linux.intel.com>
---
 meta/recipes-core/initrdscripts/files/init-boot.sh |    2 ++
 .../initrdscripts/files/init-install.sh            |    2 ++
 meta/recipes-core/initrdscripts/files/init-live.sh |    4 +++-
 3 files changed, 7 insertions(+), 1 deletions(-)

Patch

diff --git a/meta/recipes-core/initrdscripts/files/init-boot.sh b/meta/recipes-core/initrdscripts/files/init-boot.sh
index 9d804fc..e82eba0 100644
--- a/meta/recipes-core/initrdscripts/files/init-boot.sh
+++ b/meta/recipes-core/initrdscripts/files/init-boot.sh
@@ -1,5 +1,7 @@ 
 #!/bin/sh
 
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
 mkdir /proc
 mkdir /sys
 mount -t proc proc /proc
diff --git a/meta/recipes-core/initrdscripts/files/init-install.sh b/meta/recipes-core/initrdscripts/files/init-install.sh
index fb6cea8..d31d994 100644
--- a/meta/recipes-core/initrdscripts/files/init-install.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install.sh
@@ -5,6 +5,8 @@ 
 # install.sh [device_name] [rootfs_name] [video_mode] [vga_mode]
 #
 
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
 # We need 20 Mb for the boot partition
 boot_size=20
 
diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh b/meta/recipes-core/initrdscripts/files/init-live.sh
index 6a1deba..c054863 100644
--- a/meta/recipes-core/initrdscripts/files/init-live.sh
+++ b/meta/recipes-core/initrdscripts/files/init-live.sh
@@ -1,5 +1,7 @@ 
 #!/bin/sh
 
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
 ROOT_MOUNT="/rootfs/"
 ROOT_IMAGE="rootfs.img"
 MOUNT="/bin/mount"
@@ -12,7 +14,7 @@  early_setup() {
     mount -t proc proc /proc
     mount -t sysfs sysfs /sys
     udevd --daemon
-    /sbin/udevadm trigger --action=add
+    udevadm trigger --action=add
 }
 
 read_args() {