6355592 fix for 6210677 breaks bfu
authorraf
Sat, 26 Nov 2005 13:39:08 -0800
changeset 997 72cb91306495
parent 996 2f87885a658c
child 998 d84ba40739f6
6355592 fix for 6210677 breaks bfu
usr/src/tools/scripts/bfu.sh
--- a/usr/src/tools/scripts/bfu.sh	Fri Nov 25 15:29:24 2005 -0800
+++ b/usr/src/tools/scripts/bfu.sh	Sat Nov 26 13:39:08 2005 -0800
@@ -2145,6 +2145,29 @@
 	${GZIPBIN-$GATE/public/bin/$bfu_isa/gzip}
 "
 
+#
+# Scripts needed by BFU. These must be modified to use the interpreters in
+# /tmp/bfubin. The interpreters in /usr/bin may not be compatible with the
+# libraries in the archives being extracted.
+#
+bfuscr="
+	${ACR-${GATE}/public/bin/acr}
+"
+
+#
+# basename and dirname may be ELF executables, not shell scripts;
+# make sure they go into the right list.
+#
+if `file /usr/bin/basename | grep ELF >/dev/null`
+then	bfucmd="$bfucmd /usr/bin/basename"
+else	bfuscr="$bfuscr /usr/bin/basename"
+fi
+
+if `file /usr/bin/dirname | grep ELF >/dev/null`
+then	bfucmd="$bfucmd /usr/bin/dirname"
+else	bfuscr="$bfuscr /usr/bin/dirname"
+fi
+
 rm -rf /tmp/bfubin
 mkdir /tmp/bfubin
 set $bfucmd
@@ -2307,18 +2330,6 @@
 
 ${BFULD-$GATE/public/bin/$bfu_isa/bfuld} /tmp/bfubin/* || fail "bfuld failed"
 
-#
-# Scripts needed by BFU. These must be modified to use the interpreters in
-# /tmp/bfubin. The interpreters in /usr/bin may not be compatible with the
-# libraries in the archives being extracted.
-#
-#
-bfuscr="
-	/usr/bin/basename
-	/usr/bin/dirname
-	${ACR-${GATE}/public/bin/acr}
-"
-
 for x in $bfuscr
 do
 	sed -e 's/\/usr\/bin\//\/tmp\/bfubin\//g' \
@@ -3803,7 +3814,7 @@
 			# files are relative to /boot.
 			for file in $saved_boot_files
 			do
-				dir="`/usr/bin/dirname $rootprefix/stubboot/$file`"
+				dir="`dirname $rootprefix/stubboot/$file`"
 				mkdir -p $dir
 				cp $rootprefix/boot/$file $dir
 			done