Revert "cm: Revert the new boot animation generation process"

This reverts commit e2ec4c6051114596f616fa2cb203502881669287.

* New build server(s) will be able to support this

Change-Id: I990297e6db7aa6076199bb6344328e704b1d4ebe
diff --git a/bootanimation/generate-bootanimation.sh b/bootanimation/generate-bootanimation.sh
new file mode 100755
index 0000000..b5d8f19
--- /dev/null
+++ b/bootanimation/generate-bootanimation.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+WIDTH="$1"
+HEIGHT="$2"
+HALF_RES="$3"
+OUT="$ANDROID_PRODUCT_OUT/obj/BOOTANIMATION"
+
+if [ "$HEIGHT" -lt "$WIDTH" ]; then
+    SIZE="$HEIGHT"
+else
+    SIZE="$WIDTH"
+fi
+
+if [ "$HALF_RES" = "true" ]; then
+    IMAGESIZE=$(expr $SIZE / 2)
+else
+    IMAGESIZE="$SIZE"
+fi
+
+RESOLUTION=""$IMAGESIZE"x"$IMAGESIZE""
+
+for part_cnt in 0 1 2
+do
+    mkdir -p $ANDROID_PRODUCT_OUT/obj/BOOTANIMATION/bootanimation/part$part_cnt
+done
+tar xfp "vendor/cm/bootanimation/bootanimation.tar" --to-command="convert - -resize '$RESOLUTION' \"png8:$OUT/bootanimation/\$TAR_FILENAME\""
+
+# Create desc.txt
+echo "$SIZE" "$SIZE" 30 > "$OUT/bootanimation/desc.txt"
+cat "vendor/cm/bootanimation/desc.txt" >> "$OUT/bootanimation/desc.txt"
+
+# Create bootanimation.zip
+cd "$OUT/bootanimation"
+
+zip -qr0 "$OUT/bootanimation.zip" .