blob: 2d1e0c7aeff84551d212e4906268111caafd5a99 [file] [log] [blame]
Griffin Millenderbe3bb332016-10-07 18:16:06 -05001#!/bin/bash
2
Vasyl Gello7d79c392019-07-01 13:52:35 +00003PRODUCT_OUT="$1"
4WIDTH="$2"
5HEIGHT="$3"
6HALF_RES="$4"
7
8OUT="$PRODUCT_OUT/obj/BOOTANIMATION"
Griffin Millenderbe3bb332016-10-07 18:16:06 -05009
10if [ "$HEIGHT" -lt "$WIDTH" ]; then
11 IMAGEWIDTH="$HEIGHT"
12else
13 IMAGEWIDTH="$WIDTH"
14fi
15
16IMAGESCALEWIDTH="$IMAGEWIDTH"
Vasyl Gello7d79c392019-07-01 13:52:35 +000017IMAGESCALEHEIGHT=$(expr $IMAGESCALEWIDTH / 3)
Griffin Millenderbe3bb332016-10-07 18:16:06 -050018
Vasyl Gello7d79c392019-07-01 13:52:35 +000019if [ "$HALF_RES" = "true" ]; then
20 IMAGEWIDTH=$(expr $IMAGEWIDTH / 2)
21fi
22
23IMAGEHEIGHT=$(expr $IMAGEWIDTH / 3)
Griffin Millenderbe3bb332016-10-07 18:16:06 -050024
25RESOLUTION=""$IMAGEWIDTH"x"$IMAGEHEIGHT""
26
Vasyl Gello7d79c392019-07-01 13:52:35 +000027for part_cnt in 0 1 2 3 4
Griffin Millenderbe3bb332016-10-07 18:16:06 -050028do
Vasyl Gello7d79c392019-07-01 13:52:35 +000029 mkdir -p "$OUT/bootanimation/part$part_cnt"
Griffin Millenderbe3bb332016-10-07 18:16:06 -050030done
Vasyl Gello7d79c392019-07-01 13:52:35 +000031tar xfp "vendor/bliss/bootanimation/bootanimation.tar" -C "$OUT/bootanimation/"
32mogrify -resize $RESOLUTION -colors 250 "$OUT/bootanimation/"*"/"*".png"
Griffin Millenderbe3bb332016-10-07 18:16:06 -050033
34# Create desc.txt
Vasyl Gello7d79c392019-07-01 13:52:35 +000035echo "$IMAGESCALEWIDTH $IMAGESCALEHEIGHT" 60 > "$OUT/bootanimation/desc.txt"
36cat "vendor/bliss/bootanimation/desc.txt" >> "$OUT/bootanimation/desc.txt"
Griffin Millenderbe3bb332016-10-07 18:16:06 -050037
38# Create bootanimation.zip
Vasyl Gello7d79c392019-07-01 13:52:35 +000039cd "$OUT/bootanimation"
Griffin Millenderbe3bb332016-10-07 18:16:06 -050040
Vasyl Gello7d79c392019-07-01 13:52:35 +000041zip -qr0 "$OUT/bootanimation.zip" .