[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[rhel5-branch] Add busybox to initrd (#500527)



---
 scripts/mk-images |   40 ++++++++++++++++++++++------------------
 1 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/scripts/mk-images b/scripts/mk-images
index 99d861c..a61b930 100755
--- a/scripts/mk-images
+++ b/scripts/mk-images
@@ -449,25 +449,7 @@ EOF
     cp -f $IMGPATH/usr/sbin/sshd $MBD_DIR/sbin/sshd
     cp -f $IMGPATH/usr/sbin/xinetd $MBD_DIR/sbin/xinetd
     cp -f $IMGPATH/usr/sbin/in.telnetd $MBD_DIR/sbin/in.telnetd
-    cp -f $IMGPATH/usr/bin/bash $MBD_DIR/sbin/bash
     cp -f $IMGPATH/usr/bin/ipcalc $MBD_DIR/sbin/ipcalc
-    cp -f $IMGPATH/usr/bin/busybox $MBD_DIR/sbin/busybox
-
-    # make some symlinks
-    ln -sf bash $MBD_DIR/sbin/sh
-    (cd $MBD_DIR/sbin;
-    	set $(./busybox 2>&1| awk '/^\t([[:alnum:]_\.\[]+,)+/' | sed 's/,//g' | sed 's/ +//');
-    	while [ -n "$1" ]; do
-    	      if [ $1 != "busybox" -a $1 != "sh" ]; then
-              	 # if file doesnt already exist, link to busybox
-		   if [ ! -f "$1" ]; then
-	    	      ln -sf ./busybox $1
-		   else
-		      [ -n "$DEBUG" ] && echo "Overriding busybox version of $1"
-		   fi
-    	      fi
-    	      shift
-	 done )
 
     # and copy libraries too
     mkdir -p $MBD_DIR/$LIBDIR $MBD_DIR/lib
@@ -533,6 +515,26 @@ EOF
     done 
 }
 
+addBusyBox() {
+    cp -f $IMGPATH/usr/bin/bash $MBD_DIR/sbin/bash
+    cp -f $IMGPATH/usr/bin/busybox $MBD_DIR/sbin/busybox
+
+    # make some symlinks
+    ln -sf bash $MBD_DIR/sbin/sh
+    (cd $MBD_DIR/sbin;
+      set $(./busybox 2>&1 | awk '/^\t([[:alnum:]_\.\[]+,)+/' | sed 's/,//g' | sed 's/ +//');
+      while [ -n "$1" ]; do
+        if [ $1 != "busybox" -a $1 != "sh" ]; then
+          if [ ! -f "$1" ]; then
+            ln -sf ./busybox $1
+          else
+            [ -n "$DEBUG" ] && echo "Overriding busybox version of $1"
+          fi
+        fi
+        shift
+      done)
+}
+
 makeinitrd() {
     EXTRAINITRDPATH=""
     INITRDSIZE=""
@@ -677,6 +679,8 @@ EOF
 	setupShellEnvironment
     fi
 
+    addBusyBox
+
 cat > $MBD_DIR/.profile <<EOF
 PATH=/bin:/usr/bin:/usr/sbin:/mnt/sysimage/sbin:/mnt/sysimage/usr/sbin:/mnt/sysimage/bin:/mnt/sysimage/usr/bin
 export PATH
-- 
1.7.3.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]