unix2dos command, used by win SDK, has been renamed under Lucid.

Note: this fix was already in master.

Change-Id: I7935093ef4a01181f7239e9aeeef4792ee0b54cc
diff --git a/build/tools/patch_windows_sdk.sh b/build/tools/patch_windows_sdk.sh
index 6875261..14acdac 100755
--- a/build/tools/patch_windows_sdk.sh
+++ b/build/tools/patch_windows_sdk.sh
@@ -1,5 +1,21 @@
 #!/bin/bash
 
+# This script takes a Linux SDK, cleans it and injects the necessary Windows
+# binaries needed by the SDK. The script has 2 parts:
+# - development/tools/build/path_windows_sdk.sh to process the
+#   platform-dependent folders and files.
+# - sdk/build/patch_windows_sdk.sh to process folder and files which
+#   depend on the sdk.git repo. This file will be invoked by this one.
+#
+# Input arguments:
+# -q = Optional arg to make this silent. Must be given first.
+# $1 = Temporary SDK directory, that is the Linux SDK being patched into
+#      a Windows one.
+# $2 = The out/host/windows directory, which contains the new Windows
+#      binaries to use.
+# $3 = An optional replacement for $TOPDIR (inherited from the Android
+#      build system), which is the top directory where Android is located.
+
 # Verbose by default. Use -q to make more silent.
 V="-v"
 if [[ "$1" == "-q" ]]; then V=""; shift; fi
@@ -8,6 +24,13 @@
 WIN_OUT_DIR=$2
 TOPDIR=${TOPDIR:-$3}
 
+# The unix2dos is provided by the APT package "tofrodos". However
+# as of ubuntu lucid, the package renamed the command to "todos".
+UNIX2DOS=`which unix2dos`
+if [[ ! -x $UNIX2DOS ]]; then
+  UNIX2DOS=`which todos`
+fi
+
 PLATFORMS=( $TEMP_SDK_DIR/platforms/* )
 if [[ ${#PLATFORMS[@]} != 1 ]]; then
     echo "Error: Too many platforms found in $TEMP_SDK_DIR"
@@ -101,11 +124,14 @@
 
 # Fix EOL chars to make window users happy - fix all files at the top level
 # as well as all batch files including those in platforms/<name>/tools/
-find $TEMP_SDK_DIR -maxdepth 1 -name "*.[ht]*" -type f -print0 | xargs -0 unix2dos
-find $TEMP_SDK_DIR -maxdepth 3 -name "*.bat"   -type f -print0 | xargs -0 unix2dos
+if [[ -x $UNIX2DOS ]]; then
+  find $TEMP_SDK_DIR -maxdepth 1 -name "*.[ht]*" -type f -print0 | xargs -0 $UNIX2DOS
+  find $TEMP_SDK_DIR -maxdepth 3 -name "*.bat"   -type f -print0 | xargs -0 $UNIX2DOS
+fi
 
 # Just to make it easier on the build servers, we want fastboot and adb (and its DLLs)
 # next to the new SDK, so up one dir.
 for i in fastboot.exe adb.exe AdbWinApi.dll AdbWinUsbApi.dll; do
     cp -f $V $WIN_OUT_DIR/host/windows-x86/bin/$i $TEMP_SDK_DIR/../$i
 done
+
diff --git a/build/tools/windows_sdk.mk b/build/tools/windows_sdk.mk
index 9609160..f02822f 100644
--- a/build/tools/windows_sdk.mk
+++ b/build/tools/windows_sdk.mk
@@ -18,7 +18,7 @@
 ifeq ($(strip $(shell which i586-mingw32msvc-gcc 2>/dev/null)),)
 $(error MinGW is required to build a Windows SDK. Please 'apt-get install mingw32')
 endif
-ifeq ($(strip $(shell which unix2dos 2>/dev/null)),)
+ifeq ($(strip $(shell which unix2dos todos 2>/dev/null)),)
 $(error Need a unix2dos command. Please 'apt-get install tofrodos')
 endif